Loading Protein#
This guide gives a more detailed look at how to load proteins into ProteoTwirl.
Adding Hydrogens#
Many X-ray/cryo-EM structures lack hydrogen atoms. This can be an issue for some properties; for example, surface area can be underestimated if hydrogen atoms are missing. Several tools are available for adding hydrogen atoms to structures. For ProteoTwirl, I recommend PDBFixer, which can add hydrogens as shown below:
from pdbfixer import PDBFixer
from openmm.app import PDBFile
fixer = PDBFixer(filename="YOUR_FILE.pdb")
fixer.addMissingHydrogens(pH=7.0)
with open("YOUR_FILE_H.pdb", "w") as output:
PDBFile.writeFile(
fixer.topology,
fixer.positions,
output,
)
An alternative option is to use PDB2PQR, as shown below. Note, however, that chain/segment IDs are not preserved in PDB2PQR output.
pdb2pqr --ff=AMBER --with-ph=7.0 YOUR_FILE.pdb YOUR_FILE_H.pdb
Loading a Protein#
A protein can be loaded into ProteoTwirl by creating a
ProteinRotation object and providing the path to a protein file, as
shown below. The available options are described individually in the
sections that follow.
The example below uses the Histamine H4 receptor, as described in the basic tutorial.
protein_structure = pt.ProteinRotation(
protein = "8JXW_H.pdb", # Protein structure to load
selection = "protein and segid E", # Select receptor only; here, segment E
base_rotation = "principle", # Align to the principal axes
center_selection = True, # Center the selection at (0, 0, 0)
center = None, # Rotation origin; if None, use (0, 0, 0)
atom_radii = "vdw", # Definition of atomic radii to use
# Default values avoid having to re-enter these for each added property
default_rotation_res = 32, # Number of orientations to sample
default_rotation_range = None, # Optional min/max values for theta and phi
default_selectors = None, # Optional orientation-dependent atom selectors
default_sampler = None, # Sampling method; currently Fibonacci sphere only
)
Protein Input#
protein = "8JXW_H.pdb",
The protein input can be provided in one of two ways: either as the path
to a PDB file or as an MDAnalysis Universe object.
Selection#
selection = "protein and segid E",
The selection option allows only part of the protein structure to be
loaded. The selection string follows the
MDAnalysis selection syntax.
The selection is applied before any other operation, including centering and applying a base rotation. Note that the selection cannot be changed after the protein has been loaded.
Base Rotation#
base_rotation = "principle",
By default, ProteoTwirl loads the protein in the orientation given in
the input file. However, an initial rotation can be applied before any
property is calculated. This changes which orientation is treated as the
0, 0 rotation.
A base rotation can be specified by providing rotation angles, either as
a set of two or three angles, or by providing a rotation matrix.
Alternatively, base_rotation can be set to "principle", which
will align the selected atoms to their principal axes.
Center#
center = None,
By default, the protein is rotated around (0, 0, 0). If another
point should be used as the rotation origin, center can be set to
that position instead. This can be useful, for example, when analyzing a
binding pocket, as shown in the Selectors tutorial.
center_selection = True,
If center_selection is True, the selected atoms are translated so
that their center of geometry is placed at (0, 0, 0). If
center_selection is False, the atoms remain at the coordinates
given in the input file.
Note that if the structure is not centered, the default center of
rotation is still (0, 0, 0). Unless you have a specific reason to
preserve the original coordinates, it is recommended to leave
center_selection set to True.
Atomic Radii#
atom_radii = "vdw",
A protein structure contains the center position of each atom, but each
atom also has a radius. The atom_radii option defines which radii
ProteoTwirl should use. For most purposes, the default van der Waals
radii are likely to be appropriate.
Several options are available. Two presets define one radius per element:
"vdw": use the van der Waals radius of each atom’s element."cov": use the covalent radius of each atom’s element.
Alternatively, you can provide either a list with one radius per atom in
the selection, or a function that takes an MDAnalysis AtomGroup as
input and returns one radius for each atom in that group.
Default Values#
default_rotation_res = 32,
default_rotation_range = None,
default_selectors = None,
default_sampler = None,
Each calculated property needs to know how protein orientations should
be sampled. This includes the number of sampled orientations
rotation_res, whether the sampled angular range should be limited,
which selectors should be used, and which sampler should be used.
When creating a ProteinRotation object, default values can be set for
these options. This can streamline later property calculations because
the same values do not need to be re-entered for each property unless
different values are required.
When calculating a property, these values are used if
use_default=True. For details on these variables, see the
properties tutorial.