IMP  2.1.0
The Integrative Modeling Platform
restrainer/rigid_body_and_excluded_volume_restraint.py

This example shows how to use IMP::core::RigidBody and IMP::core::ExcludedVolumeRestraint. We will construct a molecular hierarchy consisting of five proteins, and then apply connectivity restraint obtained from yeast two-hybrid experimental data to these proteins. We will define these proteins as rigid bodies and apply excluded volume restraint to prevent these proteins from interpenetrating. On the following figure, we see an XML representation of the molecular hierarchy.

<!-- File: eg2_representation.xml -->
<Representation>
<Protein id="Protein1"><Chain filename="data/protein1.pdb"/></Protein>
<Protein id="Protein2"><Chain filename="data/protein2.pdb"/></Protein>
<Protein id="Protein3"><Chain filename="data/protein3.pdb"/></Protein>
<Protein id="Protein4"><Chain filename="data/protein4.pdb"/></Protein>
<Protein id="Protein5"><Chain filename="data/protein5.pdb"/></Protein>
</Representation>

From restrainer's point of view, a Rigid Body is a special form of restraint. Therefore, to make some parts of the hierarchy rigid, suitable rigid body declarations should be placed in the restraint XML file.

<!-- File: eg2_restraint.xml -->
<RigidBody>
<Restraint><Particle id="Protein1"/></Restraint>
<Restraint><Particle id="Protein2"/></Restraint>
<Restraint><Particle id="Protein3"/></Restraint>
<Restraint><Particle id="Protein4"/></Restraint>
<Restraint><Particle id="Protein5"/></Restraint>
</RigidBody>
<ExcludedVolume>
<Particle id="Protein1"/>
<Particle id="Protein2"/>
<Particle id="Protein3"/>
<Particle id="Protein4"/>
<Particle id="Protein5"/>
</ExcludedVolume>
<Y2H>
<Particle id="Protein1"/>
<Particle id="Protein2"/>
<Particle id="Protein3"/>
<Particle id="Protein4"/>
<Particle id="Protein5"/>
</Y2H>
1 ## \example restrainer/rigid_body_and_excluded_volume_restraint.py
2 # This example shows how to use IMP::core::RigidBody and IMP::core::ExcludedVolumeRestraint. We will construct a molecular hierarchy consisting of five proteins, and then apply connectivity restraint obtained from yeast two-hybrid experimental data to these proteins. We will define these proteins as rigid bodies and apply excluded volume restraint to prevent these proteins from interpenetrating.
3 # On the following figure, we see an XML representation of the molecular hierarchy.
4 #
5 # \include eg2_representation.xml
6 #
7 # From restrainer's point of view, a Rigid Body is a special form of restraint. Therefore, to make some parts of the hierarchy rigid, suitable rigid body declarations should be placed in the restraint XML file.
8 #
9 # \include eg2_restraint.xml
10 #
11 #
12 
13 # -- File: rigid_body_and_excluded_volume_restraint.py --#
14 
15 import IMP
16 import IMP.restrainer
17 
18 # Create restrainer object
19 restrainer = IMP.restrainer.Main()
20 
21 # Add representation and restraint to restrainer
22 rep = restrainer.add_representation(
23  IMP.restrainer.get_example_path('input/eg2_representation.xml'))
24 rsr = restrainer.add_restraint(
25  IMP.restrainer.get_example_path('input/eg2_restraint.xml'))
26 
27 # =======================================================================###
28 # At this point all data from XML files have been placed into the model.
29 # Now it is possible to perform various operations on the IMP model.
30 # =======================================================================###
31 
32 # Get the IMP model object used by restrainer
33 model = restrainer.get_model()
34 
35 # Find the IMP data structure with the given id
36 protein1_hierarchy = rep.get_imp_hierarchy_by_id('Protein1')
37 
38 # Get root hierarchy
39 root_hierarchy = rep.get_root_imp_hierarchy()
40 
41 # Get the rigid body with the given id
42 protein1_rb = rsr.get_rigid_body_by_id("Protein1")
43 
44 # Get all rigid bodies
45 rbs = rsr.get_all_rigid_bodies()
46 
47 # Define transformation
48 ub = IMP.algebra.Vector3D(-50.0, -50.0, -50.0)
49 lb = IMP.algebra.Vector3D(50.0, 50.0, 50.0)
50 bb = IMP.algebra.BoundingBox3D(ub, lb)
51 translation = IMP.algebra.get_random_vector_in(bb)
53 transformation = IMP.algebra.Transformation3D(rotation, translation)
54 
55 # Perform geometric transformations on the Protein1 rigid body
56 protein1_rb.set_reference_frame(IMP.algebra.ReferenceFrame3D(transformation))
57 protein1_rb.show()