bpp-phyl3  3.0.0
bpp::CategorySubstitutionRegister Class Referenceabstract

The CategorySubstitutionRegisters. More...

#include <Bpp/Phyl/Mapping/CategorySubstitutionRegister.h>

+ Inheritance diagram for bpp::CategorySubstitutionRegister:
+ Collaboration diagram for bpp::CategorySubstitutionRegister:

Public Member Functions

 CategorySubstitutionRegister (std::shared_ptr< const StateMapInterface > stateMap, bool within=false)
 Build a new substitution register with categories. This class is meant to be inherited. More...
 
virtual size_t getCategory (size_t state) const
 
virtual size_t getCategoryFrom (size_t type) const
 
virtual size_t getCategoryTo (size_t type) const
 
virtual std::string getCategoryName (size_t category) const
 
virtual bool allowWithin () const
 
bool isStationary () const
 
void setStationarity (bool stat)
 
size_t getNumberOfCategories () const
 
size_t getNumberOfSubstitutionTypes () const
 
virtual size_t getType (size_t fromState, size_t toState) const
 Get the substitution type far a given pair of model states. More...
 
std::string getTypeName (size_t type) const
 Get the name of a given substitution type. More...
 
const StateMapInterfacestateMap () const override
 
std::shared_ptr< const StateMapInterfacegetStateMap () const override
 
const Alphabetalphabet () const override
 
std::shared_ptr< const AlphabetgetAlphabet () const override
 
const std::string & getName () const override
 Get the name of the register. More...
 
virtual SubstitutionRegisterInterfaceclone () const =0
 

Protected Member Functions

template<class T >
void setAlphabetCategories (const std::map< int, T > &categories)
 
template<class T >
void setModelCategories (const std::map< size_t, T > &categories)
 

Protected Attributes

bool within_
 
size_t nbCategories_
 
std::map< size_t, size_t > categories_
 
std::vector< std::string > categoryNames_
 
std::vector< std::vector< size_t > > index_
 
std::vector< std::vector< size_t > > revIndex_
 
bool stationarity_
 
std::shared_ptr< const StateMapInterfacestateMap_
 
std::string name_
 

Detailed Description

The CategorySubstitutionRegisters.

Author
Julien Dutheil

Gather states into defined categories, and count the changes between categories.

Optionally allows for within categories substitutions.

Definition at line 25 of file CategorySubstitutionRegister.h.

Constructor & Destructor Documentation

◆ CategorySubstitutionRegister()

bpp::CategorySubstitutionRegister::CategorySubstitutionRegister ( std::shared_ptr< const StateMapInterface stateMap,
bool  within = false 
)
inline

Build a new substitution register with categories. This class is meant to be inherited.

Parameters
stateMapThe stateMap defining the states.
withinSpecifies if within categories substitutions should be counted as well.

Definition at line 45 of file CategorySubstitutionRegister.h.

Member Function Documentation

◆ allowWithin()

virtual bool bpp::CategorySubstitutionRegister::allowWithin ( ) const
inlinevirtual

Definition at line 177 of file CategorySubstitutionRegister.h.

References within_.

◆ alphabet()

const Alphabet& bpp::AbstractSubstitutionRegister::alphabet ( ) const
inlineoverridevirtualinherited
Returns
The alphabet associated to this instance.

Implements bpp::SubstitutionRegisterInterface.

Definition at line 133 of file SubstitutionRegister.h.

References bpp::AbstractSubstitutionRegister::stateMap_.

◆ clone()

◆ getAlphabet()

std::shared_ptr<const Alphabet> bpp::AbstractSubstitutionRegister::getAlphabet ( ) const
inlineoverridevirtualinherited
Returns
A shared_ptr toward the alphabet associated to this instance.

Implements bpp::SubstitutionRegisterInterface.

Definition at line 135 of file SubstitutionRegister.h.

References bpp::AbstractSubstitutionRegister::stateMap_.

◆ getCategory()

virtual size_t bpp::CategorySubstitutionRegister::getCategory ( size_t  state) const
inlinevirtual

Definition at line 137 of file CategorySubstitutionRegister.h.

References categories_.

◆ getCategoryFrom()

virtual size_t bpp::CategorySubstitutionRegister::getCategoryFrom ( size_t  type) const
inlinevirtual

Definition at line 142 of file CategorySubstitutionRegister.h.

References nbCategories_, revIndex_, and within_.

Referenced by getTypeName().

◆ getCategoryName()

virtual std::string bpp::CategorySubstitutionRegister::getCategoryName ( size_t  category) const
inlinevirtual

Definition at line 172 of file CategorySubstitutionRegister.h.

References categoryNames_.

Referenced by getTypeName().

◆ getCategoryTo()

virtual size_t bpp::CategorySubstitutionRegister::getCategoryTo ( size_t  type) const
inlinevirtual

Definition at line 157 of file CategorySubstitutionRegister.h.

References nbCategories_, revIndex_, and within_.

Referenced by getTypeName().

◆ getName()

const std::string& bpp::AbstractSubstitutionRegister::getName ( ) const
inlineoverridevirtualinherited

Get the name of the register.

Returns
A string describing the register.

Implements bpp::SubstitutionRegisterInterface.

Definition at line 137 of file SubstitutionRegister.h.

References bpp::AbstractSubstitutionRegister::name_.

◆ getNumberOfCategories()

size_t bpp::CategorySubstitutionRegister::getNumberOfCategories ( ) const
inline

Definition at line 189 of file CategorySubstitutionRegister.h.

References nbCategories_.

◆ getNumberOfSubstitutionTypes()

size_t bpp::CategorySubstitutionRegister::getNumberOfSubstitutionTypes ( ) const
inlinevirtual
Returns
The number of substitution types supported by this class.

Implements bpp::SubstitutionRegisterInterface.

Definition at line 191 of file CategorySubstitutionRegister.h.

References nbCategories_, and within_.

◆ getStateMap()

std::shared_ptr<const StateMapInterface> bpp::AbstractSubstitutionRegister::getStateMap ( ) const
inlineoverridevirtualinherited
Returns
A shared_ptr toward the state map associated to this instance.

Implements bpp::SubstitutionRegisterInterface.

Definition at line 131 of file SubstitutionRegister.h.

References bpp::AbstractSubstitutionRegister::stateMap_.

◆ getType()

virtual size_t bpp::CategorySubstitutionRegister::getType ( size_t  fromState,
size_t  toState 
) const
inlinevirtual

Get the substitution type far a given pair of model states.

Parameters
fromStateInitial state (should be a state supported by the specified alphabet).
toStateFinal state (should be a state supported by the specified alphabet).
Returns
The index of the corresponding substitution type, ranging from 0 to 'getNumberOfSubstitutionTypes' + 1, as non-substitution (that is when fromState == toState) will always return 0.

Implements bpp::SubstitutionRegisterInterface.

Reimplemented in bpp::GCPositionSubstitutionRegister, and bpp::GCSynonymousSubstitutionRegister.

Definition at line 193 of file CategorySubstitutionRegister.h.

References categories_, and index_.

◆ getTypeName()

std::string bpp::CategorySubstitutionRegister::getTypeName ( size_t  type) const
inlinevirtual

Get the name of a given substitution type.

This method is only used for user-friendlyness purposes, not computational goal. I can therefore be left unimplemented in some cases.

Parameters
typeIndex of the substitution (should be an size_t contained in the register).
Returns
A string describing the substitution type.

Implements bpp::SubstitutionRegisterInterface.

Reimplemented in bpp::GCPositionSubstitutionRegister, and bpp::GCSynonymousSubstitutionRegister.

Definition at line 203 of file CategorySubstitutionRegister.h.

References getCategoryFrom(), getCategoryName(), and getCategoryTo().

◆ isStationary()

bool bpp::CategorySubstitutionRegister::isStationary ( ) const
inline

Definition at line 179 of file CategorySubstitutionRegister.h.

References stationarity_.

◆ setAlphabetCategories()

template<class T >
void bpp::CategorySubstitutionRegister::setAlphabetCategories ( const std::map< int, T > &  categories)
inlineprotected

◆ setModelCategories()

template<class T >
void bpp::CategorySubstitutionRegister::setModelCategories ( const std::map< size_t, T > &  categories)
inlineprotected

◆ setStationarity()

void bpp::CategorySubstitutionRegister::setStationarity ( bool  stat)
inline

◆ stateMap()

Member Data Documentation

◆ categories_

std::map<size_t, size_t> bpp::CategorySubstitutionRegister::categories_
mutableprotected

◆ categoryNames_

std::vector<std::string> bpp::CategorySubstitutionRegister::categoryNames_
protected

Definition at line 32 of file CategorySubstitutionRegister.h.

Referenced by getCategoryName(), and setModelCategories().

◆ index_

std::vector< std::vector<size_t> > bpp::CategorySubstitutionRegister::index_
protected

◆ name_

std::string bpp::AbstractSubstitutionRegister::name_
protectedinherited

◆ nbCategories_

size_t bpp::CategorySubstitutionRegister::nbCategories_
protected

◆ revIndex_

std::vector< std::vector<size_t> > bpp::CategorySubstitutionRegister::revIndex_
protected

◆ stateMap_

◆ stationarity_

bool bpp::CategorySubstitutionRegister::stationarity_
protected

Definition at line 36 of file CategorySubstitutionRegister.h.

Referenced by isStationary(), and setStationarity().

◆ within_

bool bpp::CategorySubstitutionRegister::within_
protected

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