bpp-phyl3  3.0.0
bpp::GeneralSubstitutionRegister Class Reference

Sets a Register based on a matrix of integers. If M is the matrix, M[i,j] is the number of the substitution type from i to j, or 0 if there is no substitution type from i to j. More...

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

+ Inheritance diagram for bpp::GeneralSubstitutionRegister:
+ Collaboration diagram for bpp::GeneralSubstitutionRegister:

Public Member Functions

 GeneralSubstitutionRegister (std::shared_ptr< const StateMapInterface > stateMap)
 
 GeneralSubstitutionRegister (std::shared_ptr< const StateMapInterface > stateMap, const RowMatrix< size_t > &matrix)
 
 GeneralSubstitutionRegister (const GeneralSubstitutionRegister &gsr)
 
GeneralSubstitutionRegisteroperator= (const GeneralSubstitutionRegister &gsr)
 
GeneralSubstitutionRegisterclone () const override
 
virtual ~GeneralSubstitutionRegister ()
 
size_t getType (size_t i, size_t j) const override
 Get the substitution type far a given pair of model states. More...
 
size_t getNumberOfSubstitutionTypes () const override
 
std::string getTypeName (size_t type) const override
 names of the types are their number. 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...
 

Protected Member Functions

void updateTypes_ ()
 

Protected Attributes

size_t size_
 The size of the matrix, i.e. the number of states. More...
 
RowMatrix< size_t > matrix_
 The matrix of the substitution register. More...
 
std::map< size_t, std::map< size_t, std::vector< size_t > > > types_
 The map from substitution types to the map of from states to the vector of target states. More...
 
std::shared_ptr< const StateMapInterfacestateMap_
 
std::string name_
 

Detailed Description

Sets a Register based on a matrix of integers. If M is the matrix, M[i,j] is the number of the substitution type from i to j, or 0 if there is no substitution type from i to j.

Author
Laurent Guéguen

Definition at line 385 of file SubstitutionRegister.h.

Constructor & Destructor Documentation

◆ GeneralSubstitutionRegister() [1/3]

bpp::GeneralSubstitutionRegister::GeneralSubstitutionRegister ( std::shared_ptr< const StateMapInterface stateMap)
inline

Definition at line 408 of file SubstitutionRegister.h.

Referenced by clone().

◆ GeneralSubstitutionRegister() [2/3]

bpp::GeneralSubstitutionRegister::GeneralSubstitutionRegister ( std::shared_ptr< const StateMapInterface stateMap,
const RowMatrix< size_t > &  matrix 
)
inline

◆ GeneralSubstitutionRegister() [3/3]

bpp::GeneralSubstitutionRegister::GeneralSubstitutionRegister ( const GeneralSubstitutionRegister gsr)
inline

Definition at line 428 of file SubstitutionRegister.h.

◆ ~GeneralSubstitutionRegister()

virtual bpp::GeneralSubstitutionRegister::~GeneralSubstitutionRegister ( )
inlinevirtual

Definition at line 449 of file SubstitutionRegister.h.

Member Function Documentation

◆ 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()

GeneralSubstitutionRegister* bpp::GeneralSubstitutionRegister::clone ( ) const
inlineoverridevirtual

◆ 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_.

◆ 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_.

◆ getNumberOfSubstitutionTypes()

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

Implements bpp::SubstitutionRegisterInterface.

Definition at line 456 of file SubstitutionRegister.h.

References types_.

◆ 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()

size_t bpp::GeneralSubstitutionRegister::getType ( size_t  fromState,
size_t  toState 
) const
inlineoverridevirtual

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.

Definition at line 451 of file SubstitutionRegister.h.

References matrix_.

◆ getTypeName()

std::string bpp::GeneralSubstitutionRegister::getTypeName ( size_t  type) const
inlineoverridevirtual

◆ operator=()

◆ stateMap()

◆ updateTypes_()

Member Data Documentation

◆ matrix_

◆ name_

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

◆ size_

size_t bpp::GeneralSubstitutionRegister::size_
protected

The size of the matrix, i.e. the number of states.

Definition at line 392 of file SubstitutionRegister.h.

Referenced by GeneralSubstitutionRegister(), and operator=().

◆ stateMap_

◆ types_

std::map<size_t, std::map<size_t, std::vector<size_t> > > bpp::GeneralSubstitutionRegister::types_
protected

The map from substitution types to the map of from states to the vector of target states.

This is the reverse information of matrix_

Definition at line 405 of file SubstitutionRegister.h.

Referenced by getNumberOfSubstitutionTypes(), bpp::SelectedSubstitutionRegister::getTypeName(), bpp::AAInteriorSubstitutionRegister::getTypeName(), bpp::AAExteriorSubstitutionRegister::getTypeName(), getTypeName(), and operator=().


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