provis.src.plotting package
The plotting package includes the four classes that handle plotting. (While the Structure and Surface classes still work, all of their functions also exist in the Plotter.)
To plot a protein, one can simply call the plotting member functions of these classes (after initialization).
provis.src.plotting.dynamic_plotter module
- class provis.src.plotting.dynamic_plotter.DynamicPlotter(prot: provis.src.processing.protein.Protein, msms=True, notebook=False, plot_solvent=False)
Bases:
object
The DynamicPlotter class, similarly to the Plotter class, encapsulates every other class and creates a user friendly way to plot your desired dynamic structure of a protein molecules.
While the class is built similarly to the Plotter class it does not use the Plotter class itself. This is due to the fact that the Plotter class is a class made to plot a static molecules.
- plot_atoms(box=0, res=0, outname=None, camera=None)
Plot the atoms as spheres. Each atom has a radius proportianal to its calculated atomic radius.
Consult https://en.wikipedia.org/wiki/CPK_coloring for the coloring.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_atoms.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_backbone(box=0, res=0, outname=0, camera=None)
Plots the backbone (roughly the amide bonds) of the protein.
- Parameters:
- box: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_backbone.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_bonds(box=0, res=0, outname=0, colorful=False, camera=None)
Plot only the bonds. By default all bonds will be plotted uniformly.
If the difference in bond types is of interest set the “colorful” variable to True. Coloring: - Single bonds: white - Double bonds: blue - Triple bonds: green - Amide bonds: red - Aromatic bonds: purple - Undefined/Anything else: black
- Parameters:
- box: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_atoms.png.
- colorful: bool, optional
If True bonds will be plotted in a colorful manner. If False all bonds are white. Default: False
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_charge(box=None, res=None, outname=None, camera=None)
Plot the charge features of a protein.
- Parameters:
- box, optional: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img/ directory. Default: data/img/{self._out_path}_surface.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_hydrophob(box=None, res=None, outname=None, camera=None)
Plot the hydrophobic features of a protein.
- Parameters:
- box, optional: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img/ directory. Default: data/img/{self._out_path}_surface.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * max_distance_from_center, 0]. Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_residues(box=0, res=0, outname=0, camera=None)
Plot the residues as Spheres. Each sphere is the approximate size of the radius of the given residue. This plot should only be used to get a general feel for the layout of the protein.
For coloring information please visit: http://acces.ens-lyon.fr/biotic/rastop/help/colour.htm
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_residues.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_shape(box=None, res=None, outname=None, camera=None)
Plot the shape features of a protein.
- Parameters:
- box, optional: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img/ directory. Default: data/img/{self._out_path}_surface.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_stick_point(box=0, res=None, outname=0, camera=None)
Plot stick and point model of the protein. Atoms are spheres, bonds are tubes.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_stick_point.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_structure(box=False, res=None, outname=None, camera=None, title='Structure', atoms=0, bonds=0, vw=0, residues=0, bb=0)
Plot the dynamic atom cloud.
The code in words: Create a Plotter. Loop through the models of the Protein stored in self._protein and perform the following tasks. Clear the plotter. Add the specified meshes to the subplotter. Set the camera position. Render the plotter.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_stick_point.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- title: str, optional
Title of the plotting window. Default: “Structure”.
- atoms: bool, optional
Plot atoms. Default: None.
- bonds: int, optional
ptional - Plot bond. If zero or undefined then it does not plot the bonds, if 1 it plots all bonds uniformly, if 2 it plots colorful bonds (see data_handler). Default: None.
- vw: bool, optional
Plot Wan-der-Waals radii instead of atomic radii.
- residues: bool, optional
ptional - Plot residue. Default: None.
- bb: bool, optional
If True backbone of protein is plotted. Default: False.
- Returns:
- Pyvista.Plotter window
Window with interactive plot
- str - only if self._notebook is True
The full path to where the .mp4 video file is stored.
- plot_surface(feature=None, patch=False, title='Surface', box=None, res=None, outname=None, camera=None)
Plot the dynamic surface of the molecule.
The code in words: Create a Plotter. Loop through the models of the Protein stored in self._protein and perform the following tasks. Clear the plotter. Add the specified meshes to the subplotter. Set the camera position. Render the plotter.
- Parameters:
- feature: str, optional
Pass which feature (coloring) you want to plot. Options: hydrophob, shape, charge. Default: None (uniform coloring).
- patch: bool, optional
If True then coloring will be read in from “root directory”/data/tmp/{pdb_id}.pth file. Default: False.
- title: str, optional
Title of the plot window. Default: Surface.
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_stick_point.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot
- str - only if self._notebook is True
The full path to where the .mp4 video file is stored.
- plot_vw(box=0, res=0, outname=0, camera=None)
Plot Van-der-Waals radius of atoms as spheres. Spheres have a wireframe style to be able to view inner structure as well. To plot Van-der-Waals radii as solid spheres use the manual_plot() member function.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_atoms.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
provis.src.plotting.plotter module
- class provis.src.plotting.plotter.Plotter(prot: provis.src.processing.protein.Protein, prot2=None, msms=True, notebook=False, plot_solvent=False)
Bases:
object
The Plotter class is used for plotting structural and surface information of one or more proteins.
Add Proteins to the Plotter to plot them next to one another. While it is possible to add more than two proteins to one Plotter class it is discouraged, as the window will get cluttered.
- The class can visualize two kinds of surfaces:
a chemically accurate surface created by the MSMS binary.
a good approximation of the surface computed natively with o3d and trimesh. (MSMS does not have to be installed for this option. It is fast, but less precise.)
Choose between the two by setting the msms Boolean variable. (Default: True, corresponding to the MSMS binary option.)
- add_protein(protein: provis.src.processing.protein.Protein)
Add another Protein to the (internal list of the) Plotter object.
- Parameters:
- protein: Protein
Instance of Protein class.
- manual_plot(box=False, res=None, outname=None, atoms=None, col_a=None, bonds=None, vw=0, residues=None, col_r=None, bb=None, camera=None)
Plots list of meshes directly. One can get these meshes from the DataHandler class.
- Parameters:
- box: bool, optional
If True bounding box also visualized. Default: False.
- res: list, optional
List of pyvista Shperes representing each residue. Default: None.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{self._out_path}_stick_point.
- atoms: list, optional
List of pyvista Shperes representing each atom. Default: None.
- col_a: list, optional
List of colors for each atom. Default: None.
- bonds: list, optional
List of pyvista Lines representing each bond. Default: None.
- vw: bool, optional
If True styling for Van-der-Waals plotting set. Vw atomic objects still have to be passed under ‘atoms’ variable.
- col_r: list, optional
List of colors for each residue. Default: None.
- res: Residue, optional
Specified residues will be plotted with a bounding box around them.
- bb: pyvista.Spline, optional
Spline describing the back-bone of the protein. Default: None.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot
- plot_atoms(box=0, res=0, outname=None, camera=None)
Plot the atoms as spheres. Each atom has a radius proportianal to its calculated atomic radius.
Consult https://en.wikipedia.org/wiki/CPK_coloring for the coloring.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_atoms.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_backbone(box=0, res=0, outname=0, camera=None)
Plots the backbone (roughly the amide bonds) of the protein.
- Parameters:
- box: bool, optional
If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_backbone.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_bonds(box=0, res=0, outname=0, colorful=False, camera=None)
Plot only the bonds. By default all bonds will be plotted uniformly.
If the difference in bond types is of interest set the “colorful” variable to True. Coloring: - Single bonds: white - Double bonds: blue - Triple bonds: green - Amide bonds: red - Aromatic bonds: purple - Undefined/Anything else: black
- Parameters:
- box: bool, optional
If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_atoms.png.
- colorful: bool, optional
If True bonds will be plotted in a colorful manner. If False all bonds are white. Default: False
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_charge(box=None, res=None, outname=None, camera=None)
Plot the charge features of a protein.
- Parameters:
- box, optional: bool, optional
If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img/ directory. Default: data/img/{self._out_path}_surface.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_hydrophob(box=None, res=None, outname=None, camera=None)
Plot the hydrophobic features of a protein.
- Parameters:
- box, optional: bool, optional
If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img/ directory. Default: data/img/{self._out_path}_surface.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * max_distance_from_center, 0]. Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_residues(box=0, res=0, outname=0, camera=None)
Plot the residues as Spheres. Each sphere is the approximate size of the radius of the given residue. This plot should only be used to get a general feel for the layout of the protein.
For coloring information please visit: http://acces.ens-lyon.fr/biotic/rastop/help/colour.htm
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_residues.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_shape(box=None, res=None, outname=None, camera=None)
Plot the shape features of a protein.
- Parameters:
- box, optional: bool, optional
If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img/ directory. Default: data/img/{self._out_path}_surface.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_stick_point(box=0, res=None, outname=0, camera=None)
Plot stick and point model of the protein. Atoms are spheres, bonds are tubes.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_stick_point.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_structure(box=0, res=None, outname=0, atoms=0, bonds=0, vw=0, residues=0, bb=0, title='Structure', camera=None)
This member function is called by all the others. Using this function you can plot any combination of the results gotten from the specialized member functions. For example you could plot the atoms and the backbone of the protein in the same plot.
All information to be plotted is already computed. This function simply dictates what is to be plotted.
The code in words: Create a Plotter of size(1, {len(self._proteins)}). Loop through the Proteins in the self._proteins list and perform the following tasks. Add the specified meshes to the subplotter. Set the camera position. Show the plotter.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to {root directory}/data/img/{pdb_id}_{model_id}_stick_point.png. If Structure class was initialized with msms=True then output will have “_msms.png” as the ending.
- atoms: bool, optional
Plot atoms. Default: None.
- bonds: int, optional
ptional - Plot bond. If zero or undefined then it does not plot the bonds, if 1 it plots all bonds uniformly, if 2 it plots colorful bonds (see data_handler). Default: None.
- vw: bool, optional
Plot Wan-der-Waals radii instead of atomic radii.
- residues: bool, optional
ptional - Plot residue. Default: None.
- bb: bool, optional
If True backbone of protein is plotted. Default: False.
- title: str, optional
Title of the plot window. Default: Structure.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot
- plot_surface(feature=None, title='Surface', patch=False, box=None, res=None, outname=None, camera=None)
Plot the surface of the protein. If the surface has already been computed and saved to the default file, then the surface will automatically be loaded from there. The surface can be computed either using the msms binary or natively. The msms binary is chemically accurate surface, while the native one is only for visualization purposes.
If you run into any sort of error concerning array size mismatching or of the sort delete all the temporary files and the mesh ({root directory}/data/meshes/{pdb_id}_{model_id}.obj). This will force everything to be recomputed and the dimension mismatch should disappear.
The code in words: Create a Plotter of size(1, {len(self._proteins)}). Loop through the Proteins in the self._proteins list and perform the following tasks. Add the specified meshes to the subplotter. Set the camera position. Show the plotter.
- Parameters:
- feature: str, optional
Pass which feature (coloring) you want to plot. Options: hydrophob, shape, charge. Default: None (uniform coloring).
- title: str, optional
Title of the plot window. Default: Surface.
- patch: bool, optional
If True then coloring will be read in from “root directory”/data/tmp/{pdb_id}.pth file. Default: False.
- box, optional: bool, optional
If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to {root directory}/data/img/{pdb_id}_{model_id}_surface.png. If Surface class was initialized with msms=True then output will have “_msms.png” as the ending.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_vw(box=0, res=0, outname=0, camera=None)
Plot Van-der-Waals radius of atoms as spheres. Spheres have a wireframe style to be able to view inner structure as well. To plot Van-der-Waals radii as solid spheres use the manual_plot_structure() member function.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized. Default: None.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_atoms.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
provis.src.plotting.structure module
- class provis.src.plotting.structure.Structure(nc, dh=None, plot_solvent=False, notebook=False, msms=False)
Bases:
object
The Structure class is used to visualize the structural information of the given molecule. One can easily plot the atoms, residues, bonds or any combination of these structures.
- manual_plot(box=0, res=0, outname=0, atoms=0, col_a=0, bonds=0, vw=0, residues=0, col_r=0, bb=0, camera=None)
Plot stick and point model. In this function one can pass all the desired meshes to be plotted. One can get these meshes from the DataHandler class.
- Parameters:
- box: bool, optional
If True bounding box also visualized, default: 0.
- res: list, optional
List of pyvista Shperes representing each residue, default: 0.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img directory. default: data/img/{self._out_path}_stick_point.
- atoms: list, optional
List of pyvista Shperes representing each atom, default: 0.
- col_a: list, optional
List of colors for each atom, default: 0.
- bonds: list, optional
List of pyvista Lines representing each bond, default: 0.
- vw: bool, optional
If True styling for Van-der-Waals plotting set. Vw atomic objects still have to be passed under ‘atoms’ variable.
- col_r: list, optional
List of colors for each residue, default: 0.
- res: Residue, optional
Specified residues will be plotted with a bounding box around them.
- bb: bool, optional
List of coordinates describing the back-bone of the protein, default: 0.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot
- plot(box=0, res=None, outname=0, atoms=0, bonds=0, vw=0, residues=0, bb=0, title=None, camera=None, model_id=0, dynamic=False)
This member function is called by all the others. Using this function you can plot any combination of the results gotten from the specialized member functions. For example you could plot the atoms and the backbone of the protein in the same plot.
All information to be plotted is already computed. This function simply dictates what is to be plotted.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to {root directory}/data/img/{pdb_id}_{model_id}_stick_point.png. If Structure class was initialized with msms=True then output will have “_msms.png” as the ending.
- atoms: bool, optional
Plot atoms, default: 0.
- bonds: int, optional
ptional - Plot bond. If zero or undefined then it does not plot the bonds, if 1 it plots all bonds uniformly, if 2 it plots colorful bonds (see data_handler). Default: 0.
- vw: bool, optional
Plot Wan-der-Waals radii instead of atomic radii.
- residues: bool, optional
ptional - Plot residue, default: 0.
- bb: bool, optional
If True backbone of protein is plotted. Default: False.
- title: str, optional
Title of the plot window. Defaults to None.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- model_id: int, optional
The dynamic model ID of the desired molecule. Count starts at 0. Leave default value for static molecules. Default: 0.
- dynamic: bool, optional
Set to True if you are plotting a dynamic model. Default: False.
- Returns:
- Pyvista.Plotter window
Window with interactive plot
- plot_atoms(box=0, res=0, outname=None, camera=None)
Plot the atoms as spheres. Each atom has a radius proportianal to its calculated atomic radius.
Consult https://en.wikipedia.org/wiki/CPK_coloring for the coloring.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_atoms.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_backbone(box=0, res=0, outname=0, camera=None)
Plots the backbone (roughly the amide bonds) of the protein.
- Parameters:
- box: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_backbone.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_bonds(box=0, res=0, outname=0, colorful=False, camera=None)
Plot only the bonds. By default all bonds will be plotted uniformly.
If the difference in bond types is of interest set the “colorful” variable to True. Coloring: - Single bonds: white - Double bonds: blue - Triple bonds: green - Amide bonds: red - Aromatic bonds: purple - Undefined/Anything else: black
- Parameters:
- box: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_atoms.png.
- colorful: bool, optional
If True bonds will be plotted in a colorful manner. If False all bonds are white. Default: False
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_residues(box=0, res=0, outname=0, camera=None)
Plot the residues as Spheres. Each sphere is the approximate size of the radius of the given residue. This plot should only be used to get a general feel for the layout of the protein.
For coloring information please visit: http://acces.ens-lyon.fr/biotic/rastop/help/colour.htm
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_residues.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_stick_point(box=0, res=None, outname=0, camera=None)
Plot stick and point model of the protein. Atoms are spheres, bonds are tubes.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_stick_point.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_vw(box=0, res=0, outname=0, camera=None)
Plot Van-der-Waals radius of atoms as spheres. Spheres have a wireframe style to be able to view inner structure as well. To plot Van-der-Waals radii as solid spheres use the manual_plot() member function.
- Parameters:
- box: bool, optional
ptional - If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to data/img/{pdb_id}_atoms.png.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 4 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
provis.src.plotting.surface module
- class provis.src.plotting.surface.Surface(nc, sh=None, msms=True, density=3.0, notebook=False)
Bases:
object
The Surface class is used to visualize the surface information of the given molecule.
- The class can visualize two kinds of surfaces:
a chemically accurate surface created by the MSMS binary.
a good approximation of the surface computed natively with o3d and trimesh. (MSMS does not have to be installed for this option. It is fast, but less precise.)
Choose between the two by setting the msms Boolean variable. (Default: True, corresponding to the MSMS binary option.)
- plot(feature=None, title='Surface', patch=False, box=None, res=None, outname=None, camera=None, model_id=0)
Plot the surface of the protein. If the surface has already been computed and saved to the default file, then the surface will automatically be loaded from there. The surface can be computed either using the msms binary or natively. The msms binary is chemically accurate surface, while the native one is only for visualization purposes.
If you run into any sort of error concerning array size mismatching or of the sort delete all the temporary files and the mesh ({root directory}/data/meshes/{pdb_id}_{model_id}.obj). This will force everything to be recomputed and the dimension mismatch should disappear.
- Parameters:
- feature: str, optional
Pass which feature (coloring) you want to plot. Options: hydrophob, shape, charge. Default: None (uniform coloring).
- title: str, optional
Title of the plot window. Default: Surface.
- patch: bool, optional
If True then coloring will be read in from “root directory”/data/tmp/{pdb_id}.pth file. Default: False.
- box, optional: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
Save image of plot to specified filename. Will appear in data/img directory. Defaults to {root directory}/data/img/{pdb_id}_{model_id}_surface.png. If Surface class was initialized with msms=True then output will have “_msms.png” as the ending.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- model_id: int, optional
The dynamic model ID of the desired molecule. Count starts at 0. Leave default value for static molecules. Default: 0.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_charge(box=None, res=None, outname=None, camera=None)
Plot the charge features of a protein.
- Parameters:
- box, optional: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img/ directory. Default: data/img/{self._out_path}_surface.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_hydrophob(box=None, res=None, outname=None, camera=None)
Plot the hydrophobic features of a protein.
- Parameters:
- box, optional: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img/ directory. Default: data/img/{self._out_path}_surface.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * max_distance_from_center, 0]. Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.
- plot_shape(box=None, res=None, outname=None, camera=None)
Plot the shape features of a protein.
- Parameters:
- box, optional: bool, optional
If True bounding box also visualized, default: 0.
- res: Residue, optional
Residues passed in ‘res’ will be plotted with a bounding box around them. Defaults to None.
- outname: string, optional
save image of plot to specified filename. Will appear in data/img/ directory. Default: data/img/{self._out_path}_surface.
- camera: pyvista.Camera, optional
Pass a Pyvista Camera https://docs.pyvista.org/api/core/camera.html to manually set the camera position. If nothing/None is passed then the camera position will be set to [0, 3 * “max distance from the center”, 0] (see: https://pro-vis.readthedocs.io/en/latest/tutorial.html for more detail). Default: None.
- Returns:
- Pyvista.Plotter window
Window with interactive plot.