The standard decorator for manipulating molecular structures.
IMP represents molecular structures using the Hierachy decorator. Molecules and collections of molecules each are stored as a hierarchy (or tree) where the resolution of the representation increases as you move further from the root. That is, if a parent has some particular property (eg, marks out a volume by having a x,y,z coordinates and a radius), then the children should have a higher resolution form of that information (eg, mark out a more detailed excluded volume by defining a set of balls which having approximately the same total volume).
In a tree you have a set of nodes, represented by Hierarchy particles. Each node can have a node can have at most one parent. The node with no parent is known as the root of the tree.
Here is a simple example with a protein with three residues. Two of the residues have atoms, where as the third is coarse grained.
The nodes in the hierarchy can correspond to arbitrary bits of a molecule and do not need to have any biological significant. For example we could introduce a fragment containing residues 0 and 1:
A hierarchy can have any tree structure as long as:
The get_is_valid() method checks some of these properties. Any method taking a hierarchy as an argument should do
IMP_USAGE_CHECK(h.get_is_valid(), "Invalid hierarchy as input");
to make sure the hierarchy makes sense.
A number of decorator types are associated with the Hierarchy to store the information associated with that node in the hierarchy. Examples include Residue, Atom, XYZ, Chain, XYZR, Mass, Domain, Molecule etc. We provide a get_as_x() function for each such decorator which returns either X() (a null type) if the node is not a particle of type x, or an X decorator wrapping the current particle if it is.
Examples: cover particles, dependency graph, displaying ensembles, rigid bodies, adding data, pdb, molecular hierarchy, local fitting, setup, nup84 cg, nup84 rb, connectivity restraint
Inheritance diagram for IMP::atom::Hierarchy:Public Member Functions | |
| Hierarchy (Particle *p) | |
| Hierarchy (Model *m, ParticleIndex pi) | |
| Hierarchy () | |
| null constructor | |
| Hierarchy (IMP::core::Hierarchy h) | |
| The traits must match. | |
| void | add_child (Hierarchy o) |
| Add a child and check that the types are appropriate. | |
| Hierarchy | get_child (unsigned int i) const |
| Hierarchies | get_children () const |
| Return the children in the order they were added. | |
| template<class C > | |
| C | get_children () const |
| Get the children in a container of your choosing, eg ParticlesTemp. | |
| bool | get_is_valid (bool print_info) const |
| Return true if the hierarchy is valid. | |
| Hierarchy | get_parent () const |
Static Public Member Functions | |
| static Hierarchy | decorate_particle (Particle *p) |
| cast a particle which has the needed attributes | |
| static const IMP::core::HierarchyTraits & | get_traits () |
| Get the molecular hierarchy HierararchyTraits. | |
| static bool | particle_is_instance (Particle *p) |
| static Hierarchy | setup_particle (Particle *p, const ParticlesTemp &children=ParticlesTemp()) |
PDB Reading | |
The read PDB methods produce a hierarchy that looks as follows:
Waters are currently dropped if they are ATOM records. This can be fixed. The read_pdb() functions should successfully parse all valid pdb files. It can produce warnings on files which are not valid. It will attempt to read such files, but all bets are off. When reading PDBs, PDBSelector objects can be used to choose to only process certain record types. See the class documentation for more information. When no PDB selector is supplied for reading, the NonWaterPDBSelector is used. Set the IMP::LogLevel to VERBOSE to see details of parse errors. | |
| Hierarchy | read_pdb (base::TextInput in, Model *model) |
| Hierarchy | read_pdb (base::TextInput in, Model *model, PDBSelector *selector, bool select_first_model=true) |
| Hierarchies | read_multimodel_pdb (base::TextInput in, Model *model, PDBSelector *selector) |
| Hierarchies | read_multimodel_pdb (base::TextInput in, Model *model) |
PDB Writing | |
The methods to write a PDBs expects a Hierarchy that looks as follows: All Residue particles that have a Chain particle as an ancestor are considered part of a protein, DNA or RNA, ones without are considered heterogens. The functions produce files that are not valid PDB files, eg only ATOM/HETATM lines are printed for all Atom particles in the hierarchy. Complain if your favorite program can't read them and we might fix it. | |
| void | write_pdb (Hierarchy mhd, base::TextOutput out, unsigned int model=0) |
| void | write_pdb (const Hierarchies &mhd, base::TextOutput out, unsigned int model=0) |
| void | write_multimodel_pdb (const Hierarchies &mhd, base::TextOutput out) |
Methods to get associated decorators | |
We provide a number of helper methods to get associated decorators for the current node in the hierarchy. As an example, if the particle decorated by this decorator is a Residue particle, then get_as_residue() return Residue(get_particle()), if not it returns Residue(). | |
| Atom | get_as_atom () const |
| Residue | get_as_residue () const |
| Chain | get_as_chain () const |
| Molecule | get_as_molecule () const |
| Domain | get_as_domain () const |
| Fragment | get_as_fragment () const |
| core::XYZ | get_as_xyz () const |
| core::XYZR | get_as_xyzr () const |
| Mass | get_as_mass () const |
Related Functions | |
(Note that these are not member functions.) | |
| Hierarchy | create_clone (Hierarchy d) |
| Clone the Hierarchy. | |
| Hierarchy | create_clone_one (Hierarchy d) |
| Clone the node in the Hierarchy. | |
| Restraint * | create_excluded_volume_restraint (const Hierarchies &hs, double resolution=-1) |
| Hierarchy | create_fragment (const Hierarchies &ps) |
| Create a fragment containing the specified nodes. | |
| Hierarchy | create_protein (Model *m, std::string name, double resolution, int number_of_residues, int first_residue_index=0, double volume=-1) |
| Create a coarse grained molecule. | |
| void | destroy (Hierarchy d) |
| Delete the Hierarchy. | |
| Atom | get_atom (Residue rd, AtomType at) |
| Return a particle atom from the residue. | |
| algebra::Sphere3D | get_bounding_sphere (const Hierarchy &h) |
| Hierarchies | get_by_type (Hierarchy mhd, GetByType t) |
| HierarchyTree | get_hierarchy_tree (Hierarchy h) |
| Hierarchies | get_leaves (Hierarchy h) |
| Hierarchies | get_leaves (const Hierarchies &h) |
| Residue | get_residue (Atom d, bool nothrow=false) |
| Return the Residue containing this atom. | |
| Hierarchy | get_residue (Hierarchy mhd, unsigned int index) |
| Get the residue with the specified index. | |
| Hierarchy | get_root (Hierarchy h) |
| Return the root of the hierarchy. | |
| void | setup_as_approximation (Hierarchy h) |
| void | show (Hierarchy h, std::ostream &out=std::cout) |
| Print out a molecular hierarchy. | |
| IMP::atom::Hierarchy::Hierarchy | ( | ) |
null constructor
Reimplemented from IMP::core::Hierarchy.
| IMP::atom::Hierarchy::Hierarchy | ( | IMP::core::Hierarchy | h | ) | [explicit] |
The traits must match.
| void IMP::atom::Hierarchy::add_child | ( | Hierarchy | o | ) |
Add a child and check that the types are appropriate.
A child must have a type that is listed before the parent in the Type enum list.
cast a particle which has the needed attributes
| Hierarchy IMP::atom::Hierarchy::get_child | ( | unsigned int | i | ) | const |
Get the ith child based on the order they were added.
Reimplemented from IMP::core::Hierarchy.
| Hierarchies IMP::atom::Hierarchy::get_children | ( | ) | const |
Return the children in the order they were added.
Reimplemented from IMP::core::Hierarchy.
| C IMP::atom::Hierarchy::get_children | ( | ) | const |
Get the children in a container of your choosing, eg ParticlesTemp.
Reimplemented from IMP::core::Hierarchy.
| bool IMP::atom::Hierarchy::get_is_valid | ( | bool | print_info | ) | const |
Return true if the hierarchy is valid.
Print information about the hierarchy if print_info is true and things are invalid.
| Hierarchy IMP::atom::Hierarchy::get_parent | ( | ) | const |
Get the parent particle.
Reimplemented from IMP::core::Hierarchy.
| static const IMP::core::HierarchyTraits& IMP::atom::Hierarchy::get_traits | ( | ) | [static] |
Get the molecular hierarchy HierararchyTraits.
| static bool IMP::atom::Hierarchy::particle_is_instance | ( | Particle * | p | ) | [static] |
Check if the particle has the needed attributes for a cast to succeed
Reimplemented from IMP::Decorator.
Reimplemented in IMP::atom::Residue, IMP::atom::Atom, IMP::atom::Domain, IMP::atom::Fragment, IMP::atom::Chain, IMP::atom::Molecule, IMP::atom::CHARMMAtom, and IMP::atom::Copy.
| static Hierarchy IMP::atom::Hierarchy::setup_particle | ( | Particle * | p, |
| const ParticlesTemp & | children = ParticlesTemp() |
||
| ) | [static] |
Create a Hierarchy of level t by adding the needed attributes.
| Restraint * create_excluded_volume_restraint | ( | const Hierarchies & | hs, |
| double | resolution = -1 |
||
| ) | [related] |
Create an excluded volume restraint for the included molecules. If a value is provided for resolution, then something less than the full resolution representation will be used.
If one or more of the selections is a rigid body, this will be used to accelerate the computation.
| Hierarchy create_protein | ( | Model * | m, |
| std::string | name, | ||
| double | resolution, | ||
| int | number_of_residues, | ||
| int | first_residue_index = 0, |
||
| double | volume = -1 |
||
| ) | [related] |
Create a coarse grained molecule.
The coarse grained model is created with a number of spheres based on the resolution and the volume. If the volume is not provided it is estimated based on the number of residues. The protein is created as a molecular hierarchy rooted at p. The leaves are Domain particles with appropriate residue indexes stored and are XYZR particles.
Volume is, as usual, in cubic anstroms.
Currently the function creates a set of balls with radii no greater than resolution which overlap by 20% and have a volume of their union equal to the passed volume.
The coordinates of the balls defining the protein are optimized by default, and have garbage coordinate values.
| void destroy | ( | Hierarchy | d | ) | [related] |
Return a particle atom from the residue.
The residue must be part of a molecular hierarchy.
| algebra::Sphere3D get_bounding_sphere | ( | const Hierarchy & | h | ) | [related] |
See get_bounding_box() for more details.
| HierarchyTree get_hierarchy_tree | ( | Hierarchy | h | ) | [related] |
Get a graph for the passed Hierarchy. This can be used, for example, to graphically display the hierarchy in 2D.
| Hierarchies get_leaves | ( | Hierarchy | h | ) | [related] |
| Hierarchies get_leaves | ( | const Hierarchies & | h | ) | [related] |
Return the Residue containing this atom.
The atom must be part of a molecular hierarchy.
| ValueException | if no residue is found, unless nothrow is true. |
| Hierarchy read_pdb | ( | base::TextInput | in, |
| Model * | model | ||
| ) | [related] |
Read a all the molecules in the first model of the pdb file.
| void setup_as_approximation | ( | Hierarchy | h | ) | [related] |
Set the mass, radius, residues, and coordinates to approximate the passed particle based on the leaves of h.
| void show | ( | Hierarchy | h, |
| std::ostream & | out = std::cout |
||
| ) | [related] |
Print out a molecular hierarchy.