IMP  2.1.1
The Integrative Modeling Platform
IMP::atom::Hierarchy Class Reference

The standard decorator for manipulating molecular structures. More...

#include <IMP/atom/Hierarchy.h>

+ Inheritance diagram for IMP::atom::Hierarchy:

Public Member Functions

 Hierarchy (kernel::Model *m, kernel::ParticleIndex pi)
 
 Hierarchy (kernel::ParticleAdaptor 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. More...
 
Hierarchy get_child (unsigned int i) const
 
Hierarchies get_children () const
 Return the children in the order they were added.
 
template<class C >
get_children () const
 Get the children in a container of your choosing, eg kernel::ParticlesTemp.
 
bool get_is_valid (bool print_info) const
 Return true if the hierarchy is valid. More...
 
Hierarchy get_parent () const
 
void show (std::ostream &out=std::cout) const
 
- Public Member Functions inherited from IMP::core::Hierarchy
 Hierarchy (const IMP::kernel::ParticleAdaptor &d, const HierarchyTraits &tr=get_default_traits())
 
 Hierarchy (::IMP::kernel::Model *m,::IMP::kernel::ParticleIndex id, const HierarchyTraits &tr=get_default_traits())
 
void add_child (Hierarchy h) const
 
void add_child_at (Hierarchy h, unsigned int pos)
 
void clear_children ()
 
Hierarchy get_child (unsigned int i) const
 
kernel::ParticleIndex get_child_index (unsigned int i) const
 
int get_child_index () const
 
GenericHierarchies get_children () const
 
const DecoratorTraitsget_decorator_traits () const
 
unsigned int get_number_of_children () const
 
Hierarchy get_parent () const
 
HierarchyTraits get_traits ()
 
void remove_child (unsigned int i)
 
void remove_child (Hierarchy h)
 
void show (std::ostream &out=std::cout) const
 
- Public Member Functions inherited from IMP::kernel::Decorator
ParticleIndex get_particle_index () const
 
Particleget_particle () const
 
Modelget_model () const
 Returns the Model containing the particle.
 
 Decorator (Particle *p)
 
 Decorator ()
 

Static Public Member Functions

static bool get_is_setup (kernel::Model *m, kernel::ParticleIndex p)
 
static const
IMP::core::HierarchyTraits
get_traits ()
 Get the molecular hierarchy HierararchyTraits.
 
static Hierarchy setup_particle (kernel::Model *m, kernel::ParticleIndex pi, kernel::ParticleIndexesAdaptor children=kernel::ParticleIndexesAdaptor())
 
- Static Public Member Functions inherited from IMP::core::Hierarchy
static Hierarchy decorate_particle (::IMP::kernel::Particle *p, const HierarchyTraits &tr=get_default_traits())
 
static const DecoratorTraitsget_default_decorator_traits ()
 
static const HierarchyTraitsget_default_traits ()
 Get the default hierarchy traits.
 
static bool get_is_setup (const IMP::kernel::ParticleAdaptor &p, const HierarchyTraits &tr=get_default_traits())
 
static bool get_is_setup (kernel::Model *, kernel::ParticleIndex, HierarchyTraits=Hierarchy::get_default_traits())
 
static bool particle_is_instance (IMP::kernel::Model *m, IMP::kernel::ParticleIndex pi, const HierarchyTraits &tr=get_default_traits())
 
static bool particle_is_instance (::IMP::kernel::Particle *p, const HierarchyTraits &tr=get_default_traits())
 
static Hierarchy setup_particle (IMP::kernel::ParticleAdaptor d, DecoratorTraits tr=get_default_decorator_traits())
 
static Hierarchy setup_particle (kernel::Model *m, ParticleIndex pi, DecoratorTraits tr=get_default_decorator_traits())
 
static Hierarchy setup_particle (IMP::kernel::ParticleAdaptor d, kernel::ParticleIndexes children, DecoratorTraits tr=get_default_decorator_traits())
 
static Hierarchy setup_particle (kernel::Model *m, ParticleIndex pi, kernel::ParticleIndexes children, DecoratorTraits tr=get_default_decorator_traits())
 
static Hierarchy setup_particle (kernel::Model *m, ParticleIndex pi, kernel::ParticlesTemp children, DecoratorTraits tr=get_default_decorator_traits())
 
static Hierarchy setup_particle (IMP::kernel::ParticleAdaptor d, kernel::ParticlesTemp children, DecoratorTraits tr=get_default_decorator_traits())
 
- Static Public Member Functions inherited from IMP::kernel::Decorator
static bool get_is_setup (Particle *p)
 Return true if the particle can be cast to the decorator. More...
 

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
 

Additional Inherited Members

- Public Types inherited from IMP::core::Hierarchy
typedef HierarchyTraits DecoratorTraits
 
- Protected Member Functions inherited from IMP::kernel::Decorator
 Decorator (kernel::Model *m, ParticleIndex pi)
 
 Decorator (ParticleAdaptor p)
 

Detailed Description

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).

Tree Basics

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 type of the parent makes sense for the child: eg a Residue cannot be the parent of a Chain.
  • the leaves always have coordinates, radius and mass
  • all particles in hierarchy are from the same model
  • all Atoms has a Residue for as parent
  • any Atom with a non-heterogen atom type is part of a protein, DNA or RNA molecule.
  • all Residue children of a particle appear in order based on their index
  • all Atom children in of a particle appear in order of their AtomType

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.

See Also
Atom
Residue
Chain
Molecule
Domain
Fragment
Mass

Definition at line 196 of file atom/Hierarchy.h.

Member Function Documentation

void IMP::atom::Hierarchy::add_child ( Hierarchy  o)

A child must have a type that is listed before the parent in the Type enum list.

Examples:
atom/dope_and_excluded_volume.cpp.

Definition at line 289 of file atom/Hierarchy.h.

Hierarchy IMP::atom::Hierarchy::get_child ( unsigned int  i) const

Get the ith child based on the order they were added.

Definition at line 299 of file atom/Hierarchy.h.

static bool IMP::atom::Hierarchy::get_is_setup ( kernel::Model m,
kernel::ParticleIndex  p 
)
static

Check if the particle has the needed attributes for a cast to succeed

Definition at line 275 of file atom/Hierarchy.h.

+ Here is the call graph for this function:

bool IMP::atom::Hierarchy::get_is_valid ( bool  print_info) const

Print information about the hierarchy if print_info is true and things are invalid.

Note
Returning true only means that no problems were found, it can't check everything.
Hierarchy IMP::atom::Hierarchy::get_parent ( ) const

Get the parent particle.

Definition at line 323 of file atom/Hierarchy.h.

static Hierarchy IMP::atom::Hierarchy::setup_particle ( kernel::Model m,
kernel::ParticleIndex  pi,
kernel::ParticleIndexesAdaptor  children = kernel::ParticleIndexesAdaptor() 
)
static

Create a Hierarchy of level t by adding the needed attributes.

Definition at line 259 of file atom/Hierarchy.h.

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: