bpp-phyl  2.2.0
bpp::OneJumpSubstitutionCount Class Reference

Computes the probability that at least one jump occured on a branch, given the initial and final state. More...

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

+ Inheritance diagram for bpp::OneJumpSubstitutionCount:
+ Collaboration diagram for bpp::OneJumpSubstitutionCount:

Public Member Functions

 OneJumpSubstitutionCount (const SubstitutionModel *model)
 
 OneJumpSubstitutionCount (const OneJumpSubstitutionCount &ojsc)
 
OneJumpSubstitutionCountoperator= (const OneJumpSubstitutionCount &ojsc)
 
virtual ~OneJumpSubstitutionCount ()
 
virtual OneJumpSubstitutionCountclone () const
 
double getNumberOfSubstitutions (size_t initialState, size_t finalState, double length, size_t type=1) const
 Get the number of susbstitutions on a branch, given the initial and final states, and the branch length. More...
 
Matrix< double > * getAllNumbersOfSubstitutions (double length, size_t type=1) const
 Get the numbers of susbstitutions on a branch, for each initial and final states, and given the branch length. More...
 
std::vector< double > getNumberOfSubstitutionsForEachType (size_t initialState, size_t finalState, double length) const
 Get the numbers of susbstitutions on a branch for all types, for an initial and final states, given the branch length. More...
 
void setSubstitutionModel (const SubstitutionModel *model)
 Set the substitution model associated with this count, if relevent. More...
 
void setSubstitutionRegister (SubstitutionRegister *reg) throw (Exception)
 
bool hasSubstitutionRegister () const
 
const SubstitutionRegistergetSubstitutionRegister () const
 
SubstitutionRegistergetSubstitutionRegister ()
 
virtual size_t getNumberOfSubstitutionTypes () const
 Short cut function, equivalent to getSubstitutionRegister().getNumberOfSubstitutionTypes(). More...
 
virtual const Alphabet * getAlphabet () 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::auto_ptr< SubstitutionRegisterregister_
 

Private Member Functions

void substitutionRegisterHasChanged ()
 

Private Attributes

const SubstitutionModelmodel_
 
RowMatrix< double > tmp_
 

Detailed Description

Computes the probability that at least one jump occured on a branch, given the initial and final state.

This probability is defined as

\[ p_{x,y}(l) = \left\{\begin{array}{ll}1 & \mathrm{if} x \neq y \\ 1 - \exp{\left(Q \cdot t\right)}_{x,y} & \mathrm{otherwise.}\end{array}\right. \]

Author
Julien Dutheil

Definition at line 59 of file OneJumpSubstitutionCount.h.

Constructor & Destructor Documentation

◆ OneJumpSubstitutionCount() [1/2]

bpp::OneJumpSubstitutionCount::OneJumpSubstitutionCount ( const SubstitutionModel model)
inline

Definition at line 67 of file OneJumpSubstitutionCount.h.

Referenced by clone().

◆ OneJumpSubstitutionCount() [2/2]

bpp::OneJumpSubstitutionCount::OneJumpSubstitutionCount ( const OneJumpSubstitutionCount ojsc)
inline

Definition at line 71 of file OneJumpSubstitutionCount.h.

◆ ~OneJumpSubstitutionCount()

virtual bpp::OneJumpSubstitutionCount::~OneJumpSubstitutionCount ( )
inlinevirtual

Definition at line 83 of file OneJumpSubstitutionCount.h.

Member Function Documentation

◆ clone()

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

Implements bpp::SubstitutionCount.

Definition at line 85 of file OneJumpSubstitutionCount.h.

References OneJumpSubstitutionCount().

◆ getAllNumbersOfSubstitutions()

Matrix< double > * OneJumpSubstitutionCount::getAllNumbersOfSubstitutions ( double  length,
size_t  type = 1 
) const
virtual

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::SubstitutionCount.

Definition at line 44 of file OneJumpSubstitutionCount.cpp.

References bpp::SubstitutionModel::getNumberOfStates(), bpp::SubstitutionModel::getPij_t(), model_, and tmp_.

◆ getAlphabet()

virtual const Alphabet* bpp::SubstitutionCount::getAlphabet ( ) const
inlinevirtualinherited

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

Returns
The alphabet associated to this substitution count.

Definition at line 112 of file SubstitutionCount.h.

References bpp::SubstitutionRegister::getAlphabet(), and bpp::SubstitutionCount::getSubstitutionRegister().

◆ getNumberOfStates()

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

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

Returns
The number of states in the model/alphabet.

Definition at line 119 of file SubstitutionCount.h.

References bpp::SubstitutionRegister::getAlphabet(), and bpp::SubstitutionCount::getSubstitutionRegister().

◆ getNumberOfSubstitutions()

double bpp::OneJumpSubstitutionCount::getNumberOfSubstitutions ( size_t  initialState,
size_t  finalState,
double  length,
size_t  type = 1 
) const
inlinevirtual

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::SubstitutionCount.

Definition at line 88 of file OneJumpSubstitutionCount.h.

References model_, and bpp::SubstitutionModel::Pij_t().

Referenced by getNumberOfSubstitutionsForEachType().

◆ getNumberOfSubstitutionsForEachType()

std::vector<double> bpp::OneJumpSubstitutionCount::getNumberOfSubstitutionsForEachType ( size_t  initialState,
size_t  finalState,
double  length 
) const
inlinevirtual

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::SubstitutionCount.

Definition at line 96 of file OneJumpSubstitutionCount.h.

References getNumberOfSubstitutions().

◆ getNumberOfSubstitutionTypes()

◆ getSubstitutionRegister() [1/2]

const SubstitutionRegister* 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::SubstitutionCount.

Definition at line 206 of file SubstitutionCount.h.

References bpp::AbstractSubstitutionCount::register_.

◆ getSubstitutionRegister() [2/2]

SubstitutionRegister* bpp::AbstractSubstitutionCount::getSubstitutionRegister ( )
inlinevirtualinherited
Returns
The SubstitutionRegister object associated to this instance. The register contains the description of the various substitutions types that are mapped.

Implements bpp::SubstitutionCount.

Definition at line 208 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::SubstitutionCount.

Definition at line 192 of file SubstitutionCount.h.

References bpp::AbstractSubstitutionCount::register_.

◆ operator=()

OneJumpSubstitutionCount& bpp::OneJumpSubstitutionCount::operator= ( const OneJumpSubstitutionCount ojsc)
inline

◆ setSubstitutionModel()

void bpp::OneJumpSubstitutionCount::setSubstitutionModel ( const SubstitutionModel model)
inlinevirtual

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

Parameters
modelThe substitution model to use with this count.

Implements bpp::SubstitutionCount.

Definition at line 103 of file OneJumpSubstitutionCount.h.

References model_.

◆ setSubstitutionRegister()

void bpp::OneJumpSubstitutionCount::setSubstitutionRegister ( SubstitutionRegister reg)
throw (Exception
)
inlinevirtual
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::SubstitutionCount.

Definition at line 110 of file OneJumpSubstitutionCount.h.

◆ substitutionRegisterHasChanged()

void bpp::OneJumpSubstitutionCount::substitutionRegisterHasChanged ( )
inlineprivatevirtual

Implements bpp::AbstractSubstitutionCount.

Definition at line 115 of file OneJumpSubstitutionCount.h.

Member Data Documentation

◆ model_

const SubstitutionModel* bpp::OneJumpSubstitutionCount::model_
private

◆ register_

◆ tmp_

RowMatrix<double> bpp::OneJumpSubstitutionCount::tmp_
mutableprivate

Definition at line 64 of file OneJumpSubstitutionCount.h.

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


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