bpp-phyl3  3.0.0
bpp::MarkovModulatedStateMap Class Reference

This class implements a state map for Markov modulated models. More...

#include <Bpp/Phyl/Model/StateMap.h>

+ Inheritance diagram for bpp::MarkovModulatedStateMap:
+ Collaboration diagram for bpp::MarkovModulatedStateMap:

Public Member Functions

 MarkovModulatedStateMap (const StateMapInterface &unitMap, unsigned int nbClasses)
 
virtual MarkovModulatedStateMapclone () const
 
virtual std::string getStateDescription (size_t index) const
 
const Alphabetalphabet () const override
 
std::shared_ptr< const AlphabetgetAlphabet () const override
 
size_t getNumberOfModelStates () const override
 
const std::vector< int > & getAlphabetStates () const override
 
int getAlphabetStateAsInt (size_t index) const override
 
std::string getAlphabetStateAsChar (size_t index) const override
 
std::vector< size_t > getModelStates (int code) const override
 
std::vector< size_t > getModelStates (const std::string &code) const override
 
bool operator== (const StateMapInterface &sm) const override
 Comparison operator==. More...
 
bool operator!= (const StateMapInterface &sm) const override
 Comparison operator!=. More...
 

Protected Attributes

std::shared_ptr< const Alphabetalphabet_
 
std::vector< int > states_
 

Private Attributes

unsigned int nbClasses_
 

Detailed Description

This class implements a state map for Markov modulated models.

For nucleotides with two classes, the underlying states are for instance: A (0), C (1), G (2), T/U (3), A (4), C (5), G (6), T/U (7).

Definition at line 190 of file StateMap.h.

Constructor & Destructor Documentation

◆ MarkovModulatedStateMap()

MarkovModulatedStateMap::MarkovModulatedStateMap ( const StateMapInterface unitMap,
unsigned int  nbClasses 
)

Member Function Documentation

◆ alphabet()

const Alphabet& bpp::AbstractStateMap::alphabet ( ) const
inlineoverridevirtualinherited
Returns
The associated alphabet.

Implements bpp::StateMapInterface.

Definition at line 130 of file StateMap.h.

References bpp::AbstractStateMap::alphabet_.

Referenced by bpp::CanonicalStateMap::CanonicalStateMap().

◆ clone()

virtual MarkovModulatedStateMap* bpp::MarkovModulatedStateMap::clone ( ) const
inlinevirtual

Implements bpp::StateMapInterface.

Definition at line 198 of file StateMap.h.

References MarkovModulatedStateMap().

◆ getAlphabet()

std::shared_ptr<const Alphabet> bpp::AbstractStateMap::getAlphabet ( ) const
inlineoverridevirtualinherited
Returns
A shared_ptr towards the associated alphabet.

Implements bpp::StateMapInterface.

Definition at line 131 of file StateMap.h.

References bpp::AbstractStateMap::alphabet_.

◆ getAlphabetStateAsChar()

std::string bpp::AbstractStateMap::getAlphabetStateAsChar ( size_t  index) const
inlineoverridevirtualinherited
Parameters
indexThe model state.
Returns
The corresponding alphabet state as character code.

Implements bpp::StateMapInterface.

Definition at line 135 of file StateMap.h.

References bpp::AbstractStateMap::alphabet_, and bpp::AbstractStateMap::states_.

Referenced by bpp::CanonicalStateMap::getStateDescription(), and getStateDescription().

◆ getAlphabetStateAsInt()

int bpp::AbstractStateMap::getAlphabetStateAsInt ( size_t  index) const
inlineoverridevirtualinherited
Parameters
indexThe model state.
Returns
The corresponding alphabet state as int code.

Implements bpp::StateMapInterface.

Definition at line 134 of file StateMap.h.

References bpp::AbstractStateMap::states_.

◆ getAlphabetStates()

const std::vector<int>& bpp::AbstractStateMap::getAlphabetStates ( ) const
inlineoverridevirtualinherited
Returns
A vector with the corresponding alphabet states for each model state. the size of the vector is the number of model states, not the number of supported alphabet states, as distinct model states can correspond to a single alphabet state.

Implements bpp::StateMapInterface.

Definition at line 133 of file StateMap.h.

References bpp::AbstractStateMap::states_.

◆ getModelStates() [1/2]

std::vector<size_t> bpp::AbstractStateMap::getModelStates ( const std::string &  code) const
inlineoverridevirtualinherited
Parameters
codeThe character code of the alphabet state to check.
Returns
The corresponding model states, is any.

Implements bpp::StateMapInterface.

Definition at line 140 of file StateMap.h.

References bpp::AbstractStateMap::alphabet_, bpp::AbstractStateMap::states_, and bpp::VectorTools::whichAll().

◆ getModelStates() [2/2]

std::vector<size_t> bpp::AbstractStateMap::getModelStates ( int  code) const
inlineoverridevirtualinherited
Parameters
codeThe int code of the alphabet state to check.
Returns
The corresponding model states, is any.

Implements bpp::StateMapInterface.

Definition at line 136 of file StateMap.h.

References bpp::AbstractStateMap::states_, and bpp::VectorTools::whichAll().

◆ getNumberOfModelStates()

size_t bpp::AbstractStateMap::getNumberOfModelStates ( ) const
inlineoverridevirtualinherited
Returns
The number of states supported by the model.

Implements bpp::StateMapInterface.

Definition at line 132 of file StateMap.h.

References bpp::AbstractStateMap::states_.

◆ getStateDescription()

virtual std::string bpp::MarkovModulatedStateMap::getStateDescription ( size_t  index) const
inlinevirtual
Returns
A string describing the model state.
Parameters
indexThe state index.

Implements bpp::StateMapInterface.

Definition at line 200 of file StateMap.h.

References bpp::AbstractStateMap::getAlphabetStateAsChar(), nbClasses_, and bpp::TextTools::toString().

◆ operator!=()

bool bpp::AbstractStateMap::operator!= ( const StateMapInterface sm) const
inlineoverridevirtualinherited

Comparison operator!=.

Two StateMaps are not identical if they do not share the same alphabet or states.

Implements bpp::StateMapInterface.

Definition at line 152 of file StateMap.h.

References bpp::StateMapInterface::alphabet(), bpp::AbstractStateMap::alphabet_, bpp::StateMapInterface::getAlphabetStates(), bpp::Alphabet::getAlphabetType(), and bpp::AbstractStateMap::states_.

◆ operator==()

bool bpp::AbstractStateMap::operator== ( const StateMapInterface sm) const
inlineoverridevirtualinherited

Comparison operator==.

Two StateMaps are identical if they share the same alphabet and states.

Implements bpp::StateMapInterface.

Definition at line 145 of file StateMap.h.

References bpp::StateMapInterface::alphabet(), bpp::AbstractStateMap::alphabet_, bpp::StateMapInterface::getAlphabetStates(), bpp::Alphabet::getAlphabetType(), and bpp::AbstractStateMap::states_.

Member Data Documentation

◆ alphabet_

◆ nbClasses_

unsigned int bpp::MarkovModulatedStateMap::nbClasses_
private

Definition at line 194 of file StateMap.h.

Referenced by getStateDescription().

◆ states_


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