IMP  2.3.0
The Integrative Modeling Platform
fit_restraint.py
1 ## \example em/fit_restraint.py
2 # A simple example showing how to set up a fit restraint. The number of
3 # spheres and resolution are randomly chosen and so should not be
4 # considered significant.
5 
6 import IMP.em
7 import IMP.core
8 import IMP.atom
9 IMP.base.set_log_level(IMP.base.SILENT)
10 m = IMP.kernel.Model()
11 # 1. setup the input protein
12 # 1.1 select a selector.
14 # 1.2 read the protein
15 mh = IMP.atom.read_pdb(IMP.em.get_example_path("input.pdb"), m, sel)
16 ps = IMP.core.get_leaves(mh)
18 # 2. read the density map
19 resolution = 8.
20 voxel_size = 1.5
21 dmap = IMP.em.read_map(
23 dmap.get_header_writable().set_resolution(resolution)
24 # 3. calculate the cross correlation between the density and the map
25 print "The cross-correlation score is:", 1. - IMP.em.compute_fitting_score(ps, dmap)
26 # 4. add a fitting restraint
27 r = IMP.em.FitRestraint(ps, dmap)
28 m.add_restraint(r)
29 print "The fit of the particles in the density is:", r.evaluate(False)
void set_log_level(LogLevel l)
Set the current global log level.
void add_radii(Hierarchy d, const ForceFieldParameters *ffp=get_all_atom_CHARMM_parameters(), FloatKey radius_key=FloatKey("radius"))
GenericHierarchies get_leaves(Hierarchy mhd)
Get all the leaves of the bit of hierarchy.
Float compute_fitting_score(const kernel::ParticlesTemp &ps, DensityMap *em_map, FloatKey wei_key=atom::Mass::get_mass_key())
Compute fitting scores for a given set of rigid transformations.
Basic utilities for handling cryo-electron microscopy 3D density maps.
DensityMap * read_map(std::string filename)
Read a density map from a file and return it.
std::string get_example_path(std::string file_name)
Return the path to installed example data for this module.
Basic functionality that is expected to be used by a wide variety of IMP users.
Calculate score based on fit to EM map.
Definition: FitRestraint.h:32
Select all non-water non-alternative ATOM and HETATM records.
Definition: pdb.h:219
Functionality for loading, creating, manipulating and scoring atomic structures.
void read_pdb(base::TextInput input, int model, Hierarchy h)
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73