Before you turn this problem in, make sure everything runs as expected. First, restart the kernel (in the menubar, select Kernel$\rightarrow$Restart) and then run all cells (in the menubar, select Cell$\rightarrow$Run All).
Make sure you fill in any place that says YOUR CODE HERE
or "YOUR ANSWER HERE", as well as your name and collaborators below:
NAME = ""
COLLABORATORS = ""
Keywords: total_residue(), chain(), number(), pdb2pose(), pose2pdb()
# 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
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
raise NotImplementedError()
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
raise NotImplementedError()
# 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
raise NotImplementedError()
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())