bpp-phyl3  3.0.0
bpp::LaplaceSubstitutionCount Class Reference

Laplace estimate of the substitution count. More...

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

+ Inheritance diagram for bpp::LaplaceSubstitutionCount:
+ Collaboration diagram for bpp::LaplaceSubstitutionCount:

Public Member Functions

 LaplaceSubstitutionCount (std::shared_ptr< const SubstitutionModelInterface > model, size_t cutOff)
 
 LaplaceSubstitutionCount (std::shared_ptr< const StateMapInterface > stateMap, size_t cutOff)
 
 LaplaceSubstitutionCount (const LaplaceSubstitutionCount &asc)
 
LaplaceSubstitutionCountoperator= (const LaplaceSubstitutionCount &asc)
 
virtual ~LaplaceSubstitutionCount ()
 
LaplaceSubstitutionCountclone () 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 Member Functions

void computeCounts (double length) const
 
void substitutionRegisterHasChanged () override
 

Protected Attributes

std::shared_ptr< const SubstitutionRegisterInterfaceregister_
 

Private Attributes

std::shared_ptr< const SubstitutionModelInterfacemodel_
 
size_t cutOff_
 
double currentLength_
 
RowMatrix< double > m_
 

Detailed Description

Laplace estimate of the substitution count.

This method uses Laplace transforms, as described in Dutheil J, Pupko T, Jean-Marie A, Galtier N. A model-based approach for detecting coevolving positions in a molecule. Mol Biol Evol. 2005 Sep;22(9):1919-28.

See also
UniformizationSubstitutionCount
DecompositionSubstitutionCount
Author
Julien Dutheil

Definition at line 26 of file LaplaceSubstitutionCount.h.

Constructor & Destructor Documentation

◆ LaplaceSubstitutionCount() [1/3]

bpp::LaplaceSubstitutionCount::LaplaceSubstitutionCount ( std::shared_ptr< const SubstitutionModelInterface model,
size_t  cutOff 
)
inline

Definition at line 36 of file LaplaceSubstitutionCount.h.

Referenced by clone().

◆ LaplaceSubstitutionCount() [2/3]

bpp::LaplaceSubstitutionCount::LaplaceSubstitutionCount ( std::shared_ptr< const StateMapInterface stateMap,
size_t  cutOff 
)
inline

Definition at line 46 of file LaplaceSubstitutionCount.h.

◆ LaplaceSubstitutionCount() [3/3]

bpp::LaplaceSubstitutionCount::LaplaceSubstitutionCount ( const LaplaceSubstitutionCount asc)
inline

Definition at line 54 of file LaplaceSubstitutionCount.h.

◆ ~LaplaceSubstitutionCount()

virtual bpp::LaplaceSubstitutionCount::~LaplaceSubstitutionCount ( )
inlinevirtual

Definition at line 72 of file LaplaceSubstitutionCount.h.

Member Function Documentation

◆ clone()

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

Implements bpp::SubstitutionCountInterface.

Definition at line 74 of file LaplaceSubstitutionCount.h.

References LaplaceSubstitutionCount().

◆ computeCounts()

◆ getAllNumbersOfSubstitutions()

unique_ptr< Matrix< double > > LaplaceSubstitutionCount::getAllNumbersOfSubstitutions ( double  length,
size_t  type = 1 
) const
overridevirtual

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 79 of file LaplaceSubstitutionCount.cpp.

◆ 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 LaplaceSubstitutionCount::getNumberOfSubstitutions ( size_t  initialState,
size_t  finalState,
double  length,
size_t  type = 1 
) const
overridevirtual

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 61 of file LaplaceSubstitutionCount.cpp.

Referenced by getNumberOfSubstitutionsPerType().

◆ getNumberOfSubstitutionsPerType()

std::vector<double> bpp::LaplaceSubstitutionCount::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 83 of file LaplaceSubstitutionCount.h.

References getNumberOfSubstitutions().

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

◆ operator=()

LaplaceSubstitutionCount& bpp::LaplaceSubstitutionCount::operator= ( const LaplaceSubstitutionCount asc)
inline

Definition at line 62 of file LaplaceSubstitutionCount.h.

References currentLength_, cutOff_, m_, and model_.

◆ setSubstitutionModel()

void LaplaceSubstitutionCount::setSubstitutionModel ( std::shared_ptr< const SubstitutionModelInterface model)
overridevirtual

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 150 of file LaplaceSubstitutionCount.cpp.

◆ setSubstitutionRegister()

void bpp::LaplaceSubstitutionCount::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 96 of file LaplaceSubstitutionCount.h.

◆ storeAllNumbersOfSubstitutions()

void LaplaceSubstitutionCount::storeAllNumbersOfSubstitutions ( double  length,
size_t  type,
Eigen::MatrixXd &  mat 
) const
overridevirtual

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 110 of file LaplaceSubstitutionCount.cpp.

◆ substitutionRegisterHasChanged()

void bpp::LaplaceSubstitutionCount::substitutionRegisterHasChanged ( )
inlineoverrideprotectedvirtual

Implements bpp::AbstractSubstitutionCount.

Definition at line 103 of file LaplaceSubstitutionCount.h.

Member Data Documentation

◆ currentLength_

double bpp::LaplaceSubstitutionCount::currentLength_
mutableprivate

Definition at line 32 of file LaplaceSubstitutionCount.h.

Referenced by operator=().

◆ cutOff_

size_t bpp::LaplaceSubstitutionCount::cutOff_
private

Definition at line 31 of file LaplaceSubstitutionCount.h.

Referenced by operator=().

◆ m_

RowMatrix<double> bpp::LaplaceSubstitutionCount::m_
mutableprivate

Definition at line 33 of file LaplaceSubstitutionCount.h.

Referenced by operator=().

◆ model_

std::shared_ptr<const SubstitutionModelInterface> bpp::LaplaceSubstitutionCount::model_
private

Definition at line 30 of file LaplaceSubstitutionCount.h.

Referenced by operator=().

◆ register_


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