[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IMP-users] IMP.restrainer examples



Hi there.
I was checking the IMP.restrained examples and I have a couple of questions about it.

The rigid_body_and_excluded_volume_restrain.py example shows how to get proteins from multiple PDBs and enforce upon them connectivity restraints, but doesn't give any graphical representation of the whole assembly (before/after).

The basic_display.py example does show how to create Chimera logs to store optimization states, but the rigid_body_and_excluded_volume_restrain.py example doesn't do any optimization. So, how do I simply see the assembly produced in rigid_body_and_excluded_volume_restrain.py before and after the restraints have been applied (the five proteins connected without crashing into each other).



I've actually tried to play with it myself, but the results are far from what I've desired.

The representation and restraints XML files are exaclty those coming with the IMP examples: five proteins loaded from PDB files, not allowed to crash into each other and connected (1,2,3;4,5).
I've created a display file so that each particle has its own color.

<!-- File: eg2_display.xml -->

<Display>
    <Protein id="Protein1"><Color r="0.15" g="0.58" b="0.66"/></Protein>
    <Protein id="Protein2"><Color r="0.38" g="0.04" b="0.37"/></Protein>
    <Protein id="Protein3"><Color r="0.84" g="0.78" b="0.24"/></Protein>
    <Protein id="Protein4"><Color r="0.62" g="0.47" b="0.45"/></Protein>
    <Protein id="Protein5"><Color r="0.00" g="0.71" b="0.01"/></Protein>
</Display>


I've also modified the file rigid_body_and_excluded_volume_restraint.py so that first the display information is loaded then, once restraints are enforced, the model is optimized (I've removed the lines showing how to manipulate/rotate a rigid body).

#-- File: rigid_body_and_excluded_volume_restraint.py --#

import IMP
import IMP.restrainer
import IMP.display

# Load representation
rep_parser = IMP.restrainer.XMLRepresentation('input/eg2_representation.xml')
representation = rep_parser.run()

# Load restraints
restraint_parser = IMP.restrainer.XMLRestraint('input/eg2_restraint.xml')
restraint = restraint_parser.run()

# Load display
display_parser = IMP.restrainer.XMLDisplay('input/eg2_display.xml')
display = display_parser.run()

model = representation.to_model()

# Write initial display in Chimera format
log = display.create_log(representation, 'pdb_log_%03d.py')
log.write('rigid_display_initial.py')

# Place restraint into IMP model
restraint.add_to_representation(representation)

###=======================================================================###
#  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.
###=======================================================================###

# Optimize
opt = IMP.core.ConjugateGradients()
opt.set_model(model)
opt.add_optimizer_state(log)
opt.optimize(10)

# Write final display in Chimera format
log.write('rigid_display_optimized.py')


First, I've noticed that in the initial representation, I can only see one of the molecules. I assume this is because they don't have an initial position (unlike when I use spheres), so they can be anywhere.

Using the ConjugateGradients optimization makes it crash:
_IMP.UsageException: Attempting to construct a rotation from a  non-quaternion value. The coefficient vector must have a length of 1. Got: 0.377264 0.0876134 0.185363 1.48248 gives 2.38212.

Using MonteCarlo or SteepestDescent optimizations (opt = IMP.core.MonteCarlo()) doesn't seem to change the model score.

In the end, I end up with an optimized display which looks exactly the same as the initial one, that is to say, I can only see one (the first of the five) proteins. I guess this is caused by the fact that optimizing doesn't change the score of the final model. Nevertheless, I was simply trying to diplay the five proteins before and after the connectivity and excluded volume restraints were applied...

Hope you can help. Thanks