bpp-phyl3  3.0.0
bpp::InMixedSubstitutionModel Class Referenceabstract

SubModel taken from a MixedTransitionModel, kept in the context of the MixedTransitionModel (see FromMixtureSubstitutionModel for an out of context subModel). So "rate" and "scale" are set for the MixedTransitionModel. More...

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

+ Inheritance diagram for bpp::InMixedSubstitutionModel:
+ Collaboration diagram for bpp::InMixedSubstitutionModel:

Public Member Functions

 InMixedSubstitutionModel (std::unique_ptr< MixedTransitionModelInterface > mixedModel, const std::string &subModelName, const std::string &mixtDesc)
 
 InMixedSubstitutionModel (std::unique_ptr< MixedTransitionModelInterface > mixedModel, size_t subModelNumber, const std::string &mixtDesc)
 
 InMixedSubstitutionModel (const InMixedSubstitutionModel &fmsm)
 
InMixedSubstitutionModeloperator= (const InMixedSubstitutionModel &fmsm)
 
InMixedSubstitutionModelclone () const override
 
const MixedTransitionModelInterfacemixedModel () const
 
const SubstitutionModelInterfacesubstitutionModel () const override
 
size_t getSubModelNumber () const
 
bool computeFrequencies () const override
 
void computeFrequencies (bool yn) override
 
bool isScalable () const override
 returns if model is scalable More...
 
void setScalable (bool scalable) override
 sets if model is scalable, ie scale can be changed. Default : true, set to false to avoid normalization for example. More...
 
double getScale () const override
 Get the scalar product of diagonal elements of the generator and the frequencies vector. If the generator is normalized, then scale=1. Otherwise each element must be multiplied by 1/scale. More...
 
void setScale (double scale) override
 Multiplies the current generator by the given scale. More...
 
void normalize () override
 Normalize the generator. More...
 
void setDiagonal () override
 set the diagonal of the generator such that sum on each line equals 0. More...
 
double getRate () const override
 Get the rate. More...
 
void setRate (double rate) override
 Set the rate of the model (must be positive). More...
 
void addRateParameter () override
 
std::string getName () const override
 Get the name of the model. More...
 
const TransitionModelInterfacetransitionModel () const
 
const FrequencySetInterfacefrequencySet () const override
 
const BranchModelInterfacemodel () const override
 
bool hasIndependentParameter (const std::string &name) const
 
const ParameterListgetIndependentParameters () const
 
size_t getNumberOfIndependentParameters () const
 
void aliasParameters (const std::string &p1, const std::string &p2)
 
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 
void unaliasParameters (const std::string &p1, const std::string &p2)
 
ParameterList getAliasedParameters (const ParameterList &pl) const
 
ParameterList getFromParameters (const ParameterList &pl) const
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const
 
std::string getFrom (const std::string &name) const
 
bool hasParameter (const std::string &name) const override
 
const ParameterListgetParameters () const override
 
const Parameterparameter (const std::string &name) const override
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 
double getParameterValue (const std::string &name) const override
 
void setAllParametersValues (const ParameterList &parameters) override
 
void setParameterValue (const std::string &name, double value) override
 
void setParametersValues (const ParameterList &parameters) override
 
bool matchParametersValues (const ParameterList &parameters) override
 
void removeConstraint (const std::string &name) override
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
size_t getNumberOfParameters () const override
 
std::string getNamespace () const override
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 
virtual const Eigen::VectorXd & Lik_t (const Eigen::VectorXd &values, double t) const =0
 
const Eigen::VectorXd & Lik_t (const Eigen::VectorXd &values, double t) const override
 
virtual const Eigen::VectorXd & dLik_dt (const Eigen::VectorXd &values, double t) const =0
 
const Eigen::VectorXd & dLik_dt (const Eigen::VectorXd &values, double t) const override
 
virtual const Eigen::VectorXd & d2Lik_dt2 (const Eigen::VectorXd &values, double t) const =0
 
const Eigen::VectorXd & d2Lik_dt2 (const Eigen::VectorXd &values, double t) const override
 
double freq (size_t i) const override
 
double Pij_t (size_t i, size_t j, double t) const override
 
double dPij_dt (size_t i, size_t j, double t) const override
 
double d2Pij_dt2 (size_t i, size_t j, double t) const override
 
const VdoublegetFrequencies () const override
 
const Matrix< double > & getPij_t (double t) const override
 
const Matrix< double > & getdPij_dt (double t) const override
 
const Matrix< double > & getd2Pij_dt2 (double t) const override
 
double getInitValue (size_t i, int state) const override
 
void setFreqFromData (const SequenceDataInterface &data, double pseudoCount=0) override
 Set equilibrium frequencies equal to the frequencies estimated from the data. More...
 
void setFreq (std::map< int, double > &frequencies) override
 Set equilibrium frequencies. More...
 
double Qij (size_t i, size_t j) const override
 Methods to supersede SubstitutionModel methods. More...
 
const Matrix< double > & generator () const override
 
const Matrix< double > & exchangeabilityMatrix () const override
 
double Sij (size_t i, size_t j) const override
 
void enableEigenDecomposition (bool yn) override
 Set if eigenValues and Vectors must be computed. More...
 
bool enableEigenDecomposition () override
 Tell if eigenValues and Vectors must be computed. More...
 
bool isDiagonalizable () const override
 
bool isNonSingular () const override
 
const VdoublegetEigenValues () const override
 
const VdoublegetIEigenValues () const override
 
const Matrix< double > & getRowLeftEigenVectors () const override
 
const Matrix< double > & getColumnRightEigenVectors () const override
 
void fireParameterChanged (const ParameterList &parameters) override
 Methods to supersede AbstractSubstitutionnModel methods. More...
 
void setNamespace (const std::string &name) override
 
const std::vector< int > & getAlphabetStates () const override
 
const StateMapInterfacestateMap () const override
 
std::shared_ptr< const StateMapInterfacegetStateMap () const override
 
int getAlphabetStateAsInt (size_t i) const override
 
std::string getAlphabetStateAsChar (size_t i) const override
 
std::vector< size_t > getModelStates (int code) const override
 Get the state in the model corresponding to a particular state in the alphabet. More...
 
std::vector< size_t > getModelStates (const std::string &code) const override
 Get the state in the model corresponding to a particular state in the alphabet. More...
 
const Alphabetalphabet () const override
 
std::shared_ptr< const AlphabetgetAlphabet () const override
 
size_t getNumberOfStates () const override
 Get the number of states. More...
 

Protected Member Functions

VdoublegetFrequencies_ () override
 
MixedTransitionModelInterfacemixedModel_ ()
 
SubstitutionModelInterfacesubstitutionModel_ () override
 
TransitionModelInterfacetransitionModel_ ()
 
BranchModelInterfacemodel_ ()
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
void addParameter_ (Parameter *parameter)
 
void addParameters_ (const ParameterList &parameters)
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
void shareParameters_ (const ParameterList &parameters)
 
void includeParameters_ (const ParameterList &parameters)
 
void deleteParameter_ (size_t index)
 
void deleteParameter_ (std::string &name)
 
void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 
ParameterListgetParameters_ () override
 

Private Attributes

std::unique_ptr< MixedTransitionModelInterfacemixedModelPtr_
 The MixedOfTransitionModels. More...
 
size_t subModelNumber_
 the number of the submodel More...
 
std::string mixtName_
 The name of the mixture model (for io purpose). More...
 
ParameterList independentParameters_
 
std::map< std::string, std::shared_ptr< AliasParameterListener > > aliasListenersRegister_
 
ParameterList parameters_
 
std::string prefix_
 
Eigen::VectorXd lik_
 

Detailed Description

SubModel taken from a MixedTransitionModel, kept in the context of the MixedTransitionModel (see FromMixtureSubstitutionModel for an out of context subModel). So "rate" and "scale" are set for the MixedTransitionModel.

But method getRate returns the specific rate of the subModel.

It owns the MixedTransitionModel.

It has the same parameters as the MixedTransitionModel.

Definition at line 28 of file InMixedSubstitutionModel.h.

Constructor & Destructor Documentation

◆ InMixedSubstitutionModel() [1/3]

InMixedSubstitutionModel::InMixedSubstitutionModel ( std::unique_ptr< MixedTransitionModelInterface mixedModel,
const std::string &  subModelName,
const std::string &  mixtDesc 
)

◆ InMixedSubstitutionModel() [2/3]

InMixedSubstitutionModel::InMixedSubstitutionModel ( std::unique_ptr< MixedTransitionModelInterface mixedModel,
size_t  subModelNumber,
const std::string &  mixtDesc 
)

◆ InMixedSubstitutionModel() [3/3]

InMixedSubstitutionModel::InMixedSubstitutionModel ( const InMixedSubstitutionModel fmsm)

Definition at line 51 of file InMixedSubstitutionModel.cpp.

Member Function Documentation

◆ addRateParameter()

◆ alphabet()

const Alphabet& bpp::AbstractWrappedModel::alphabet ( ) const
inlineoverridevirtualinherited

◆ clone()

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

◆ computeFrequencies() [1/2]

bool bpp::InMixedSubstitutionModel::computeFrequencies ( ) const
inlineoverridevirtual
Returns
Says if equilibrium frequencies should be computed

Implements bpp::TransitionModelInterface.

Definition at line 80 of file InMixedSubstitutionModel.h.

References bpp::TransitionModelInterface::computeFrequencies(), and mixedModel().

◆ computeFrequencies() [2/2]

void bpp::InMixedSubstitutionModel::computeFrequencies ( bool  yn)
inlineoverridevirtual
Returns
Set if equilibrium frequencies should be computed from the generator

Implements bpp::TransitionModelInterface.

Definition at line 89 of file InMixedSubstitutionModel.h.

References bpp::TransitionModelInterface::computeFrequencies(), and mixedModel_().

◆ d2Lik_dt2() [1/2]

virtual const Eigen::VectorXd& bpp::BranchModelInterface::d2Lik_dt2 ( const Eigen::VectorXd &  values,
double  t 
) const
pure virtualinherited

◆ d2Lik_dt2() [2/2]

const Eigen::VectorXd& bpp::AbstractLkTransitionModel::d2Lik_dt2 ( const Eigen::VectorXd &  values,
double  t 
) const
inlineoverridevirtualinherited

◆ d2Pij_dt2()

double bpp::InMixedSubstitutionModel::d2Pij_dt2 ( size_t  i,
size_t  j,
double  t 
) const
inlineoverridevirtual
Returns
The second order derivative of the probability of change from state i to state j with respect to time t, at time t.
See also
getd2Pij_dt2(), getStates()

Implements bpp::TransitionModelInterface.

Definition at line 120 of file InMixedSubstitutionModel.h.

References bpp::TransitionModelInterface::d2Pij_dt2(), and bpp::AbstractWrappedSubstitutionModel::transitionModel().

◆ dLik_dt() [1/2]

virtual const Eigen::VectorXd& bpp::BranchModelInterface::dLik_dt ( const Eigen::VectorXd &  values,
double  t 
) const
pure virtualinherited

◆ dLik_dt() [2/2]

const Eigen::VectorXd& bpp::AbstractLkTransitionModel::dLik_dt ( const Eigen::VectorXd &  values,
double  t 
) const
inlineoverridevirtualinherited

◆ dPij_dt()

double bpp::InMixedSubstitutionModel::dPij_dt ( size_t  i,
size_t  j,
double  t 
) const
inlineoverridevirtual
Returns
The first order derivative of the probability of change from state i to state j with respect to time t, at time t.
See also
getdPij_dt(), getStates()

Implements bpp::TransitionModelInterface.

Definition at line 119 of file InMixedSubstitutionModel.h.

References bpp::TransitionModelInterface::dPij_dt(), and bpp::AbstractWrappedSubstitutionModel::transitionModel().

◆ enableEigenDecomposition() [1/2]

bool bpp::InMixedSubstitutionModel::enableEigenDecomposition ( )
inlineoverridevirtual

Tell if eigenValues and Vectors must be computed.

Implements bpp::SubstitutionModelInterface.

Definition at line 160 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::enableEigenDecomposition(), and substitutionModel_().

◆ enableEigenDecomposition() [2/2]

void bpp::InMixedSubstitutionModel::enableEigenDecomposition ( bool  yn)
inlineoverridevirtual

Set if eigenValues and Vectors must be computed.

Implements bpp::SubstitutionModelInterface.

Definition at line 158 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::enableEigenDecomposition(), and substitutionModel_().

◆ exchangeabilityMatrix()

const Matrix<double>& bpp::InMixedSubstitutionModel::exchangeabilityMatrix ( ) const
inlineoverridevirtual
Returns
The matrix of exchangeability terms. It is recommended that exchangeability matrix be normalized so that the normalized generator be obtained directly by the dot product $S . \pi$.

Implements bpp::SubstitutionModelInterface.

Definition at line 154 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::exchangeabilityMatrix(), and substitutionModel().

◆ fireParameterChanged()

void bpp::InMixedSubstitutionModel::fireParameterChanged ( const ParameterList parameters)
inlineoverridevirtual

Methods to supersede AbstractSubstitutionnModel methods.

Tells the model that a parameter value has changed.

This updates the matrices consequently.

Reimplemented from bpp::AbstractParameterAliasable.

Definition at line 235 of file InMixedSubstitutionModel.h.

References bpp::ParameterAliasable::matchParametersValues(), and mixedModel_().

◆ freq()

double bpp::InMixedSubstitutionModel::freq ( size_t  i) const
inlineoverridevirtual

@ brief Methods to supersede WrappedSubstitutionModel methods.

Implements bpp::TransitionModelInterface.

Definition at line 116 of file InMixedSubstitutionModel.h.

References bpp::TransitionModelInterface::freq(), and bpp::AbstractWrappedSubstitutionModel::transitionModel().

◆ frequencySet()

const FrequencySetInterface& bpp::AbstractWrappedTransitionModel::frequencySet ( ) const
inlineoverridevirtualinherited
Returns
Get the FrequencySet of equilibrium of this model.
Exceptions
Exceptionif no FrequenceSet is associated to this model.

Reimplemented from bpp::AbstractWrappedModel.

Reimplemented in bpp::RegisterRatesSubstitutionModel, bpp::OneChangeTransitionModel, bpp::OneChangeRegisterTransitionModel, and bpp::YN98.

Definition at line 93 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::frequencySet(), and bpp::WrappedTransitionModelInterface::transitionModel().

Referenced by bpp::RegisterRatesSubstitutionModel::frequencySet().

◆ generator()

const Matrix<double>& bpp::InMixedSubstitutionModel::generator ( ) const
inlineoverridevirtual
Returns
The normalized Markov generator matrix, i.e. all normalized rates of changes from state i to state j. The generator is normalized so that (i) $ \forall i; \sum_j Q_{i,j} = 0 $, meaning that $ $ \forall i; Q_{i,i} = -\sum_{j \neq i}Q_{i,j}$, and (ii) $ \sum_i Q_{i,i} \times \pi_i = -1$. This means that, under normalization, the mean rate of replacement at equilibrium is 1 and that time $t$ are measured in units of expected number of changes per site. Additionally, the rate_ attribute provides the possibility to increase or decrease this mean rate.

See Kosiol and Goldman (2005), Molecular Biology And Evolution 22(2) 193-9.

See also
Qij()

Implements bpp::SubstitutionModelInterface.

Definition at line 152 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::generator(), and substitutionModel().

◆ getAlphabet()

std::shared_ptr<const Alphabet> bpp::AbstractWrappedModel::getAlphabet ( ) const
inlineoverridevirtualinherited

◆ getAlphabetStateAsChar()

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

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 46 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getAlphabetStateAsChar(), and bpp::WrappedModelInterface::model().

Referenced by bpp::RegisterRatesSubstitutionModel::getAlphabetStateAsChar().

◆ getAlphabetStateAsInt()

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

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 44 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getAlphabetStateAsInt(), and bpp::WrappedModelInterface::model().

Referenced by bpp::RegisterRatesSubstitutionModel::getAlphabetStateAsInt().

◆ getAlphabetStates()

const std::vector<int>& bpp::AbstractWrappedModel::getAlphabetStates ( ) const
inlineoverridevirtualinherited

@ brief Methods to supersede TransitionModel methods.

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 38 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getAlphabetStates(), and bpp::WrappedModelInterface::model().

Referenced by bpp::RegisterRatesSubstitutionModel::getAlphabetStates().

◆ getColumnRightEigenVectors()

const Matrix<double>& bpp::InMixedSubstitutionModel::getColumnRightEigenVectors ( ) const
inlineoverridevirtual
Returns
A matrix with right eigen vectors. Each column in the matrix stands for an eigen vector.

Implements bpp::SubstitutionModelInterface.

Definition at line 172 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::getColumnRightEigenVectors(), and substitutionModel().

◆ getd2Pij_dt2()

const Matrix<double>& bpp::InMixedSubstitutionModel::getd2Pij_dt2 ( double  t) const
inlineoverridevirtual
Returns
All second order derivatives of the probability of change from state i to state j with respect to time t, at time t.
See also
d2Pij_dt2()

Implements bpp::TransitionModelInterface.

Definition at line 128 of file InMixedSubstitutionModel.h.

References bpp::TransitionModelInterface::getd2Pij_dt2(), and bpp::AbstractWrappedSubstitutionModel::transitionModel().

◆ getdPij_dt()

const Matrix<double>& bpp::InMixedSubstitutionModel::getdPij_dt ( double  t) const
inlineoverridevirtual
Returns
Get all first order derivatives of the probability of change from state i to state j with respect to time t, at time t.
See also
dPij_dt()

Implements bpp::TransitionModelInterface.

Definition at line 126 of file InMixedSubstitutionModel.h.

References bpp::TransitionModelInterface::getdPij_dt(), and bpp::AbstractWrappedSubstitutionModel::transitionModel().

◆ getEigenValues()

const Vdouble& bpp::InMixedSubstitutionModel::getEigenValues ( ) const
inlineoverridevirtual
Returns
A vector with all real parts of the eigen values of the generator of this model;

Implements bpp::SubstitutionModelInterface.

Definition at line 166 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::getEigenValues(), and substitutionModel().

◆ getFrequencies()

const Vdouble& bpp::InMixedSubstitutionModel::getFrequencies ( ) const
inlineoverridevirtual
Returns
A vector of all equilibrium frequencies.
See also
freq()

Implements bpp::TransitionModelInterface.

Definition at line 122 of file InMixedSubstitutionModel.h.

References bpp::TransitionModelInterface::getFrequencies(), and bpp::AbstractWrappedSubstitutionModel::transitionModel().

◆ getFrequencies_()

Vdouble& bpp::InMixedSubstitutionModel::getFrequencies_ ( )
inlineoverrideprotectedvirtual

◆ getIEigenValues()

const Vdouble& bpp::InMixedSubstitutionModel::getIEigenValues ( ) const
inlineoverridevirtual
Returns
A vector with all imaginary parts of the eigen values of the generator of this model;

Implements bpp::SubstitutionModelInterface.

Definition at line 168 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::getIEigenValues(), and substitutionModel().

◆ getInitValue()

double bpp::InMixedSubstitutionModel::getInitValue ( size_t  i,
int  state 
) const
inlineoverridevirtual

This method is used to initialize likelihoods in recursions. It typically sends 1 if i = state, 0 otherwise, where i is one of the possible states of the alphabet allowed in the model and state is the observed state in the considered sequence/site.

Parameters
ithe index of the state in the model.
stateAn observed state in the sequence/site.
Returns
1 or 0 depending if the two states are compatible.
Exceptions
IndexOutOfBoundsExceptionif array position is out of range.
BadIntExceptionif states are not allowed in the associated alphabet.
See also
getStates();

Implements bpp::BranchModelInterface.

Definition at line 130 of file InMixedSubstitutionModel.h.

References bpp::BranchModelInterface::getInitValue(), and bpp::AbstractWrappedTransitionModel::model().

◆ getModelStates() [1/2]

std::vector<size_t> bpp::AbstractWrappedModel::getModelStates ( const std::string &  code) const
inlineoverridevirtualinherited

Get the state in the model corresponding to a particular state in the alphabet.

Parameters
codeThe alphabet state to check.
Returns
A vector of indices of model states.

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 50 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getModelStates(), and bpp::WrappedModelInterface::model().

◆ getModelStates() [2/2]

std::vector<size_t> bpp::AbstractWrappedModel::getModelStates ( int  code) const
inlineoverridevirtualinherited

Get the state in the model corresponding to a particular state in the alphabet.

Parameters
codeThe alphabet state to check.
Returns
A vector of indices of model states.

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 48 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getModelStates(), and bpp::WrappedModelInterface::model().

Referenced by bpp::RegisterRatesSubstitutionModel::getModelStates().

◆ getName()

std::string bpp::InMixedSubstitutionModel::getName ( ) const
inlineoverridevirtual

Get the name of the model.

Returns
The name of this model.

Reimplemented from bpp::AbstractWrappedModel.

Definition at line 250 of file InMixedSubstitutionModel.h.

References mixedModelPtr_.

◆ getNumberOfStates()

size_t bpp::AbstractWrappedModel::getNumberOfStates ( ) const
inlineoverridevirtualinherited

Get the number of states.

For most models, this equals the size of the alphabet.

See also
getAlphabetChars for the list of supported states.
Returns
The number of different states in the model.

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 57 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getNumberOfStates(), and bpp::WrappedModelInterface::model().

◆ getPij_t()

const Matrix<double>& bpp::InMixedSubstitutionModel::getPij_t ( double  t) const
inlineoverridevirtual
Returns
All probabilities of change from state i to state j during time t.
See also
Pij_t()

Implements bpp::TransitionModelInterface.

Definition at line 124 of file InMixedSubstitutionModel.h.

References bpp::TransitionModelInterface::getPij_t(), and bpp::AbstractWrappedSubstitutionModel::transitionModel().

◆ getRate()

double bpp::InMixedSubstitutionModel::getRate ( ) const
inlineoverridevirtual

◆ getRowLeftEigenVectors()

const Matrix<double>& bpp::InMixedSubstitutionModel::getRowLeftEigenVectors ( ) const
inlineoverridevirtual
Returns
A matrix with left eigen vectors. Each row in the matrix stands for an eigen vector.

Implements bpp::SubstitutionModelInterface.

Definition at line 170 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::getRowLeftEigenVectors(), and substitutionModel().

◆ getScale()

double bpp::InMixedSubstitutionModel::getScale ( ) const
inlineoverridevirtual

Get the scalar product of diagonal elements of the generator and the frequencies vector. If the generator is normalized, then scale=1. Otherwise each element must be multiplied by 1/scale.

Returns
Minus the scalar product of diagonal elements and the frequencies vector.

Implements bpp::SubstitutionModelInterface.

Definition at line 189 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::getScale(), and substitutionModel().

◆ getStateMap()

std::shared_ptr<const StateMapInterface> bpp::AbstractWrappedModel::getStateMap ( ) const
inlineoverridevirtualinherited
Returns
A shared_ptr to the mapping of model states with alphabet states.

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 42 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getStateMap(), and bpp::WrappedModelInterface::model().

Referenced by bpp::RegisterRatesSubstitutionModel::getStateMap().

◆ getSubModelNumber()

size_t bpp::InMixedSubstitutionModel::getSubModelNumber ( ) const
inline

Definition at line 75 of file InMixedSubstitutionModel.h.

References subModelNumber_.

Referenced by bpp::BppOSubstitutionModelFormat::write().

◆ isDiagonalizable()

bool bpp::InMixedSubstitutionModel::isDiagonalizable ( ) const
inlineoverridevirtual
Returns
True if the model is diagonalizable in R.

Implements bpp::SubstitutionModelInterface.

Definition at line 162 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::isDiagonalizable(), and substitutionModel().

◆ isNonSingular()

bool bpp::InMixedSubstitutionModel::isNonSingular ( ) const
inlineoverridevirtual
Returns
True is the model is non-singular.

Implements bpp::SubstitutionModelInterface.

Definition at line 164 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::isNonSingular(), and substitutionModel().

◆ isScalable()

bool bpp::InMixedSubstitutionModel::isScalable ( ) const
inlineoverridevirtual

returns if model is scalable

Implements bpp::SubstitutionModelInterface.

Definition at line 178 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::isScalable(), and substitutionModel().

◆ Lik_t() [1/2]

virtual const Eigen::VectorXd& bpp::BranchModelInterface::Lik_t ( const Eigen::VectorXd &  values,
double  t 
) const
pure virtualinherited

This method is used to compute likelihoods in recursions. It computes the probability of a vector given a start state.

Parameters
valuesAn vector of states on the site.
ttime
Exceptions
IndexOutOfBoundsExceptionif array position is out of range.
BadIntExceptionif states are not allowed in the associated alphabet.

Implemented in bpp::AbstractLkTransitionModel, bpp::TransitionModelInterface, bpp::TransitionFromTransitionModel, and bpp::MultinomialFromTransitionModel.

◆ Lik_t() [2/2]

const Eigen::VectorXd& bpp::AbstractLkTransitionModel::Lik_t ( const Eigen::VectorXd &  values,
double  t 
) const
inlineoverridevirtualinherited

This method is used to compute likelihoods in recursions. It computes the probability of a vector given a start state.

Parameters
valuesAn vector of states on the site.
tthe branch length

Implements bpp::TransitionModelInterface.

Definition at line 30 of file AbstractSubstitutionModel.h.

References bpp::TransitionModelInterface::getPij_t(), and bpp::AbstractLkTransitionModel::lik_.

◆ mixedModel()

const MixedTransitionModelInterface& bpp::InMixedSubstitutionModel::mixedModel ( ) const
inline

◆ mixedModel_()

◆ model()

◆ model_()

◆ normalize()

void bpp::InMixedSubstitutionModel::normalize ( )
inlineoverridevirtual

Normalize the generator.

Implements bpp::SubstitutionModelInterface.

Definition at line 194 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::normalize(), and substitutionModel_().

◆ operator=()

InMixedSubstitutionModel & InMixedSubstitutionModel::operator= ( const InMixedSubstitutionModel fmsm)

◆ Pij_t()

double bpp::InMixedSubstitutionModel::Pij_t ( size_t  i,
size_t  j,
double  t 
) const
inlineoverridevirtual
Returns
The probability of change from state i to state j during time t.
See also
getPij_t(), getStates()

Implements bpp::TransitionModelInterface.

Definition at line 118 of file InMixedSubstitutionModel.h.

References bpp::TransitionModelInterface::Pij_t(), and bpp::AbstractWrappedSubstitutionModel::transitionModel().

◆ Qij()

double bpp::InMixedSubstitutionModel::Qij ( size_t  i,
size_t  j 
) const
inlineoverridevirtual

Methods to supersede SubstitutionModel methods.

Implements bpp::SubstitutionModelInterface.

Definition at line 150 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::Qij(), and substitutionModel().

◆ setDiagonal()

void bpp::InMixedSubstitutionModel::setDiagonal ( )
inlineoverridevirtual

set the diagonal of the generator such that sum on each line equals 0.

Implements bpp::SubstitutionModelInterface.

Definition at line 199 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::setDiagonal(), and substitutionModel_().

◆ setFreq()

void bpp::InMixedSubstitutionModel::setFreq ( std::map< int, double > &  frequencies)
inlineoverridevirtual

Set equilibrium frequencies.

Parameters
frequenciesThe map of the frequencies to use.

Implements bpp::TransitionModelInterface.

Definition at line 140 of file InMixedSubstitutionModel.h.

References mixedModel_(), and bpp::TransitionModelInterface::setFreq().

◆ setFreqFromData()

void bpp::InMixedSubstitutionModel::setFreqFromData ( const SequenceDataInterface data,
double  pseudoCount = 0 
)
inlineoverridevirtual

Set equilibrium frequencies equal to the frequencies estimated from the data.

Parameters
dataThe sequences to use.
pseudoCountA quantity $\psi$ to add to adjust the observed values in order to prevent issues due to missing states on small data set. The corrected frequencies shall be computed as

\[ \pi_i = \frac{n_i+\psi}{\sum_j (f_j+\psi)} \]

Implements bpp::TransitionModelInterface.

Definition at line 135 of file InMixedSubstitutionModel.h.

References mixedModel_(), and bpp::TransitionModelInterface::setFreqFromData().

◆ setNamespace()

void bpp::InMixedSubstitutionModel::setNamespace ( const std::string &  name)
inlineoverridevirtual

◆ setRate()

void bpp::InMixedSubstitutionModel::setRate ( double  rate)
inlineoverridevirtual

Set the rate of the model (must be positive).

Parameters
ratemust be positive.

Implements bpp::BranchModelInterface.

Definition at line 209 of file InMixedSubstitutionModel.h.

References mixedModel_(), and bpp::BranchModelInterface::setRate().

◆ setScalable()

void bpp::InMixedSubstitutionModel::setScalable ( bool  scalable)
inlineoverridevirtual

sets if model is scalable, ie scale can be changed. Default : true, set to false to avoid normalization for example.

Implements bpp::SubstitutionModelInterface.

Definition at line 183 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::setScalable(), and substitutionModel_().

◆ setScale()

void bpp::InMixedSubstitutionModel::setScale ( double  scale)
inlineoverridevirtual

Multiplies the current generator by the given scale.

Parameters
scalethe scale by which the generator is multiplied.

Implements bpp::SubstitutionModelInterface.

Definition at line 191 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::setScale(), and substitutionModel_().

◆ Sij()

double bpp::InMixedSubstitutionModel::Sij ( size_t  i,
size_t  j 
) const
inlineoverridevirtual
Returns
The exchangeability between state i and state j.

By definition Sij(i,j) = Sij(j,i).

Implements bpp::SubstitutionModelInterface.

Definition at line 156 of file InMixedSubstitutionModel.h.

References bpp::SubstitutionModelInterface::Sij(), and substitutionModel().

◆ stateMap()

const StateMapInterface& bpp::AbstractWrappedModel::stateMap ( ) const
inlineoverridevirtualinherited
Returns
The mapping of model states with alphabet states.

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 40 of file AbstractWrappedModel.h.

References bpp::WrappedModelInterface::model(), and bpp::BranchModelInterface::stateMap().

Referenced by bpp::RegisterRatesSubstitutionModel::stateMap().

◆ substitutionModel()

◆ substitutionModel_()

SubstitutionModelInterface& bpp::InMixedSubstitutionModel::substitutionModel_ ( )
inlineoverrideprotectedvirtual

◆ transitionModel()

const TransitionModelInterface& bpp::AbstractWrappedSubstitutionModel::transitionModel ( ) const
inlinevirtualinherited

◆ transitionModel_()

TransitionModelInterface& bpp::AbstractWrappedSubstitutionModel::transitionModel_ ( )
inlineprotectedvirtualinherited

Member Data Documentation

◆ lik_

Eigen::VectorXd bpp::AbstractLkTransitionModel::lik_
mutableprivateinherited

◆ mixedModelPtr_

std::unique_ptr<MixedTransitionModelInterface> bpp::InMixedSubstitutionModel::mixedModelPtr_
private

The MixedOfTransitionModels.

Definition at line 35 of file InMixedSubstitutionModel.h.

Referenced by getName(), InMixedSubstitutionModel(), mixedModel(), mixedModel_(), operator=(), and substitutionModel().

◆ mixtName_

std::string bpp::InMixedSubstitutionModel::mixtName_
private

The name of the mixture model (for io purpose).

Definition at line 45 of file InMixedSubstitutionModel.h.

Referenced by operator=().

◆ subModelNumber_

size_t bpp::InMixedSubstitutionModel::subModelNumber_
private

the number of the submodel

Definition at line 40 of file InMixedSubstitutionModel.h.

Referenced by getSubModelNumber(), InMixedSubstitutionModel(), operator=(), substitutionModel(), and substitutionModel_().


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