.. _vizexamplesys: Visualization Example System ============================ All examples below will be created using the example system presented below. In this setup, we will load ``8JXW`` with added hydrogens, as done in :ref:`loading_protein`. After this, we will calculate a property and a shape to plot. .. code-block:: python :caption: Loading a Protein from PDB import ProteoTwirl.ProteinRotation as pt protein_structure = pt.ProteinRotation( protein = "8JXW_H.pdb", # Protein structure to load selection = "protein and segid E and not element H", # Select receptor only (in this case segment E) base_rotation = "principle", # Align to principal axes center_selection = True, # Set center of geometry to (0,0,0) (center of rotation) atom_radii = "vdw", # Definition of radii to use, here van der Waals # Default values avoid having to re-enter them for each added property default_rotation_res = 128, # Number of angles to sample default_rotation_range = None, # Can be set to min and max values for theta and phi angles default_selectors = None, # Allows us to select atoms based on orientation default_sampler = None, # How we sample angles, currently only Fibonacci sphere ) # Show interactive view of the protein loaded protein_structure .. raw:: html
Once the protein is loaded, we will calculate a property. In this case, we will calculate the average hydropathy index of the exposed residues of the protein. Hydropathy is a count property, and we can add it using the name ``"count.Hydropathy"``. We also need to set the aggregation method to ``"mean"``; otherwise, no aggregation is performed, and we need one value per angle to plot. .. code-block:: python :caption: Calculating Hydropathy of Exposed Residues from ProteoTwirl.Selectors.Selector import ExposedAtomSelector protein_structure.add_property( property = "count.Hydropathy", agg_method = "mean", use_default = False, rotation_res = 64, selectors = [ExposedAtomSelector()], workers = 1 ) >>> Adding mean_Hydropathy print(len(protein_structure.mean_Hydropathy)) >>> 64 Lastly, we will construct a shape of the protein. Here, we will use an alpha shape and apply a small amount of hole filling to clean up the shape. .. code-block:: python :caption: Calculating Alpha Shape of Protein protein_structure.add_property( property = "Alphashape", hole_fill = 0.2, use_default = False, rotation_res = 64, workers = 1 ) >>> Adding Alpha_Shape_45_HF20 print(len(protein_structure.Alpha_Shape_45_HF20)) >>> 64 protein_structure.Alpha_Shape_45_HF20[0] .. figure:: ../../_static/Guides/Visualization/8JWX_H_AlphaShape_HF20.svg :figclass: code-output :width: 25% :align: center