IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
IMP::bayesianem Namespace Reference

Restraints for handling electron microscopy maps. More...

Detailed Description

Restraints for handling electron microscopy maps.

bayesianem, an IMP module for Bayesian multi-scale modeling of macromolecular structures based on cryo-electron microscopy density maps

Build Status codecov

Usage:

First, import the module:

import IMP.bayesianem
import IMP.bayesianem.restraint

Then, select the model densities that you want to assign to the EM:

sel = IMP.atom.Selection(hierarchy=hier, representation_type=IMP.atom.DENSITIES)
densities=sel.get_selected_particles()
Select hierarchy particles identified by the biological name.
Definition Selection.h:76
Functionality for loading, creating, manipulating and scoring atomic structures.
Base functionality and abstract base classes for representation, scoring and sampling.

Finally, create the restraint (replace gmm.txt by your target gmm), and add it to the model.

gem = IMP.bayesianem.restraint.GaussianEMRestraintWrapper(densities,
target_fn=‘gmm.txt',
scale_target_to_mass=True,
slope=0.01,
target_radii_scale=3.0,
target_is_rigid_body=False)
gem.add_to_model()
gem.set_label("Total")
output_objects.append(gem)
Fit Gaussian-decorated particles to an EM map (also represented with a set of Gaussians).
IMP::bayesianem.restraint
Restraints for handling electron microscopy maps.

Info

Author(s): Samuel Hanot, Massimiliano Bonomi, Riccardo Pellarin

Maintainer: Riccardo Pellarin

License: LGPL

Publications:

Classes

class  GaussianEMRestraint
 Creates a restraint between two Gaussian Mixture Models, "model" and "density". More...

Typedefs

typedef IMP::algebra::DenseGrid3D< double > DensityGrid

Functions

double gem_score_cc (Particles model_ps, Particles density_ps)
DensityGrid get_grid (IMP::em::DensityMap *in)
IMP::em::DensityMap * get_masked_map (const IMP::algebra::Gaussian3Ds &gmm, const Floats &weights, IMP::em::DensityMap *densitymap, double threshold)
IMP::algebra::Vector3Ds get_overlap_binned (const IMP::algebra::Gaussian3Ds &gmm, const Floats &weights, IMP::em::DensityMap *dm, double factor=2.5, int Nbin=100)
double get_overlap_fast (const IMP::algebra::Gaussian3Ds &gmm, const Floats &weights, IMP::em::DensityMap *dm, double factor=2.5)
double get_percentage_closer_than (const IMP::core::XYZs &m1, const IMP::core::XYZs &m2, const double t)
double get_rmsd_excluding_higher_than (const IMP::core::XYZs &m1, const IMP::core::XYZs &m2, const double t)
double get_rmsd_of_best_population (const IMP::algebra::Vector3Ds &m1, const IMP::algebra::Vector3Ds &m2, const double percentage)
double get_rmsd_of_best_population (const IMP::atom::Selection &s1, const IMP::atom::Selection &s2, const double percentage)
double get_rmsd_of_best_population (const IMP::core::XYZs &m1, const IMP::core::XYZs &m2, const double percentage)
IMP::algebra::Rotation3D get_rotation_matrix (const IMP::algebra::Vector3D &x, const IMP::algebra::Vector3D &y)
IMP::em::DensityMap * get_sub_map (const IMP::em::DensityMap *dm, const IMP::em::DensityMap *sub_gmm, const IMP::em::DensityMap *gmm)
IMP::algebra::Transformation3D get_transformation_aligning_first_to_second (const IMP::atom::Selection &s1, const IMP::atom::Selection &s2)
IMP::algebra::PrincipalComponentAnalysis NormalizePCA (const IMP::algebra::PrincipalComponentAnalysis &pca, const IMP::Particles &ps)
IMP::algebra::Transformation3Ds PCAalign (const IMP::algebra::PrincipalComponentAnalysis &pca1, const IMP::algebra::PrincipalComponentAnalysis &pca2)
float sgn (double v)

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 ()
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.
std::string get_example_path (std::string file_name)
 Return the full path to one of this module's example files.

Typedef Documentation

◆ DensityGrid

typedef IMP::algebra::DenseGrid3D<double> IMP::bayesianem::DensityGrid

Definition at line 26 of file bayesianem/utilities.h.

Function Documentation

◆ gem_score_cc()

double IMP::bayesianem::gem_score_cc ( Particles model_ps,
Particles density_ps )

Definition at line 133 of file bayesianem/utilities.h.

◆ get_data_path()

std::string IMP::bayesianem::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::bayesianem::get_data_path("data_library"));
std::string get_data_path(std::string file_name)
Return the full path to one of this module's data files.

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.
Here is the call graph for this function:

◆ get_example_path()

std::string IMP::bayesianem::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::bayesianem::get_example_path("example_protein.pdb"));
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.

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.
Here is the call graph for this function:

◆ get_grid()

DensityGrid IMP::bayesianem::get_grid ( IMP::em::DensityMap * in)

Definition at line 182 of file bayesianem/utilities.h.

◆ get_masked_map()

IMP::em::DensityMap * IMP::bayesianem::get_masked_map ( const IMP::algebra::Gaussian3Ds & gmm,
const Floats & weights,
IMP::em::DensityMap * densitymap,
double threshold )

Definition at line 208 of file bayesianem/utilities.h.

◆ get_module_name()

std::string IMP::bayesianem::get_module_name ( )

Definition at line 144 of file bayesianem_config.h.

◆ get_overlap_binned()

IMP::algebra::Vector3Ds IMP::bayesianem::get_overlap_binned ( const IMP::algebra::Gaussian3Ds & gmm,
const Floats & weights,
IMP::em::DensityMap * dm,
double factor = 2.5,
int Nbin = 100 )

Definition at line 308 of file bayesianem/utilities.h.

◆ get_overlap_fast()

double IMP::bayesianem::get_overlap_fast ( const IMP::algebra::Gaussian3Ds & gmm,
const Floats & weights,
IMP::em::DensityMap * dm,
double factor = 2.5 )

Definition at line 275 of file bayesianem/utilities.h.

◆ get_percentage_closer_than()

double IMP::bayesianem::get_percentage_closer_than ( const IMP::core::XYZs & m1,
const IMP::core::XYZs & m2,
const double t )

Definition at line 44 of file bayesianem/utilities.h.

◆ get_rmsd_excluding_higher_than()

double IMP::bayesianem::get_rmsd_excluding_higher_than ( const IMP::core::XYZs & m1,
const IMP::core::XYZs & m2,
const double t )

Definition at line 28 of file bayesianem/utilities.h.

◆ get_rmsd_of_best_population() [1/3]

double IMP::bayesianem::get_rmsd_of_best_population ( const IMP::algebra::Vector3Ds & m1,
const IMP::algebra::Vector3Ds & m2,
const double percentage )

Definition at line 116 of file bayesianem/utilities.h.

◆ get_rmsd_of_best_population() [2/3]

double IMP::bayesianem::get_rmsd_of_best_population ( const IMP::atom::Selection & s1,
const IMP::atom::Selection & s2,
const double percentage )

Definition at line 75 of file bayesianem/utilities.h.

◆ get_rmsd_of_best_population() [3/3]

double IMP::bayesianem::get_rmsd_of_best_population ( const IMP::core::XYZs & m1,
const IMP::core::XYZs & m2,
const double percentage )

Definition at line 58 of file bayesianem/utilities.h.

◆ get_rotation_matrix()

IMP::algebra::Rotation3D IMP::bayesianem::get_rotation_matrix ( const IMP::algebra::Vector3D & x,
const IMP::algebra::Vector3D & y )

Definition at line 364 of file bayesianem/utilities.h.

◆ get_sub_map()

IMP::em::DensityMap * IMP::bayesianem::get_sub_map ( const IMP::em::DensityMap * dm,
const IMP::em::DensityMap * sub_gmm,
const IMP::em::DensityMap * gmm )

Definition at line 256 of file bayesianem/utilities.h.

◆ get_transformation_aligning_first_to_second()

IMP::algebra::Transformation3D IMP::bayesianem::get_transformation_aligning_first_to_second ( const IMP::atom::Selection & s1,
const IMP::atom::Selection & s2 )

Definition at line 95 of file bayesianem/utilities.h.

◆ NormalizePCA()

IMP::algebra::PrincipalComponentAnalysis IMP::bayesianem::NormalizePCA ( const IMP::algebra::PrincipalComponentAnalysis & pca,
const IMP::Particles & ps )

Definition at line 375 of file bayesianem/utilities.h.

◆ PCAalign()

IMP::algebra::Transformation3Ds IMP::bayesianem::PCAalign ( const IMP::algebra::PrincipalComponentAnalysis & pca1,
const IMP::algebra::PrincipalComponentAnalysis & pca2 )

Definition at line 409 of file bayesianem/utilities.h.

◆ sgn()

float IMP::bayesianem::sgn ( double v)

Definition at line 371 of file bayesianem/utilities.h.