IMP logo
restrainer examples

nup84 complex in bead representation

This example shows basic modeling of Nup84 complex using bead representation. On the following figures, we see XML input files for the representation, restraint, optimization and display. See Nup84 coarse grained example in the kernel for a non-restrainer version of this example.

<!-- File: nup84_representation.xml -->
<Representation>
<Protein><Chain>
<Fragment id="Nup85">
<GeometricShapeRep total_residue="570">
<Sphere><InitialPosition x="300" y="300" z="300" optimize="1"/></Sphere>
</GeometricShapeRep>
</Fragment></Chain>
</Protein>
<Protein><Chain>
<Fragment id="Nup84">
<GeometricShapeRep total_residue="460">
<Sphere><InitialPosition x="200" y="0" z="200" optimize="1"/></Sphere>
</GeometricShapeRep>
</Fragment></Chain>
</Protein>
<Protein><Chain>
<Fragment id="Nup145C">
<GeometricShapeRep total_residue="442">
<Sphere><InitialPosition x="0" y="0" z="100" optimize="1"/></Sphere>
</GeometricShapeRep>
</Fragment></Chain>
</Protein>
<Protein><Chain>
<Fragment id="Nup120N">
<GeometricShapeRep total_residue="500">
<Sphere><InitialPosition x="0" y="100" z="200" optimize="1"/></Sphere>
</GeometricShapeRep>
</Fragment>
<Fragment id="Nup120C">
<GeometricShapeRep total_residue="260">
<Sphere><InitialPosition x="100" y="300" z="100" optimize="1"/></Sphere>
</GeometricShapeRep>
</Fragment></Chain>
</Protein>
<Protein><Chain>
<Fragment id="Nup133N">
<GeometricShapeRep total_residue="450">
<Sphere><InitialPosition x="100" y="0" z="300" optimize="1"/></Sphere>
</GeometricShapeRep>
</Fragment>
<Fragment id="Nup133C">
<GeometricShapeRep total_residue="288">
<Sphere><InitialPosition x="300" y="100" z="100" optimize="1"/></Sphere>
</GeometricShapeRep>
</Fragment></Chain>
</Protein>
<Protein><Chain>
<Fragment id="Seh1">
<GeometricShapeRep total_residue="351">
<Sphere><InitialPosition x="100" y="100" z="0" optimize="1"/></Sphere>
</GeometricShapeRep>
</Fragment></Chain>
</Protein>
<Protein><Chain>
<Fragment id="Sec13">
<GeometricShapeRep total_residue="379">
<Sphere><InitialPosition x="200" y="150" z="0" optimize="1"/></Sphere>
</GeometricShapeRep>
</Fragment></Chain>
</Protein>
</Representation>

The XML representation input file determines how the system is represented using a 'bead model'. Each protein is represented as a sphere, or a pair of spheres (in the case of the rodlike Nup133 and Nup120 proteins), with larger proteins using larger spheres.

<!-- File: nup84_restraint.xml -->
<RestraintSet name="restraint_set">
<ExcludedVolume>
<Restraint name="ev_restraint">
<Particle id="Nup84"/>
<Particle id="Nup85"/>
<Particle id="Nup145C"/>
<Particle id="Nup120N"/>
<Particle id="Nup120C"/>
<Particle id="Nup133N"/>
<Particle id="Nup133C"/>
<Particle id="Seh1"/>
<Particle id="Sec13"/>
</Restraint>
</ExcludedVolume>
<Y2H>
<Restraint name="y2h_restraint_1">
<Particle id="Nup145C"/>
<Particle id="Nup84"/>
<Particle id="Sec13"/>
</Restraint>
<Restraint name="y2h_restraint_2">
<Particle id="Nup145C"/>
<Particle id="Nup85"/>
</Restraint>
<Restraint name="y2h_restraint_3">
<Particle id="Nup145C"/>
<Particle id="Nup120C"/>
</Restraint>
<Restraint name="y2h_restraint_4">
<Particle id="Nup84"/>
<Particle id="Nup133C"/>
</Restraint>
<Restraint name="y2h_restraint_5">
<Particle id="Nup85"/>
<Particle id="Seh1"/>
</Restraint>
<Restraint name="y2h_restraint_6">
<Particle id="Nup145C"/>
<Particle id="Sec13"/>
</Restraint>
<Restraint name="y2h_restraint_7">
<Particle id="Nup120C"/>
<Particle id="Nup120N"/>
</Restraint>
<Restraint name="y2h_restraint_8">
<Particle id="Nup133C"/>
<Particle id="Nup133N"/>
</Restraint>
</Y2H>
</RestraintSet>

The XML restraint input file encodes the input structural data as spatial restraints on the system. Here, we use two simple sources of information. First, excluded volume for each protein. Second, yeast two-hybrid results for some pairs of proteins.

<!-- File: nup84_optimization.xml -->
<Optimization>
<ConjugateGradients id="opt1" steps="10">
<Restraint name="restraint_set"/>
</ConjugateGradients>
</Optimization>

The XML optimization input file sets up a simple conjugate gradients optimization.

<!-- File: nup84_display.xml -->
<Display>
<Protein>
<Chain><Fragment id="Nup85"><Color r="0.15" g="0.58" b="0.66"/></Fragment></Chain>
</Protein>
<Protein>
<Chain><Fragment id="Seh1"><Color r="0.38" g="0.04" b="0.37"/></Fragment></Chain>
</Protein>
<Protein>
<Chain><Fragment id="Nup84"><Color r="0.84" g="0.78" b="0.24"/></Fragment></Chain>
</Protein>
<Protein>
<Chain><Fragment id="Nup145C"><Color r="0.62" g="0.47" b="0.45"/></Fragment></Chain>
</Protein>
<Protein>
<Chain><Fragment id="Sec13"><Color r="0.00" g="0.71" b="0.01"/></Fragment></Chain>
</Protein>
<Protein>
<Chain><Fragment id="Nup120N"><Color r="0.11" g="0.31" b="0.86"/></Fragment></Chain>
<Chain><Fragment id="Nup120C"><Color r="0.11" g="0.31" b="0.86"/></Fragment></Chain>
</Protein>
<Protein>
<Chain><Fragment id="Nup133N"><Color r="0.89" g="0.27" b="0.40"/></Fragment></Chain>
<Chain><Fragment id="Nup133C"><Color r="0.89" g="0.27" b="0.40"/></Fragment></Chain>
</Protein>
</Display>

The XML display input file is for visualization only, and assigns each sphere a different color.

The following Python script loads in all four of the XML files and performs the optimization. Restrainer first generates a set of sphere-like particles to represent the system. It then converts the information in the restraints file into a set of IMP restraints. It generates an excluded volume restraint that prevents each protein sphere from penetrating any other sphere and a set of 'connectivity' restraints that force the protein particles to reproduce the interactions implied by the yeast two-hybrid experiments. The optimization generates a file optimized.py that is an input file for the molecular visualization program Chimera; when loaded into Chimera, it displays the final optimized configuration of the complex.

#-- File: nup84_complex_in_bead_representation.py --#
import IMP
IMP.set_log_level(IMP.VERBOSE)
# Create restrainer object
restrainer = IMP.restrainer.Main()
# Add representation, restraint, optimization and display to restrainer
rep = restrainer.add_representation(IMP.restrainer.get_example_path('input/nup84_representation.xml'))
rsr = restrainer.add_restraint(IMP.restrainer.get_example_path('input/nup84_restraint.xml'))
opt = restrainer.add_optimization(IMP.restrainer.get_example_path('input/nup84_optimization.xml'))
disp = restrainer.add_display(IMP.restrainer.get_example_path('input/nup84_display.xml'))
###=======================================================================###
# At this point all data from XML files have been placed into the model.
# Now it is possible to perform various operations on the IMP model.
###=======================================================================###
# Save the initial state in Chimera format
restrainer.log.write('initial.py')
# Perform optimization
restrainer.optimize()
# Save the optimized state in Chimera format
restrainer.log.write('optimized.py')

basic setup

This example shows how to construct a molecular hierarchy consisting of two proteins, and then apply connectivity restraint obtained from pulldown experimental data to these two proteins.

On the following figure, we see an XML representation of the molecular hierarchy.

<!-- File: eg1_representation.xml -->
<Representation>
<Protein id="Protein1">
<Chain filename="data/protein1.pdb" selector="CAlpha"/>
<Chain>
<Fragment>
<GeometricShapeRep total_residue="10">
<Sphere/>
</GeometricShapeRep>
</Fragment>
</Chain>
</Protein>
<Protein id="Protein2">
<Chain filename="data/protein2.pdb"/>
</Protein>
</Representation>

Each level of molecular hierarchy corresponds to an XML tag. Each tag can have optional attributes. In this example, each protein has a unique id. Protein1 has 2 chains. The first chain is constructed from the PDB file using IMP::atom::CAlphaSelector. The second chain is represented by a sphere fragment that is big enough to contain 10 residues. Protein2 is constructed using the default selector, IMP::atom::NonWaterNonHydrogenSelector.

The following figure shows the definition of the restraint.

<!-- File: eg1_restraint.xml -->
<RestraintSet>
<Pulldown>
<Restraint>
<Particle id="Protein1"/>
<Particle id="Protein2"/>
</Restraint>
</Pulldown>
</RestraintSet>

The pulldown restraint is applied to Protein1 and Protein2.

The following Python script demonstrates the process of loading our data into IMP model.

#-- File: basic_setup.py --#
import IMP
# Create restrainer object
restrainer = IMP.restrainer.Main()
# Add representation and restraint to restrainer
rep = restrainer.add_representation(IMP.restrainer.get_example_path('input/eg1_representation.xml'))
rsr = restrainer.add_restraint(IMP.restrainer.get_example_path('input/eg1_restraint.xml'))
###=======================================================================###
# At this point all data from XML files have been placed into the model.
# Now it is possible to perform various operations on the IMP model.
###=======================================================================###
# Get the IMP model object used by restrainer
model = restrainer.get_model()
model.show()
model.evaluate(False)

rigid body and excluded volume restraint

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 -->
<RestraintSet>
<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>
<Restraint>
<Particle id="Protein1"/>
<Particle id="Protein2"/>
<Particle id="Protein3"/>
<Particle id="Protein4"/>
<Particle id="Protein5"/>
</Restraint>
</ExcludedVolume>
<Y2H>
<Restraint>
<Particle id="Protein1"/>
<Particle id="Protein2"/>
<Particle id="Protein3"/>
</Restraint>
<Restraint>
<Particle id="Protein4"/>
<Particle id="Protein5"/>
</Restraint>
</Y2H>
</RestraintSet>
#-- File: rigid_body_and_excluded_volume_restraint.py --#
import IMP
# Create restrainer object
restrainer = IMP.restrainer.Main()
# Add representation and restraint to restrainer
rep = restrainer.add_representation(IMP.restrainer.get_example_path('input/eg2_representation.xml'))
rsr = restrainer.add_restraint(IMP.restrainer.get_example_path('input/eg2_restraint.xml'))
###=======================================================================###
# At this point all data from XML files have been placed into the model.
# Now it is possible to perform various operations on the IMP model.
###=======================================================================###
# Get the IMP model object used by restrainer
model = restrainer.get_model()
# Find the IMP data structure with the given id
protein1_hierarchy = rep.get_imp_hierarchy_by_id('Protein1')
# Get root hierarchy
root_hierarchy = rep.get_root_imp_hierarchy()
# Get the rigid body with the given id
protein1_rb = rsr.get_rigid_body_by_id ("Protein1")
# Get all rigid bodies
rbs = rsr.get_all_rigid_bodies()
# Define transformation
ub = IMP.algebra.Vector3D(-50.0,-50.0,-50.0)
lb = IMP.algebra.Vector3D( 50.0, 50.0, 50.0)
bb = IMP.algebra.BoundingBox3D(ub, lb)
transformation = IMP.algebra.Transformation3D(rotation, translation)
# Perform geometric transformations on the Protein1 rigid body
protein1_rb.set_reference_frame(IMP.algebra.ReferenceFrame3D(transformation))
protein1_rb.show()

em restraint

This example shows how to use IMP::em::FitRestraint.

<!-- File: em_representation.xml -->
<Representation>
<Protein id="Protein1">
<Chain>
<Fragment id="frag1">
<GeometricShapeRep>
<Sphere radius="1.0" weight="1.0">
<InitialPosition optimize="1" x="12.0" y="12.0" z="12.0"/>
</Sphere>
</GeometricShapeRep>
</Fragment>
<Fragment id="frag2">
<GeometricShapeRep>
<Sphere radius="1.0" weight="1.0">
<InitialPosition optimize="1" x="15.0" y="6.0" z="6.0"/>
</Sphere>
</GeometricShapeRep>
</Fragment>
<Fragment id="frag3">
<GeometricShapeRep>
<Sphere radius="1.0" weight="1.0">
<InitialPosition optimize="1" x="6.0" y="15.0" z="15.0"/>
</Sphere>
</GeometricShapeRep>
</Fragment>
</Chain>
</Protein>
</Representation>
<!-- File: em_restraint.xml -->
<RestraintSet>
<EM>
<Restraint name="em_restraint" density_filename="data/in.mrc" spacing="1.0" resolution="3.0" xorigin="-6.0" yorigin="-6.0" zorigin="-6.0">
<Particle id="frag1"/>
<Particle id="frag2"/>
<Particle id="frag3"/>
</Restraint>
</EM>
</RestraintSet>
#-- File: em_restraint.py --#
import IMP
# Create restrainer object
restrainer = IMP.restrainer.Main()
# Add representation and restraint to restrainer
rep = restrainer.add_representation(IMP.restrainer.get_example_path('input/em_representation.xml'))
rsr = restrainer.add_restraint(IMP.restrainer.get_example_path('input/em_restraint.xml'))
###=======================================================================###
# At this point all data from XML files have been placed into the model.
# Now it is possible to perform various operations on the IMP model.
###=======================================================================###
# Get the IMP model object used by restrainer
model = restrainer.get_model()
# Get restraint by name
r = rsr.get_restraint_by_name('em_restraint')
# Get EM density map header from the restraint
dmap_header = r.dmap_header
# Get IMP::em::FitRestraint
fit_restraint = r.imp_restraint
fit_restraint.evaluate(False)

saxs restraint

This example shows how to use IMP::saxs::Restraint.

<!-- File: saxs_representation.xml -->
<Representation>
<Protein id="6lyz">
<Chain filename="data/6lyz.pdb" selector="NonWaterNonHydrogen"/>
</Protein>
</Representation>
<!-- File: saxs_restraint.xml -->
<RestraintSet>
<SAXS name="saxs_restraint_set">
<Restraint name="saxs_restraint" profile_filename="data/lyzexp.dat">
<Particle id="6lyz"></Particle>
</Restraint>
</SAXS>
</RestraintSet>
#-- File: saxs_restraint.py --#
import IMP
# Create restrainer object
restrainer = IMP.restrainer.Main()
# Add representation and restraint to restrainer
rep = restrainer.add_representation(IMP.restrainer.get_example_path('input/saxs_representation.xml'))
rsr = restrainer.add_restraint(IMP.restrainer.get_example_path('input/saxs_restraint.xml'))
###=======================================================================###
# At this point all data from XML files have been placed into the model.
# Now it is possible to perform various operations on the IMP model.
###=======================================================================###
# Get the IMP model object used by restrainer
model = restrainer.get_model()
# Get restraint by name
r = rsr.get_restraint_by_name('saxs_restraint')
# Get IMP::RestraintSet by name
rs = rsr.get_restraint_set_by_name('saxs_restraint_set')
# Get IMP::saxs::Restraint
saxs_restraint = r.imp_restraint
saxs_restraint.evaluate(False)

basic display

In case we would like to create Chimera logs storing optimization states, we can provide geometric definitions in a display XML file. These XML definitions form a basic interface to IMP::display module. Currently, the only geometric aspect that can be specified is color.

This example shows how to color the representation components and output display file in chimera format.

<!-- File: display_representation.xml -->
<Representation>
<Protein id="Protein1">
<Chain id="Chain1" filename="data/6lyz.pdb">
<Fragment id="Frag1"><AtomicRep start_residue="1" end_residue="10"/></Fragment>
<Fragment id="Frag2"><AtomicRep start_residue="11" end_residue="20"/></Fragment>
<Fragment id="Frag3"><AtomicRep start_residue="21" end_residue="30"/></Fragment>
<Fragment id="Frag4"><AtomicRep start_residue="31" end_residue="40"/></Fragment>
</Chain>
</Protein>
</Representation>
<!-- File: pdb_display.xml -->
<Display>
<Protein id="Protein1">
<Chain id="Chain1"><Color r="1" g="1" b="1"/>
<Fragment id="Frag1"><Color r="0" g="1" b="1"/></Fragment>
<Fragment id="Frag2"><Color r="1" g="0" b="1"/></Fragment>
<Fragment id="Frag3"><Color r="1" g="1" b="0"/></Fragment>
<Fragment id="Frag4"><Color r="1" g="0" b="0"/></Fragment>
</Chain>
</Protein>
</Display>

Loading a display XML file is similar to loading the representation and restraint XML definitions. Only particles mentioned in the display XML file will be present (this is useful if we only want to display some portion of an hierarchy). The arguments to the create_log are the representation and the file name template (this '%%03d' will be replaced by consecutive numbers if we do optimization). This log is intended to be added to an optimization by performing: optimization.add_optimizer_state(log)

#-- File: basic_display.py --#
import IMP
# Create restrainer object
restrainer = IMP.restrainer.Main()
# Add representation and color definition to restrainer
rep = restrainer.add_representation(IMP.restrainer.get_example_path('input/display_representation.xml'))
disp = restrainer.add_display(IMP.restrainer.get_example_path('input/pdb_display.xml'))
###=======================================================================###
# At this point all data from XML files have been placed into the model.
# Now it is possible to perform various operations on the IMP model.
###=======================================================================###
# Write initial display in Chimera format
restrainer.log.write('initial_display_in_chimera.py')
# Get the IMP model object used by restrainer
model = restrainer.get_model()
model.show()
model.evaluate(False)


Generated on Tue May 22 2012 23:33:21 for IMP by doxygen 1.8.1