IMP  2.0.1
The Integrative Modeling Platform
modeller/modeller_restraints_in_imp.py

This demonstrates using Modeller restraints as additional terms in the IMP scoring function, so that existing Modeller restraints can be used in combination with new IMP restraints and optimization protocols.

1 ## \example modeller/modeller_restraints_in_imp.py
2 ## This demonstrates using Modeller restraints as additional terms in the IMP
3 ## scoring function, so that existing Modeller restraints can be used in
4 ## combination with new IMP restraints and optimization protocols.
5 ##
6 
7 import modeller
8 import IMP
9 import IMP.modeller
10 
11 # Set up Modeller and build a model from the GGCC primary sequence
12 e = modeller.environ()
13 e.edat.dynamic_sphere = False
14 e.libs.topology.read('${LIB}/top_heav.lib')
15 e.libs.parameters.read('${LIB}/par.lib')
16 modmodel = modeller.model(e)
17 modmodel.build_sequence('GGCC')
18 
19 # Add a simple Modeller distance restraint between the first and last atoms
20 feat = modeller.features.distance(modmodel.atoms[0], modmodel.atoms[-1])
21 r = modeller.forms.gaussian(feature=feat, mean=10.0, stdev=1.0,
22  group=modeller.physical.xy_distance)
23 modmodel.restraints.add(r)
24 
25 # Set up IMP and load the Modeller model in as a new Hierarchy
26 m = IMP.Model()
27 protein = IMP.modeller.ModelLoader(modmodel).load_atoms(m)
28 atoms = IMP.atom.get_by_type(protein, IMP.atom.ATOM_TYPE)
29 
30 # Use the ModellerRestraints class to add all of the Modeller restraints to
31 # the IMP scoring function
32 m.add_restraint(IMP.modeller.ModellerRestraints(m, modmodel,
33  atoms))
34 
35 # Calculate the IMP score
36 print m.evaluate(False)