import prody
prot = prody.parsePDB('3UB5')
The default visualization in ProDy uses matplotlib.
import matplotlib.pyplot as plt
%matplotlib inline
prody.showProtein(prot)
<Axes3DSubplot: xlabel='x', ylabel='y', zlabel='z'>
With the latest version of ProDy, py3Dmol
will be used if it has been imported.
prody.checkUpdates()
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 0x7fa75fbcbe20>
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 0x7fa62c38ea70>
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 0x7fa62c38dba0>
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 0x7fa62c38ece0>
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 0x7fa62c38eaa0>
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)
Individual modes may be visualized.
prody.showProtein(prot,data=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 0x7fa62c38f310>
Styles can still be applied.
prody.showProtein(prot,data=gnm[1].getArray(),style={'cartoon':{},'stick':{}})
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 0x7fa62c38f490>
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)
prody.showProtein(prot,mode=anm[0].getArray(),anim=True,
data=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 0x7fa62c38f700>
prody.__version__
'2.4.0'