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

Re: [IMP-users] how to integrate RMF with IMP.restrainer?



BTW, I added a bug for this to the bug tracker: <https://github.com/salilab/imp/issues/414>

On Jun 25, 2013, at 9:15 AM, Jan Kosinski <">> wrote:

Dear all,

What are the methods to log the simulation frames to RMF format instead of old Chimera style?

I have managed to integrate RMF with IMP.restrainer but not everything works. It seems to work with restraints like ExcludedVolume, Distance or EM but not Y2H or PullDown - virtually all that internally are translated to connectivity restraint make a script crashing. For example if I modify the restrainer/nup84_complex_in_bead_representation.py to:
import IMP
import IMP.restrainer

IMP.base.set_log_level(IMP.base.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'))

#BEGIN ADDED PART
import IMP.rmf
import RMF

rmf= RMF.create_rmf_file('nup84_simulation.rmf')
rmf.set_description("Simulate nup84.\n")

model = restrainer.get_model()
root_hierarchy = rep.get_root_imp_hierarchy()

IMP.rmf.add_hierarchy(rmf, root_hierarchy)
IMP.rmf.add_restraints(rmf, model.get_restraints())
IMP.rmf.save_frame(rmf, 0)

os= IMP.rmf.SaveOptimizerState(rmf)
os.update_always("initial conformation")
restrainer.log = os
#END ADDED PART

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'), 'some_log_name')

###=======================================================================###
#  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')


(note added lines and old-style Chimera stuff commented out)

I get the following error:
Traceback (most recent call last):
  File "nup84_complex_in_bead_representation.py", line 50, in <module>
    IMP.rmf.save_frame(rmf, 0)
  File "/home/user/software/imp_dev/lib/IMP/rmf/__init__.py", line 875, in save_frame
    return _IMP_rmf.save_frame(*args)
_IMP_base.IOException: UsageError: "Cannot write sentry value to an RMF file." processing decorator of type Score

WARNING  No frames were saved to file "RestraintSaveLink0" even though objects were added.


If however I change <Y2H> node to <Distance> in input/nup84_restraint.xml everything runs correctly and I can enjoy a working RMF file.

Would you have any suggestions how to make RMF logging working properly?

BTW. I am using the current dev version of IMP and RMF.

Thank you in advance for help,
Jan

_______________________________________________
IMP-users mailing list
">
https://salilab.org/mailman/listinfo/imp-users