IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/21
The Integrative Modeling Platform
IMP::rmf Namespace Reference

Support for the RMF file format for storing hierarchical molecular data and markup. More...

Detailed Description

Support for the RMF file format for storing hierarchical molecular data and markup.

RMF can store hierarchical molecular data (such as atomic or coarse grained representations of proteins), along with markup, including geometry and score data.

IMP.rmf supports I/O of IMP::atom::Hierarchy and associated types as well as output of IMP::display::Geometry, IMP::Restraint and arbitrary IMP::Particles. For each of these there are methods like:

Once objects are linked/added/created, they are attached to the RMF file. IMP::rmf::load_frame() can be used to change the state of the linked objects to that of an arbitrary frame and IMP::rmf::save_frame() can be used to save the current state of the objects into a frame in the RMF file.

See the RMF library for more information.

Several helper programs are also provided:

rmf_display

Export an RMF file to a viewer. rmf_display outputs an arbitrary RMF file to pymol or chimera as appropriate (based on the file name of the second argument). It supports hierarchies, restraints and geometry.

pdb_rmf

Make an RMF file from a PDB.

rmf_simplify

Create a simplified representation of a PDB.

Info

Author(s): Daniel Russel

Maintainer: benmwebb

License: LGPL This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Publications:

Classes

class  HierarchyLoadLink
 
class  HierarchySaveLink
 
class  LoadLink
 
class  SaveLink
 
class  SaveOptimizerState
 Periodically dump the state of all associated objects into the RMF file. More...
 
class  SimpleLoadLink
 
class  SimpleSaveLink
 

Typedefs

typedef ObjectAssociationType
 
typedef IMP::Vector
< IMP::Pointer< LoadLink > > 
LoadLinks
 
typedef IMP::Vector
< IMP::WeakPointer< LoadLink > > 
LoadLinksTemp
 
typedef IMP::Vector
< IMP::Pointer< SaveLink > > 
SaveLinks
 
typedef IMP::Vector
< IMP::WeakPointer< SaveLink > > 
SaveLinksTemp
 

Functions

template<class T >
T * get_association (RMF::NodeConstHandle nh)
 
void load_frame (RMF::FileConstHandle file, RMF::FrameID frame)
 Load the given RMF frame into the state of the linked objects. More...
 
RMF::FrameID save_frame (RMF::FileHandle file, std::string name="")
 Save the current state of the linked objects as a new RMF frame. More...
 
void set_association (RMF::NodeConstHandle nh, Object *o, bool overwrite=false)
 

Associations

RMF supports tracking associations between an RMF file and native objects. In the IMP case these are IMP::Object and we provide some special methods to aid in this process.

RMF::NodeConstHandle get_node_from_association (RMF::FileConstHandle nh, Object *oi)
 
RMF::NodeHandle get_node_from_association (RMF::FileHandle nh, Object *oi)
 
bool get_has_associated_node (RMF::FileConstHandle nh, Object *oi)
 

Hierarchy I/O

Hierarchy I/O writes IMP::atom::Hierarchy information along with the information contained in the following decorators

Note
IMP::core::XYZ and IMP::core::RigidBody data are stored at each frame. Data for all the other decorators are assumed to be static attributes, and are stored once for the entire RMF file. There is currently no way to customize this. Complain to the IMP team if this is problematic.

Note
To avoid unexpected behavior, be aware that when linking atom::Hierarchies against an RMF file, the linked hierarchies are assumed to be identical in all of their static attributes to the hierarchies in the RMF file (within RMF::REPRESENTATION nodes). In particular, these hierarchies must have the same tree topology (number of children for each node).
void add_hierarchies (RMF::FileHandle fh, const atom::Hierarchies &hs)
 
void add_hierarchies (RMF::NodeHandle fh, const atom::Hierarchies &hs)
 
void add_hierarchy (RMF::FileHandle fh, atom::Hierarchy hs)
 
atom::Hierarchies create_hierarchies (RMF::FileConstHandle fh, Model *m)
 
void link_hierarchies (RMF::FileConstHandle fh, const atom::Hierarchies &hs)
 

Geometry I/O

The geometry I/O support currently handles geometry composed of

Other types can be supported when requested. Be aware, many more complex geometry types are automatically decomposed into the above types and are so, more or less, supported.

void add_geometries (RMF::FileHandle file, const display::GeometriesTemp &r)
 Add geometries to the file. More...
 
void add_geometries (RMF::NodeHandle parent, const display::GeometriesTemp &r)
 Add geometries to a given parent node. More...
 
void add_static_geometries (RMF::FileHandle parent, const display::GeometriesTemp &r)
 Add geometries, assuming they do not move between frames. More...
 
void add_geometry (RMF::FileHandle file, display::Geometry *r)
 Add a single geometry to the file. More...
 
display::Geometries create_geometries (RMF::FileConstHandle parent)
 Create geometry objects for the geometry nodes found in the file. More...
 
void link_geometries (RMF::FileConstHandle parent, const display::GeometriesTemp &r)
 Link the passed geometry objects to corresponding ones in the file. More...
 

Particle I/O

Arbitrary (non IMP::atom::Hierarchy) particles can be written to the file and read back from them. All non IMP::Object attributes are supported. Note that currently particles must be added so that any particles that are stored in a given particles attributes are added to the file first.

The data is stored in a category named IMP.

void add_particles (RMF::FileHandle fh, const ParticlesTemp &hs)
 
void add_particles (RMF::NodeHandle fh, const ParticlesTemp &hs)
 
void add_particle (RMF::FileHandle fh, Particle *hs)
 
ParticlesTemp create_particles (RMF::FileConstHandle fh, Model *m)
 
void link_particles (RMF::FileConstHandle fh, const ParticlesTemp &hs)
 

Restraint I/O

Restraints are written as RMF::FEATURE nodes with subnodes for the decomposed restraints (Restraint::create_current_decomposition()). The Restraints::get_last_score() value is what is saved to the file, so make sure that the restraints have been evaluated before saving a frame.

Any particles returned by Restraint::get_input_particles() that are also linked in the RMF file will be included in the RMF file as inputs for the Restraint. This allows external software like e.g., Chimera to associate these restraints with a certain set of particles.

void add_restraints (RMF::FileHandle fh, const Restraints &hs)
 
void add_restraints (RMF::NodeHandle fh, const Restraints &hs)
 
void add_restraint (RMF::FileHandle fh, Restraint *hs)
 
Restraints create_restraints (RMF::FileConstHandle fh, Model *m)
 
void link_restraints (RMF::FileConstHandle fh, const Restraints &hs)
 
void add_restraints_as_bonds (RMF::FileHandle fh, const Restraints &rs)
 Add a list of restraints to the file as (static) bonds. More...
 
void set_maximum_number_of_terms (RMF::FileHandle fh, unsigned int num)
 Limit the number of restraint terms. More...
 

Standard module functions

All IMP modules have a set of standard functions to help get information about the module and about files associated with the module.

std::string get_module_version ()
 Return the version of this module, as a string. More...
 
std::string get_module_name ()
 
std::string get_data_path (std::string file_name)
 Return the full path to one of this module's data files. More...
 
std::string get_example_path (std::string file_name)
 Return the full path to one of this module's example files. More...
 

Typedef Documentation

A vector of reference-counting object pointers.

Definition at line 24 of file links.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
LoadLink

Definition at line 26 of file links.h.

A vector of reference-counting object pointers.

Definition at line 23 of file links.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
SaveLink

Definition at line 24 of file links.h.

Function Documentation

void IMP::rmf::add_geometries ( RMF::FileHandle  file,
const display::GeometriesTemp &  r 
)

Add geometries to the file.

void IMP::rmf::add_geometries ( RMF::NodeHandle  parent,
const display::GeometriesTemp &  r 
)

Add geometries to a given parent node.

void IMP::rmf::add_geometry ( RMF::FileHandle  file,
display::Geometry *  r 
)

Add a single geometry to the file.

void IMP::rmf::add_hierarchies ( RMF::NodeHandle  fh,
const atom::Hierarchies &  hs 
)

Add objects to the file under the specified node.

Note
This does not save a configuration; make sure you use save_frame() to do that.
void IMP::rmf::add_hierarchies ( RMF::FileHandle  fh,
const atom::Hierarchies &  hs 
)

Add objects to the file.

Note
This does not save a configuration; make sure you use save_frame() to do that.
void IMP::rmf::add_hierarchy ( RMF::FileHandle  fh,
atom::Hierarchy  hs 
)

Add a single Hierarchy object to the RMF file.

Note
This does not save a configuration; make sure you use save_frame() to do that.
void IMP::rmf::add_particle ( RMF::FileHandle  fh,
Particle *  hs 
)

Add a single Particle object to the RMF file.

Note
This does not save a configuration; make sure you use save_frame() to do that.
void IMP::rmf::add_particles ( RMF::FileHandle  fh,
const ParticlesTemp &  hs 
)

Add objects to the file.

Note
This does not save a configuration; make sure you use save_frame() to do that.
void IMP::rmf::add_particles ( RMF::NodeHandle  fh,
const ParticlesTemp &  hs 
)

Add objects to the file under the specified node.

Note
This does not save a configuration; make sure you use save_frame() to do that.
void IMP::rmf::add_restraint ( RMF::FileHandle  fh,
Restraint *  hs 
)

Add a single Restraint object to the RMF file.

Note
This does not save a configuration; make sure you use save_frame() to do that.
void IMP::rmf::add_restraints ( RMF::FileHandle  fh,
const Restraints &  hs 
)

Add objects to the file.

Note
This does not save a configuration; make sure you use save_frame() to do that.
void IMP::rmf::add_restraints ( RMF::NodeHandle  fh,
const Restraints &  hs 
)

Add objects to the file under the specified node.

Note
This does not save a configuration; make sure you use save_frame() to do that.
void IMP::rmf::add_restraints_as_bonds ( RMF::FileHandle  fh,
const Restraints &  rs 
)

Add a list of restraints to the file as (static) bonds.

There restraints must decompose into pairwise restraints. Their scores will not be recorded in the file.

void IMP::rmf::add_static_geometries ( RMF::FileHandle  parent,
const display::GeometriesTemp &  r 
)

Add geometries, assuming they do not move between frames.

This can be space saving compared to resaving the constant position each frame.

display::Geometries IMP::rmf::create_geometries ( RMF::FileConstHandle  parent)

Create geometry objects for the geometry nodes found in the file.

atom::Hierarchies IMP::rmf::create_hierarchies ( RMF::FileConstHandle  fh,
Model *  m 
)

Create Hierarchy objects from the RMF file.

Note
This does not load a frame. Make sure you call IMP::rmf::load_frame() before using.
ParticlesTemp IMP::rmf::create_particles ( RMF::FileConstHandle  fh,
Model *  m 
)

Create Particle objects from the RMF file.

Note
This does not load a frame. Make sure you call IMP::rmf::load_frame() before using.
Restraints IMP::rmf::create_restraints ( RMF::FileConstHandle  fh,
Model *  m 
)

Create Restraint objects from the RMF file.

Note
This does not load a frame. Make sure you call IMP::rmf::load_frame() before using.
std::string IMP::rmf::get_data_path ( std::string  file_name)

Return the full path to one of this module's data files.

To read the data file "data_library" that was placed in the data directory of this module, do something like

std::ifstream in(IMP::rmf::get_data_path("data_library"));

This will ensure that the code works both when IMP is installed or if used via the setup_environment.sh script.

Note
Each module has its own data directory, so be sure to use this function from the correct module.
std::string IMP::rmf::get_example_path ( std::string  file_name)

Return the full path to one of this module's example files.

To read the example file "example_protein.pdb" that was placed in the examples directory of this module, do something like

std::ifstream in(IMP::rmf::get_example_path("example_protein.pdb"));

This will ensure that the code works both when IMP is installed or if used via the setup_environment.sh script.

Note
Each module has its own example directory, so be sure to use this function from the correct module.
std::string IMP::rmf::get_module_version ( )

Return the version of this module, as a string.

Note
This function is only available in Python.

Definition at line 5 of file EMageFit/__init__.py.

void IMP::rmf::link_geometries ( RMF::FileConstHandle  parent,
const display::GeometriesTemp &  r 
)

Link the passed geometry objects to corresponding ones in the file.

Note
The geometries must be in the same order; we don't search around for matches.
void IMP::rmf::link_hierarchies ( RMF::FileConstHandle  fh,
const atom::Hierarchies &  hs 
)

Link Hierarchy objects with the RMF file, possibly overwriting an existing link for loading from the file. This does not alter the object, but will affect the behavior of functions like load_frame() and save_frame(). See Linking hierarchies for more information and intricacies

void IMP::rmf::link_particles ( RMF::FileConstHandle  fh,
const ParticlesTemp &  hs 
)

Link Particle objects with the RMF file, possibly overwriting an existing link for loading from the file. This does not alter the object, but will affect the behavior of functions like load_frame() and save_frame().

void IMP::rmf::link_restraints ( RMF::FileConstHandle  fh,
const Restraints &  hs 
)

Link Restraint objects with the RMF file, possibly overwriting an existing link for loading from the file. This does not alter the object, but will affect the behavior of functions like load_frame() and save_frame().

void IMP::rmf::load_frame ( RMF::FileConstHandle  file,
RMF::FrameID  frame 
)

Load the given RMF frame into the state of the linked objects.

The specified frame from the RMF file is loaded into the state of the IMP::Objects that were previously associated with that file.

The current frame is left as the passed frame number.

RMF::FrameID IMP::rmf::save_frame ( RMF::FileHandle  file,
std::string  name = "" 
)

Save the current state of the linked objects as a new RMF frame.

void IMP::rmf::set_maximum_number_of_terms ( RMF::FileHandle  fh,
unsigned int  num 
)

Limit the number of restraint terms.

Certain restraints are made from a really large number of terms. Tracking and displaying all those terms can be very time consuming. If the number of terms is larger than the maximum, the terms are not displayed. By default this is 100.