Keywords: total_residue(), chain(), number(), pdb2pose(), pose2pdb()
!pip install pyrosettacolabsetup
import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()
import pyrosetta; pyrosetta.init()
from pyrosetta import *
init()
From previous section: Make sure you are in the directory with the pdb files:
cd google_drive/MyDrive/student-notebooks/
pose = pose_from_pdb("inputs/5tj3.pdb")
pose_clean = pose_from_pdb("inputs/5tj3.clean.pdb")
We can use methods in Pose
to count residues and pick out residues from the pose. Remember that Pose
is a python class, and to access methods it implements, you need an instance of the class (here pose
or pose_clean
) and you then use a dot after the instance.
print(pose.total_residue())
print(pose_clean.total_residue())
# Did you catch all the missing residues before?
Store the Residue
information for residue 20 of the pose by using the pose.residue(20)
function.
# residue20 = type here
YOUR-CODE-HERE
print(residue20.name())
Use the pose
's .residue()
object to get the 24th residue of the protein pose. What is the 24th residue in the PDB file (look in the PDB file)? Are they the same residue?
# store the 24th residue in the pose into a variable (see residue20 example above)
YOUR-CODE-HERE
# what other methods are attached to that Residue object? (type "residue24." and hit Tab to see a list of commands)
We can immediately see that the numbering PyRosetta internally uses for pose residues is different from the PDB file. The information corresponding to the PDB file can be accessed through the pose.pdb_info()
object.
print(pose.pdb_info().chain(24))
print(pose.pdb_info().number(24))
By using the pdb2pose
method in pdb_info()
, we can turn PDB numbering (which requires a chain ID and a residue number) into Pose numbering
# PDB numbering to Pose numbering
print(pose.pdb_info().pdb2pose('A', 24))
Use the pose2pdb
method in pdb_info()
to see what is the corresponding PDB chain and residue ID for pose residue number 24
# Pose numbering to PDB numbering
YOUR-CODE-HERE
Now we can see how to examine the identity of a residue by PDB chain and residue number.
Once we get a residue, there are various methods in the Residue
class that might be for running analysis. We can get instances of the Residue
class from Pose
. For instance, we can do the following:
res_24 = pose.residue(24)
print(res_24.name())
print(res_24.is_charged())