IMP  2.1.1
The Integrative Modeling Platform
em_restraint.py
1 ## \example restrainer/em_restraint.py
2 # This example shows how to use IMP::em::FitRestraint.
3 #
4 # \include em_representation.xml
5 # \include em_restraint.xml
6 #
7 
8 # -- File: em_restraint.py --#
9 
10 import IMP
11 import IMP.restrainer
12 
13 # Create restrainer object
14 restrainer = IMP.restrainer.Main()
15 
16 # Add representation and restraint to restrainer
17 rep = restrainer.add_representation(
18  IMP.restrainer.get_example_path('input/em_representation.xml'))
19 rsr = restrainer.add_restraint(
20  IMP.restrainer.get_example_path('input/em_restraint.xml'))
21 
22 # =======================================================================###
23 # At this point all data from XML files have been placed into the model.
24 # Now it is possible to perform various operations on the IMP model.
25 # =======================================================================###
26 
27 # Get the IMP model object used by restrainer
28 model = restrainer.get_model()
29 
30 # Get restraint by name
31 r = rsr.get_restraint_by_name('em_restraint')
32 
33 # Get EM density map header from the restraint
34 dmap_header = r.dmap_header
35 
36 # Get IMP::em::FitRestraint
37 fit_restraint = r.imp_restraint
38 fit_restraint.evaluate(False)
See IMP.restrainer for more information.
std::string get_example_path(std::string file_name)
Return the path to installed example data for this module.