Structural Bioinformatics Library
Template C++ / Python API for developping structural bioinformatics applications.
T_Space_filling_model_shelling_diagram_comparison_module< ModuleTraits > Class Template Reference

Module comparing two input shelling forests using the ordered forest edit distance Module comparing two input shelling forests using the ordered forest edit distance. More...

#include "Space_filling_model_shelling_diagram_comparison_module.hpp"

Public Types

typedef SBL::Modules::T_Space_filling_model_shelling_diagram_comparison_module< ModuleTraits > Self
 
typedef SBL::Modules::Module_base Base
 

Static Public Member Functions

static boost::program_options::options_description *& get_options (void)
 Access to the options' description of the module. More...
 
static bool has_options (void)
 
static void delete_options (void)
 
static void initialize_options (const std::string &caption)
 

Traits Requirements

typedef ModuleTraits::Particle_traits Particle_traits
 Traits class defining the type of particles (atoms or pseudo-atoms) following the concept ParticleTraits. More...
 
typedef ModuleTraits::Atom_shelling_forest Atom_shelling_forest
 Diagram representing the shelling order of a cell complex. More...
 

Other Types

typedef Atom_shelling_forest::Graph Graph
 Underlaying graph representing the shellign diagram. More...
 
typedef SBL::CADS::T_Ordered_forest_edit_distance< Graph, Get_cost, Is_less_shell > Ordered_forest_edit_distance
 Generic Forest Edit Distance algorithm for ordered forests. More...
 
typedef Ordered_forest_edit_distance::FT FT
 Number type of the cost. More...
 
typedef Ordered_forest_edit_distance::Edit_unit_path Edit_unit_path
 Representation of a unitary edition: type of edition, source vertex, target vertex, cost. More...
 

Input Accessors

Atom_shelling_forest *& get_source_atom_shelling_forest (void)
 Reference to a pointer to the input source atom shelling forest. More...
 
Atom_shelling_forest *& get_target_atom_shelling_forest (void)
 Reference to a pointer to the input taret atom shelling forest. More...
 

Output Accessors

const std::vector< Edit_unit_path > & get_edit_script (void) const
 Const reference to the output edit script. More...
 
std::vector< Edit_unit_path > & get_edit_script (void)
 Reference to the output edit script. More...
 

Mandatory Requirements

void run (unsigned verbose, std::ostream &out)
 Runs the module following the input options. More...
 
bool is_runnable (void) const
 Checks that all the input options were set. More...
 
void statistics (std::ostream &out)
 Reports high-level statistics on the module. More...
 
Selfclone (void) const
 Clones the object using the copy constructor. More...
 
std::string get_name (void) const
 Returns the name of the package. More...
 

Optional Requirements

boost::program_options::options_description add_options (void) const
 Virtual method for adding options to the module. More...
 
bool check_options (std::string &message) const
 Checks that the input options' values are coherent. More...
 
std::string get_output_prefix (void) const
 Returns a prefix that concatains the input line options used when running the module. More...
 
void report (const std::string &prefix)
 Reports the output and statistics in output files. More...
 

Modules Management

void set_module_instance_name (const std::string &module_instance_name)
 Sets a name for this instance of this module. In particular, it will be used in the prefix of output files generated by a collection of modules. More...
 
const std::string & get_module_instance_name (void) const
 Get the name of this instance of this module. More...
 
void set_report_mode (std::ios_base::openmode report_mode)
 Set a report mode, that is open or append modes. More...
 
void set_report_mode (std::ios_base::openmode &report_mode)
 Set a report mode, that is open or append modes. More...
 
const std::ios_base::openmode get_report_mode (void) const
 Get the report mode to be used when reporting. More...
 

Others

template<class Self_ >
Self_ * clone (const Self_ *s) const
 Clones the object using the copy constructor. More...
 
virtual bool is_logical_module (void) const
 Checks that this module defines a logical operator. More...
 
virtual bool is_condition_module (void) const
 Checks that this module defines a condition operator. More...
 
virtual bool operator() (void)
 Only for condition modules, for returning the predicate value. More...
 
virtual bool is_modules_collection (void) const
 Checks that this module defines a collection of modules. More...
 

Detailed Description

template<class ModuleTraits>
class SBL::Modules::T_Space_filling_model_shelling_diagram_comparison_module< ModuleTraits >

Module comparing two input shelling forests using the ordered forest edit distance Module comparing two input shelling forests using the ordered forest edit distance.

It computes the ordered forest edit distance from the input source shelling forest to the input target shelling forest. It offers two modes of comparison:

  • topological : only the number of particles in shells is used for comparing two shells.
  • geometrical : pairwise distances between particles in a shell are also used for comparing the shells.

The input shelling forests can be set using the methods SBL::Modules::T_Space_filling_model_shelling_diagram_comparison_module::get_source_atom_shelling_forest and SBL::Modules::T_Space_filling_model_shelling_diagram_comparison_module::get_target_atom_shelling_forest that return references to pointers over the input source and target shelling forests.

The output is a edit script that lists unitary editions (deletion, insertion and morphing) with their unitary cost for transforming the source shelling forest to the target shelling forest. Summing all the unitary costs give the total cost of the comparison.

The output edit script is accessible using the method SBL::Modules::T_Space_filling_model_shelling_diagram_comparison_module::get_edit_script that returns a reference over a container of unitary editions of type SBL::Modules::T_Space_filling_model_shelling_diagram_comparison_module::Edit_unit_path.

Template Parameters
ModuleTraitsTraits class defining the types SBL::Modules::T_Space_filling_model_shelling_diagram_comparison_module::Particle_traits and SBL::Modules::T_Space_filling_model_shelling_diagram_comparison_module::Atom_shelling_forest.

Member Typedef Documentation

◆ Atom_shelling_forest

typedef ModuleTraits::Atom_shelling_forest Atom_shelling_forest

Diagram representing the shelling order of a cell complex.

The CellComplex has some requirements for visiting the cells:

  • given a cell, visit the adjacent cells
  • visit all the cells

3 steps:

– first, defines the cell-complex

– second, attributes the SO to each cell

– third, construct the shelling diagram

Idea: first, find the borders of a patch, i.e the 2-cells incident to a background cell

second, construct a boost graph such that: every border cells are glue on one node, any other cell is represented by a node, and two nodes are linked by an edge if the corresponding cells are adjacents.

third, run dijkstra from the border node: – all cells in the border node have a SO of 0, all other cells have a S0 equals to the distance to the border node.

Now the SO is attributed, we have to construt the SO diagram. To do so, first run a union find algorithm for finding the connected components of cells with the same SO: for each pair of adjacent cells having the same SO, union them.

The SO diagram is initialized with a node for each c.c in union-find

Do the following for each union-find c.c:

– for each cell in a c.c., search for adjacent cells with the next SO: if there is no edge in the SO diagram, ad an edge between the corresponding c.c.

◆ Base

◆ Edit_unit_path

Representation of a unitary edition: type of edition, source vertex, target vertex, cost.

◆ FT

Number type of the cost.

◆ Graph

typedef Atom_shelling_forest::Graph Graph

Underlaying graph representing the shellign diagram.

◆ Ordered_forest_edit_distance

Generic Forest Edit Distance algorithm for ordered forests.

Template Parameters
ForestModel of a forest as a directed or bidirectional boost::adjacency_list.

◆ Particle_traits

typedef ModuleTraits::Particle_traits Particle_traits

Traits class defining the type of particles (atoms or pseudo-atoms) following the concept ParticleTraits.

◆ Self

Member Function Documentation

◆ add_options()

boost::program_options::options_description add_options ( void  ) const
inlinevirtual

Virtual method for adding options to the module.

Reimplemented from T_Module_option_description< Dummy >.

◆ check_options()

bool check_options ( std::string &  message) const
inlinevirtual

Checks that the input options' values are coherent.

Reimplemented from T_Module_option_description< Dummy >.

◆ clone() [1/2]

Self_* clone ( const Self_ *  s) const
inlineinherited

Clones the object using the copy constructor.

◆ clone() [2/2]

T_Space_filling_model_shelling_diagram_comparison_module< ModuleTraits > * clone ( void  ) const
inline

Clones the object using the copy constructor.

◆ delete_options()

static void delete_options ( void  )
inlinestaticinherited

◆ get_edit_script() [1/2]

std::vector< typename T_Space_filling_model_shelling_diagram_comparison_module< ModuleTraits >::Edit_unit_path > & get_edit_script ( void  )
inline

Reference to the output edit script.

◆ get_edit_script() [2/2]

const std::vector< typename T_Space_filling_model_shelling_diagram_comparison_module< ModuleTraits >::Edit_unit_path > & get_edit_script ( void  ) const
inline

Const reference to the output edit script.

◆ get_module_instance_name()

const std::string& get_module_instance_name ( void  ) const
inlineinherited

Get the name of this instance of this module.

◆ get_name()

std::string get_name ( void  ) const
inlinevirtual

Returns the name of the package.

Reimplemented from Module_base.

◆ get_options()

static boost::program_options::options_description*& get_options ( void  )
inlinestaticinherited

Access to the options' description of the module.

◆ get_output_prefix()

std::string get_output_prefix ( void  ) const
inlinevirtual

Returns a prefix that concatains the input line options used when running the module.

Reimplemented from T_Module_option_description< Dummy >.

◆ get_report_mode()

const std::ios_base::openmode get_report_mode ( void  ) const
inlineinherited

Get the report mode to be used when reporting.

◆ get_source_atom_shelling_forest()

T_Space_filling_model_shelling_diagram_comparison_module< ModuleTraits >::Atom_shelling_forest *& get_source_atom_shelling_forest ( void  )
inline

Reference to a pointer to the input source atom shelling forest.

◆ get_target_atom_shelling_forest()

T_Space_filling_model_shelling_diagram_comparison_module< ModuleTraits >::Atom_shelling_forest *& get_target_atom_shelling_forest ( void  )
inline

Reference to a pointer to the input taret atom shelling forest.

◆ has_options()

static bool has_options ( void  )
inlinestaticinherited

◆ initialize_options()

static void initialize_options ( const std::string &  caption)
inlinestaticinherited

◆ is_condition_module()

virtual bool is_condition_module ( void  ) const
inlineprotectedvirtualinherited

Checks that this module defines a condition operator.

◆ is_logical_module()

virtual bool is_logical_module ( void  ) const
inlineprotectedvirtualinherited

Checks that this module defines a logical operator.

◆ is_modules_collection()

virtual bool is_modules_collection ( void  ) const
inlineprotectedvirtualinherited

Checks that this module defines a collection of modules.

◆ is_runnable()

bool is_runnable ( void  ) const
inlinevirtual

Checks that all the input options were set.

Reimplemented from Module_base.

◆ operator()()

virtual bool operator() ( void  )
inlineprotectedvirtualinherited

Only for condition modules, for returning the predicate value.

◆ report()

void report ( const std::string &  prefix)
inlinevirtual

Reports the output and statistics in output files.

Reimplemented from Module_base.

◆ run()

void run ( unsigned  verbose,
std::ostream &  out 
)
inlinevirtual

Runs the module following the input options.

Implements Module_base.

◆ set_module_instance_name()

void set_module_instance_name ( const std::string &  module_instance_name)
inlineinherited

Sets a name for this instance of this module. In particular, it will be used in the prefix of output files generated by a collection of modules.

◆ set_report_mode() [1/2]

void set_report_mode ( std::ios_base::openmode &  report_mode)
inlineinherited

Set a report mode, that is open or append modes.

◆ set_report_mode() [2/2]

void set_report_mode ( std::ios_base::openmode  report_mode)
inlineinherited

Set a report mode, that is open or append modes.

◆ statistics()

void statistics ( std::ostream &  out)
inlinevirtual

Reports high-level statistics on the module.

Reimplemented from Module_base.