import prody
prot = prody.parsePDB('3UB5')
@> PDB file is found in working directory (3ub5.pdb.gz). @> 4055 atoms and 1 coordinate set(s) were parsed in 0.06s.
The default visualization in ProDy uses matplotlib.
%matplotlib inline
prody.showProtein(prot)
<mpl_toolkits.mplot3d.axes3d.Axes3D at 0x11bf6c7b8>
With the latest version of ProDy, py3Dmol
will be used if it has been imported.
prody.checkUpdates()
@> ProDy v1.10.11 is available, you are using 1.10.10.
import py3Dmol
prody.showProtein(prot)
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
<py3Dmol.view at 0x11e0c5a58>
A number of keyword arguments are supported.
The background color is configurable.
prody.showProtein(prot,backgroundColor="black")
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
<py3Dmol.view at 0x11e1c2710>
The height and width of the viewer can be changed.
prody.showProtein(prot, height=400, width=200,backgroundcolor='gray')
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
<py3Dmol.view at 0x11e1c28d0>
The viewer can be zoomed and centered on a given AtomSelectionSpec.
prody.showProtein(prot, zoomto={'resn':'ATP'})
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
<py3Dmol.view at 0x11e1c2828>
Custom styles can be applied by providing AtomSelectionSpec and AtomStyleSpec objects.
A single style may be applied.
prody.showProtein(prot,style={'cartoon':{'colorscheme':'chain'},'stick':{'colorscheme':'chain'}})
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
<py3Dmol.view at 0x11e1c2c18>
For more complex styling, generate and manipulate the py3Dmol view object directly.
view = prody.view3D(prot)
view.setStyle({'cartoon':{'colorscheme':'chain'}})
view.setStyle({'hetflag':True},{'stick':{'colorscheme':'magentaCarbon'}})
view.setStyle({'bonds': 0},{'sphere':{'radius':0.5}})
view.addLabel('Chain A',{'inFront':True,'showBackground':False,'fontColor':'blue'},{'chain':'A'})
view.addLabel('Chain P',{'inFront':True,'showBackground':False,'fontColor':'green'},{'chain':'P'})
view.show()
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
Squared fluctuations (or any other alpha-carbon length numerical vector) can be visualized in a RWB colorscheme. Red values are larger.
gnm, sel = prody.calcGNM(prot,cutoff=7.3)
@> Kirchhoff was built in 0.04s. @> 20 modes were calculated in 0.23s.
Individual modes may be visualized.
prody.showProtein(prot,flucts=prody.calcSqFlucts(gnm[0]))
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
<py3Dmol.view at 0x11e1c2cf8>
Styles can still be applied.
prody.showProtein(prot,flucts=gnm[1].getArray(),style={'cartoon':{}})
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
<py3Dmol.view at 0x11e1c2908>
It is also possible to provide an array of vectors (one per a calpha) that can be used to animate motions. The animate kwarg takes the 3Dmol.js animate options.
anm, sel = prody.calcANM(prot)
@> Hessian was built in 1.27s. @> 20 modes were calculated in 0.60s.
prody.showProtein(prot,vecs=anm[0].getArray(),
flucts=prody.calcSqFlucts(anm[0]),
style={'cartoon':{}})
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
<py3Dmol.view at 0x10a7da208>
prody.showProtein(prot,prot,flucts=[gnm[1].getArray(),prody.calcSqFlucts(anm[0])],vecs=[anm[0].getArray(),[]])
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
<py3Dmol.view at 0x10a7da438>
prody.__version__
'1.10.10'