#!/usr/bin/env python # coding: utf-8 # # *This notebook contains material from [PyRosetta](https://RosettaCommons.github.io/PyRosetta.notebooks); # content is available [on Github](https://github.com/RosettaCommons/PyRosetta.notebooks.git).* # # < [Pose Basics](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.01-Pose-Basics.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Accessing PyRosetta Documentation](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.03-Accessing-PyRosetta-Documentation.ipynb) >

Open in Colab # # Working with Pose residues # Keywords: total_residue(), chain(), number(), pdb2pose(), pose2pdb() # In[ ]: get_ipython().system('pip install pyrosettacolabsetup') import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta() import pyrosetta; pyrosetta.init() # In[ ]: from pyrosetta import * init() # **From previous section:** # Make sure you are in the directory with the pdb files: # # `cd google_drive/MyDrive/student-notebooks/` # In[ ]: 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. # In[9]: 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. # In[10]: # residue20 = type here ### BEGIN SOLUTION residue20 = pose.residue(20) ### END SOLUTION print(residue20.name()) # ## Exercise 2: Residue objects # # 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? # In[11]: # store the 24th residue in the pose into a variable (see residue20 example above) ### BEGIN SOLUTION residue24 = pose.residue(24) ### END SOLUTION # In[12]: # 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. # In[13]: 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 # In[14]: # 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 # In[15]: # Pose numbering to PDB numbering # In[16]: ### 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: # In[17]: res_24 = pose.residue(24) print(res_24.name()) print(res_24.is_charged()) # In[ ]: # # < [Pose Basics](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.01-Pose-Basics.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Accessing PyRosetta Documentation](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/02.03-Accessing-PyRosetta-Documentation.ipynb) >

Open in Colab