IMP  2.2.1
The Integrative Modeling Platform
markers.py
1 ## \example atom/markers.py
2 # It is often useful to be able to add extra particles to a model to act as markers for particular features. Examples include creating a bounding sphere for some part of a molecule and using the bounding sphere particle in a distance restraint. The IMP.atom.create_cover() is such a function, creating a particle whose IMP.core.XYZR sphere contains the passed IMP.atom.Selection at all times.
3 #
4 # The same code also works (more efficiently in fact) if the protein is made into a rigid body.
5 #
6 
7 import IMP.atom
8 import IMP.display
9 
10 m = IMP.kernel.Model()
11 h = IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"),
12  m)
13 # residues 100 and 153 are two residues that are close together
14 # spatially, create a marker for the volume around them
15 s = IMP.atom.Selection(h, residue_indexes=[100, 153])
16 marker = IMP.atom.create_cover(s, "my marker")
17 m.update()
18 
19 # if we now move the protein, marker will move along with it
22 IMP.atom.transform(h, tr)
23 m.update()
24 
25 # display it to a file
26 w = IMP.display.PymolWriter("marker.pym")
27 g = IMP.core.XYZRGeometry(marker)
28 g.set_color(IMP.display.Color(0, 1, 0))
31 gs.set_color(IMP.display.Color(1, 0, 0))
32 w.add_geometry(g)
33 w.add_geometry(gp)
34 w.add_geometry(gs)
Simple 3D transformation class.
Represent an RGB color.
Definition: Color.h:24
Rotation3D get_random_rotation_3d(const Rotation3D &center, double distance)
Pick a rotation at random near the provided one.
Display a Selection.
Definition: Selection.h:285
std::string get_example_path(std::string file_name)
Return the path to installed example data for this module.
void transform(Hierarchy h, const algebra::Transformation3D &tr)
core::XYZR create_cover(const Selection &s, std::string name=std::string())
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Write a CGO file with the geometry.
Definition: PymolWriter.h:34
See IMP.display for more information.
Definition: ChimeraWriter.h:17
See IMP.atom for more information.
void read_pdb(base::TextInput input, int model, Hierarchy h)
Display an IMP::atom::Hierarchy particle as balls.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:72
Display an IMP::core::XYZR particle as a ball.
Definition: XYZR.h:150