import prody
prot = prody.parsePDB('3UB5')
The default visualization in ProDy uses matplotlib.
%matplotlib inline
prody.showProtein(prot)
/usr/local/lib/python2.7/dist-packages/prody/atomic/subset.py:35: FutureWarning: Conversion of the second argument of issubdtype from `int` to `np.signedinteger` is deprecated. In future, it will be treated as `np.int64 == np.dtype(int).type`. elif not np.issubdtype(indices.dtype, int):
<mpl_toolkits.mplot3d.axes3d.Axes3D at 0x7f3e2d4d41d0>
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
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
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
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
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
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,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
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
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,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
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