Miscellaneous Tools

This module defines miscellaneous functions dealing with protein data.

view3D(*alist, **kwargs)[source]

Return a py3Dmol view instance for interactive visualization in Jupyter notebooks. Available arguments are: width, height (of the viewer), backgroundColor, zoomTo (a py3Dmol selection to center around), and style, which is a py3Dmol style object that will be applied to all atoms in the scene. More complex styling can be achieved by manipulating the view object directly.

The default style is to show the protein in a rainbow cartoon and hetero atoms in sticks/spheres.

GNM/ANM Coloring

An array of fluctuation values can be provided with the flucts kwarg for visualization of GNM/ANM calculations. The array is assumed to correpond to a calpha selection of the provided protein. The default color will be set to a RWB color scheme on a per-residue basis. If the fluctuation vector contains negative values, the midpoint (white) will be at zero. Otherwise the midpoint is the mean.

An array of displacement vectors can be provided with the vecs kwarg. The animation of these motions can be controlled with frames (number of frames to animate over), amplitude (scaling factor), and animate (3Dmol.js animate options).

showProtein(*atoms, **kwargs)[source]

Show protein representation using Axes3D(). This function is designed for generating a quick view of the contents of a AtomGroup or Selection.

Protein atoms matching "calpha" selection are displayed using solid lines by picking a random and unique color per chain. Line with can be adjusted using lw argument, e.g. lw=12. Default width is 4. Chain colors can be overwritten using chain identifier as in A='green'.

Water molecule oxygen atoms are represented by red colored circles. Color can be changed using water keyword argument, e.g. water='aqua'. Water marker and size can be changed using wmarker and wsize keywords, defaults values are wmarker='.', wsize=6.

Hetero atoms matching "hetero and noh" selection are represented by circles and unique colors are picked at random on a per residue basis. Colors can be customized using residue name as in NAH='purple'. Note that this will color all distinct residues with the same name in the same color. Hetero atom marker and size can be changed using hmarker and hsize keywords, default values are hmarker='o', hsize=6.

ProDy will set the size of axis so the representation is not distorted when the shape of figure window is close to a square. Colors are picked at random, except for water oxygens which will always be colored red.

* Interactive 3D Rendering in Jupyter Notebook *

If py3Dmol has been imported then it will be used instead to display an interactive viewer. See view3D()

writePQR(filename, atoms)[source]

Write atoms in PQR format to a file with name filename. Only current coordinate set is written. Returns filename upon success. If filename ends with .gz, a compressed file will be written.