# Notebook setup import sys if 'google.colab' in sys.modules: !pip install pyrosettacolabsetup import pyrosettacolabsetup pyrosettacolabsetup.mount_pyrosetta_install() print ("Notebook is set for PyRosetta use in Colab. Have fun!")
from pyrosetta import * init()
From previous section: Make sure you are in the directory with the pdb files:
cd google_drive/My\ Drive/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_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?
Residue information for residue 20 of the pose by using the
# residue20 = type here ### BEGIN SOLUTION residue20 = pose.residue(20) ### END SOLUTION print(residue20.name())
.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) ### BEGIN SOLUTION residue24 = pose.residue(24) ### END SOLUTION
# 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
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))
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
### BEGIN SOLUTION print(pose.pdb_info().pose2pdb(1)) ### END SOLUTION
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())