bpp-phyl3  3.0.0
bpp::LabelSubstitutionCount Class Reference

Labelling substitution count. More...

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

+ Inheritance diagram for bpp::LabelSubstitutionCount:
+ Collaboration diagram for bpp::LabelSubstitutionCount:

Public Member Functions

 LabelSubstitutionCount (std::shared_ptr< const SubstitutionModelInterface > model)
 
 LabelSubstitutionCount (std::shared_ptr< const StateMapInterface > statemap)
 
virtual ~LabelSubstitutionCount ()
 
LabelSubstitutionCountclone () const override
 
double getNumberOfSubstitutions (size_t initialState, size_t finalState, double length, size_t type=1) const override
 Get the number of susbstitutions on a branch, given the initial and final states, and the branch length. More...
 
std::unique_ptr< Matrix< double > > getAllNumbersOfSubstitutions (double length, size_t type=1) const override
 Get the numbers of susbstitutions on a branch, for each initial and final states, and given the branch length. More...
 
void storeAllNumbersOfSubstitutions (double length, size_t type, Eigen::MatrixXd &mat) const override
 Stores the numbers of susbstitutions on a branch, for each initial and final states, and given the branch length. More...
 
std::vector< double > getNumberOfSubstitutionsPerType (size_t initialState, size_t finalState, double length) const override
 Get the numbers of susbstitutions on a branch for all types, for an initial and final states, given the branch length. More...
 
void setSubstitutionModel (std::shared_ptr< const SubstitutionModelInterface > model) override
 Set the substitution model associated with this count, if relevant. More...
 
void setSubstitutionRegister (std::shared_ptr< const SubstitutionRegisterInterface > reg) override
 
bool hasSubstitutionRegister () const
 
std::shared_ptr< const SubstitutionRegisterInterfacegetSubstitutionRegister () const
 
virtual size_t getNumberOfSubstitutionTypes () const
 Short cut function, equivalent to getSubstitutionRegister().getNumberOfSubstitutionTypes(). More...
 
virtual std::shared_ptr< const AlphabetgetAlphabet () const
 Short cut function, equivalent to getSubstitutionRegister()->getAlphabet(). More...
 
virtual size_t getNumberOfStates () const
 Short cut function, equivalent to getSubstitutionRegister()->getAlphabet()->getSize(). More...
 

Protected Attributes

std::shared_ptr< const SubstitutionRegisterInterfaceregister_
 

Private Member Functions

void substitutionRegisterHasChanged () override
 

Private Attributes

LinearMatrix< double > label_
 
std::vector< int > supportedChars_
 

Detailed Description

Labelling substitution count.

This substitution count return a distinct number for each possible mutation.

  • 0 if $i = j$,
  • $a(i,j)$ if $i \neq j $, where 'a' is an index giving a unique value for each combination of i and j.

Definition at line 119 of file NaiveSubstitutionCount.h.

Constructor & Destructor Documentation

◆ LabelSubstitutionCount() [1/2]

LabelSubstitutionCount::LabelSubstitutionCount ( std::shared_ptr< const SubstitutionModelInterface model)

Definition at line 39 of file NaiveSubstitutionCount.cpp.

References count(), label_, and supportedChars_.

Referenced by clone().

◆ LabelSubstitutionCount() [2/2]

LabelSubstitutionCount::LabelSubstitutionCount ( std::shared_ptr< const StateMapInterface statemap)

Definition at line 60 of file NaiveSubstitutionCount.cpp.

References count(), label_, and supportedChars_.

◆ ~LabelSubstitutionCount()

virtual bpp::LabelSubstitutionCount::~LabelSubstitutionCount ( )
inlinevirtual

Definition at line 131 of file NaiveSubstitutionCount.h.

Member Function Documentation

◆ clone()

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

Implements bpp::SubstitutionCountInterface.

Definition at line 133 of file NaiveSubstitutionCount.h.

References LabelSubstitutionCount().

◆ getAllNumbersOfSubstitutions()

std::unique_ptr< Matrix<double> > bpp::LabelSubstitutionCount::getAllNumbersOfSubstitutions ( double  length,
size_t  type = 1 
) const
inlineoverridevirtual

Get the numbers of susbstitutions on a branch, for each initial and final states, and given the branch length.

Parameters
lengthThe length of the branch.
typeThe type of susbstitution to count.
Returns
A matrix with all numbers of substitutions for each initial and final states.

Implements bpp::SubstitutionCountInterface.

Definition at line 141 of file NaiveSubstitutionCount.h.

References bpp::LinearMatrix< class >::clone(), and label_.

◆ getAlphabet()

virtual std::shared_ptr<const Alphabet> bpp::SubstitutionCountInterface::getAlphabet ( ) const
inlinevirtualinherited

Short cut function, equivalent to getSubstitutionRegister()->getAlphabet().

Returns
The alphabet associated to this substitution count.

Definition at line 78 of file SubstitutionCount.h.

References bpp::SubstitutionCountInterface::getSubstitutionRegister().

◆ getNumberOfStates()

virtual size_t bpp::SubstitutionCountInterface::getNumberOfStates ( ) const
inlinevirtualinherited

Short cut function, equivalent to getSubstitutionRegister()->getAlphabet()->getSize().

Returns
The number of states in the model/alphabet.

Definition at line 85 of file SubstitutionCount.h.

References bpp::SubstitutionCountInterface::getSubstitutionRegister().

◆ getNumberOfSubstitutions()

double bpp::LabelSubstitutionCount::getNumberOfSubstitutions ( size_t  initialState,
size_t  finalState,
double  length,
size_t  type = 1 
) const
inlineoverridevirtual

Get the number of susbstitutions on a branch, given the initial and final states, and the branch length.

Parameters
initialStateThe initial state.
finalStateThe final state.
lengthThe length of the branch.
typeThe type of substitution to count.
Returns
The number of substitutions on a branch of specified length and according to initial and final states.

Implements bpp::SubstitutionCountInterface.

Definition at line 136 of file NaiveSubstitutionCount.h.

References label_.

◆ getNumberOfSubstitutionsPerType()

std::vector<double> bpp::LabelSubstitutionCount::getNumberOfSubstitutionsPerType ( size_t  initialState,
size_t  finalState,
double  length 
) const
inlineoverridevirtual

Get the numbers of susbstitutions on a branch for all types, for an initial and final states, given the branch length.

Parameters
initialStateThe initial state.
finalStateThe final state.
lengthThe length of the branch.
Returns
A matrix with all numbers of substitutions for each initial and final states.

Implements bpp::SubstitutionCountInterface.

Definition at line 162 of file NaiveSubstitutionCount.h.

References label_.

◆ getNumberOfSubstitutionTypes()

virtual size_t bpp::SubstitutionCountInterface::getNumberOfSubstitutionTypes ( ) const
inlinevirtualinherited

◆ getSubstitutionRegister()

std::shared_ptr<const SubstitutionRegisterInterface> bpp::AbstractSubstitutionCount::getSubstitutionRegister ( ) const
inlinevirtualinherited
Returns
The SubstitutionRegister object associated to this instance. The register contains the description of the various substitutions types that are mapped.

Implements bpp::SubstitutionCountInterface.

Definition at line 170 of file SubstitutionCount.h.

References bpp::AbstractSubstitutionCount::register_.

◆ hasSubstitutionRegister()

bool bpp::AbstractSubstitutionCount::hasSubstitutionRegister ( ) const
inlinevirtualinherited
Returns
Tell if a substitution register has been attached to this class.

Implements bpp::SubstitutionCountInterface.

Definition at line 156 of file SubstitutionCount.h.

References bpp::AbstractSubstitutionCount::register_.

◆ setSubstitutionModel()

void bpp::LabelSubstitutionCount::setSubstitutionModel ( std::shared_ptr< const SubstitutionModelInterface model)
inlineoverridevirtual

Set the substitution model associated with this count, if relevant.

Parameters
modelThe substitution model to use with this count.

Implements bpp::SubstitutionCountInterface.

Definition at line 169 of file NaiveSubstitutionCount.h.

References supportedChars_.

◆ setSubstitutionRegister()

void bpp::LabelSubstitutionCount::setSubstitutionRegister ( std::shared_ptr< const SubstitutionRegisterInterface reg)
inlineoverridevirtual
Parameters
regThe new SubstitutionRegister object to be associated to this instance. The register contains the description of the various substitutions types that are mapped.

Implements bpp::SubstitutionCountInterface.

Definition at line 175 of file NaiveSubstitutionCount.h.

◆ storeAllNumbersOfSubstitutions()

void bpp::LabelSubstitutionCount::storeAllNumbersOfSubstitutions ( double  length,
size_t  type,
Eigen::MatrixXd &  mat 
) const
inlineoverridevirtual

Stores the numbers of susbstitutions on a branch, for each initial and final states, and given the branch length.

Parameters
lengthThe length of the branch.
typeThe type of susbstitution to count.
matThe matrix filled with all numbers of substitutions for each initial and final states.

Implements bpp::SubstitutionCountInterface.

Definition at line 146 of file NaiveSubstitutionCount.h.

References label_, and supportedChars_.

◆ substitutionRegisterHasChanged()

void bpp::LabelSubstitutionCount::substitutionRegisterHasChanged ( )
inlineoverrideprivatevirtual

Implements bpp::AbstractSubstitutionCount.

Definition at line 181 of file NaiveSubstitutionCount.h.

Member Data Documentation

◆ label_

◆ register_

◆ supportedChars_

std::vector<int> bpp::LabelSubstitutionCount::supportedChars_
private

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