In [1]:
import urllib2
import tempfile

In [2]:
import rosetta; rosetta.init()
from interface_fragment_matching import pdb_parsing

In [3]:
import ipython_glmol
from ipython_glmol.display_hooks import pose_display

Read pdb from rcsb and generate a rosetta pose.


In [4]:
with tempfile.NamedTemporaryFile() as tf:
    source_atoms = pdb_parsing.parse_pdb(urllib2.urlopen("http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId=1QYS").read())
    tf.write(pdb_parsing.to_pdb(source_atoms))
    
    source_structure = rosetta.pose_from_pdb(tf.name)
    source_structure.pdb_info().name("1QYS")

# Reset pdbinfo to align residue numbering
source_structure.pdb_info( rosetta.core.pose.PDBInfo(source_structure) )


Out[4]:
<rosetta.core.pose.__pose_all_at_once_.PDBInfo at 0x53ddec0>

Display pose with sensible default representation.


In [5]:
from ipython_glmol.glmol_repr import Sphere, Line, Ribbon, Stick, ResidueSpectrum
from ipython_glmol.glmol_selectors import ResidueNumber, All, Heavyatom, Carbon

In [6]:
basic_repr = Line(Heavyatom()) + Stick( ResidueNumber[0:10] + Heavyatom())

In [7]:
pose_display(source_structure) + basic_repr


Out[7]:

In [11]:
pose_display(source_structure) + ResidueSpectrum("residue_number", "gist_rainbow", sub_selector=Carbon()) + Ribbon() + Stick(Heavyatom())


Out[11]:

Define representation based on pose data.


In [9]:
import interface_fragment_matching.utility.energies

scorefn = rosetta.getScoreFunction()
relax = rosetta.protocols.relax.FastRelax( scorefn, 1 )
relax.apply( source_structure )
scorefn( source_structure )


Out[9]:
-169.3224091619103

In [10]:
pose_display( source_structure ) + ResidueSpectrum("total_score", "RdBu_r", sub_selector=Carbon(), thresholds=(-2, 0)) + Line(All() + Heavyatom())


Out[10]: