#!/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).* # # < [Score Function Basics](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/03.01-Score-Function-Basics.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Energies and the PyMOL Mover](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/03.03-Energies-and-the-PyMOLMover.ipynb) >
# # Practice: Analyzing energy between residues
# Keywords: pose_from_rcsb(), pdb2pose(), EMapVector()
# In[ ]:
get_ipython().system('pip install pyrosettacolabsetup')
import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()
import pyrosetta; pyrosetta.init()
from pyrosetta import *
from pyrosetta.teaching import *
init()
# In[ ]:
# From previous section:
sfxn = get_score_function(True)
# Analyze the energy between residues Y102 and Q408 in cetuximab (PDB code 1YY9, use the `pyrosetta.toolbox.pose_from_rcsb` function to download it and load it into a new `Pose` object) by following the steps below.
#
# A. Internally, a Pose object has a list of residues, numbered starting from 1. To find the residue numbers of Y102 of chain D and Q408 of chain A, use the residue chain identifier and the PDB residue number to convert to the pose numbering using the `pose2pdb()` method:
#
# ```
# pose = pyrosetta.toolbox.pose_from_rcsb("1YY9")
# res102 = pose.pdb_info().pdb2pose("D", 102)
# res408 = pose.pdb_info().pdb2pose("A", 408)
# ```
# In[ ]:
# get the pose numbers for Y102 (chain D) and Q408 (chain A)
# In[ ]:
### BEGIN SOLUTION
pose = pyrosetta.toolbox.pose_from_rcsb("1YY9")
res102 = pose.pdb_info().pdb2pose("D", 102)
res408 = pose.pdb_info().pdb2pose("A", 408)
### END SOLUTION
# B. Score the pose and determine the van der Waals energies and solvation energy between these two residues. Use the following commands to isolate contributions from particular pairs of residues, where `rsd102` and `rsd408` are the two residue objects of interest from above (not the residue number -- use `pose.residue(res_num)` to access the objects):
#
# ```
# emap = EMapVector()
# sfxn.eval_ci_2b(pose.residue(res102), pose.residue(res408), pose, emap)
# print(emap[fa_atr])
# print(emap[fa_rep])
# print(emap[fa_sol])
# ```
# In[ ]:
### BEGIN SOLUTION
emap = EMapVector()
sfxn.eval_ci_2b(pose.residue(res102), pose.residue(res408), pose, emap)
print(emap[fa_atr])
print(emap[fa_rep])
print(emap[fa_sol])
### END SOLUTION
# In[ ]:
#
# < [Score Function Basics](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/03.01-Score-Function-Basics.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Energies and the PyMOL Mover](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/03.03-Energies-and-the-PyMOLMover.ipynb) >