bpp-phyl  2.2.0
bpp::YNGKP_M2 Class Referenceabstract

The Yang et al (2000) M2 substitution model for codons, with the more realistic modification in Wong & al (2004). More...

#include <Bpp/Phyl/Model/Codon/YNGKP_M2.h>

+ Inheritance diagram for bpp::YNGKP_M2:
+ Collaboration diagram for bpp::YNGKP_M2:

Public Member Functions

 YNGKP_M2 (const GeneticCode *gc, FrequenciesSet *codonFreqs)
 
virtual ~YNGKP_M2 ()
 
YNGKP_M2clone () const
 
 YNGKP_M2 (const YNGKP_M2 &)
 
YNGKP_M2operator= (const YNGKP_M2 &)
 
const SubstitutionModelgetModel () const
 
const MixedSubstitutionModelgetMixedModel () const
 
std::string getName () const
 Get the name of the model. More...
 
const SubstitutionModelgetNModel (size_t i) const
 Returns a specific model from the mixture. More...
 
SubstitutionModelgetNModel (size_t i)
 
double getNProbability (size_t i) const
 Returns the probability of a specific model from the mixture. More...
 
const std::vector< double > & getProbabilities () const
 Returns the vector of the probabilities of the submodels of the mixture. More...
 
void setNProbability (size_t i, double prob)
 Sets the probabilities of the submodels of the mixture. More...
 
size_t getNumberOfModels () const
 Returns the number of submodels. More...
 
void setVRates (const Vdouble &vd)
 sets the rates of the submodels. More...
 
void normalizeVRates ()
 normalizes the rates of the submodels. More...
 
const std::vector< double > & getVRates () const
 Returns the vector of all the rates of the mixture. More...
 
double getNRate (size_t i) const
 Returns the rate of a specific model from the mixture. More...
 
Vint getSubmodelNumbers (std::string &desc) const
 
virtual const std::vector< int > & getAlphabetStates () const =0
 
const std::vector< int > & getAlphabetStates () const
 
virtual const StateMapgetStateMap () const =0
 
const StateMapgetStateMap () const
 
virtual std::vector< size_t > getModelStates (int code) const =0
 Get the state in the model corresponding to a particular state in the alphabet. More...
 
virtual std::vector< size_t > getModelStates (const std::string &code) const =0
 Get the state in the model corresponding to a particular state in the alphabet. More...
 
std::vector< size_t > getModelStates (int code) const
 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
 Get the state in the model corresponding to a particular state in the alphabet. More...
 
virtual int getAlphabetStateAsInt (size_t index) const =0
 
int getAlphabetStateAsInt (size_t i) const
 
virtual std::string getAlphabetStateAsChar (size_t index) const =0
 
std::string getAlphabetStateAsChar (size_t i) const
 
virtual double freq (size_t i) const =0
 
virtual double freq (size_t i) const
 
virtual double Qij (size_t i, size_t j) const =0
 
virtual double Qij (size_t i, size_t j) const
 
virtual double Pij_t (size_t i, size_t j, double t) const =0
 
virtual double Pij_t (size_t i, size_t j, double t) const
 
virtual double dPij_dt (size_t i, size_t j, double t) const =0
 
virtual double dPij_dt (size_t i, size_t j, double t) const
 
virtual double d2Pij_dt2 (size_t i, size_t j, double t) const =0
 
virtual double d2Pij_dt2 (size_t i, size_t j, double t) const
 
virtual const Vdouble & getFrequencies () const =0
 
virtual const Vdouble & getFrequencies () const
 
virtual const Matrix< double > & getGenerator () const =0
 
const Matrix< double > & getGenerator () const
 
virtual const Matrix< double > & getExchangeabilityMatrix () const =0
 
const Matrix< double > & getExchangeabilityMatrix () const
 
virtual double Sij (size_t i, size_t j) const =0
 
double Sij (size_t i, size_t j) const
 
virtual const Matrix< double > & getPij_t (double t) const =0
 
const Matrix< double > & getPij_t (double t) const
 
virtual const Matrix< double > & getdPij_dt (double t) const =0
 
const Matrix< double > & getdPij_dt (double t) const
 
virtual const Matrix< double > & getd2Pij_dt2 (double t) const =0
 
const Matrix< double > & getd2Pij_dt2 (double t) const
 
virtual void enableEigenDecomposition (bool yn)=0
 Set if eigenValues and Vectors must be computed. More...
 
virtual bool enableEigenDecomposition ()=0
 Tell if eigenValues and Vectors must be computed. More...
 
void enableEigenDecomposition (bool yn)
 Set if eigenValues and Vectors must be computed. More...
 
bool enableEigenDecomposition ()
 Tell if eigenValues and Vectors must be computed. More...
 
virtual const Vdouble & getEigenValues () const =0
 
const Vdouble & getEigenValues () const
 
virtual const Vdouble & getIEigenValues () const =0
 
const Vdouble & getIEigenValues () const
 
virtual bool isDiagonalizable () const =0
 
bool isDiagonalizable () const
 
virtual bool isNonSingular () const =0
 
bool isNonSingular () const
 
virtual const Matrix< double > & getRowLeftEigenVectors () const =0
 
const Matrix< double > & getRowLeftEigenVectors () const
 
virtual const Matrix< double > & getColumnRightEigenVectors () const =0
 
const Matrix< double > & getColumnRightEigenVectors () const
 
virtual const Alphabet * getAlphabet () const =0
 
const Alphabet * getAlphabet () const
 
virtual size_t getNumberOfStates () const =0
 Get the number of states. More...
 
size_t getNumberOfStates () const
 Get the number of states. More...
 
virtual double getInitValue (size_t i, int state) const =0 throw (IndexOutOfBoundsException, BadIntException)
 
double getInitValue (size_t i, int state) const throw (BadIntException)
 
virtual double getScale () const =0
 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...
 
double getScale () const
 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...
 
virtual void setScale (double scale)=0
 Multiplies the current generator by the given scale. More...
 
void setScale (double scale)
 Multiplies the current generator by the given scale. More...
 
virtual double getRate () const =0
 Get the rate. More...
 
double getRate () const
 Get the rate. More...
 
virtual void setRate (double rate)=0
 Set the rate of the model (must be positive). More...
 
void setRate (double rate)
 Set the rate of the model (must be positive). More...
 
virtual void addRateParameter ()=0
 
void addRateParameter ()
 
virtual void setFreqFromData (const SequenceContainer &data, double pseudoCount=0)=0
 Set equilibrium frequencies equal to the frequencies estimated from the data. More...
 
void setFreqFromData (const SequenceContainer &data, double pseudoCount=0)
 Set equilibrium frequencies equal to the frequencies estimated from the data. More...
 
virtual void setFreq (std::map< int, double > &frequencies)
 Set equilibrium frequencies. More...
 
void setFreq (std::map< int, double > &frequ)
 Set equilibrium frequencies. More...
 
virtual void fireParameterChanged (const ParameterList &parameters)
 Tells the model that a parameter value has changed. More...
 

Protected Member Functions

void updateMatrices ()
 

Protected Attributes

std::map< std::string, std::string > mapParNamesFromPmodel_
 Tools to make the link between the Parameters of the object and those of pmixmodel_. More...
 
ParameterList lParPmodel_
 

Private Member Functions

SubstitutionModelgetModel ()
 
MixedSubstitutionModelgetMixedModel ()
 
const FrequenciesSetgetFrequenciesSet () const
 If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0. More...
 

Private Attributes

std::auto_ptr< MixtureOfASubstitutionModelpmixmodel_
 
size_t synfrom_
 indexes of 2 codons between which the substitution is synonymous, to set a basis to the homogeneization of the rates. More...
 
size_t synto_
 

Detailed Description

The Yang et al (2000) M2 substitution model for codons, with the more realistic modification in Wong & al (2004).

Author
Laurent Guéguen

This model is a mixture of models as described in YN98 class, the mixture being defined on the selection parameter to allow it to vary among sites. A site is either negatively selected $ 0 < \omega_0 < 1 $ (with probability $p_0 $), or neutral ( $ \omega_1 = 1 $) with probability $p_1 $, or positively selected $ 1 < \omega_2 $ (with probability $p_2 $). This model includes 5 parameters ( $kappa$, $ theta1=p0, theta2=\frac{p1}{p1+p2}, omega0 $ and $ omega2 $). The codon frequencies $\pi_j$ are either observed or infered.

References:

Yang, Z., R. Nielsen, N. Goldman, and A.-M. K. Pedersen (2000) Genetics 155:431-449.

Wong, W. S. W., Z. Yang, N. Goldman, and R. Nielsen. (2004) Genetics 168:1041–1051.

Definition at line 75 of file YNGKP_M2.h.

Constructor & Destructor Documentation

◆ YNGKP_M2() [1/2]

◆ ~YNGKP_M2()

YNGKP_M2::~YNGKP_M2 ( )
virtual

Definition at line 148 of file YNGKP_M2.cpp.

◆ YNGKP_M2() [2/2]

YNGKP_M2::YNGKP_M2 ( const YNGKP_M2 mod2)

Definition at line 131 of file YNGKP_M2.cpp.

Member Function Documentation

◆ addRateParameter() [1/2]

◆ addRateParameter() [2/2]

virtual void bpp::SubstitutionModel::addRateParameter ( )
pure virtualinherited

◆ clone()

YNGKP_M2* bpp::YNGKP_M2::clone ( ) const
inlinevirtual

Implements bpp::AbstractBiblioMixedSubstitutionModel.

Definition at line 93 of file YNGKP_M2.h.

References YNGKP_M2().

◆ d2Pij_dt2() [1/2]

virtual double bpp::AbstractBiblioSubstitutionModel::d2Pij_dt2 ( size_t  i,
size_t  j,
double  t 
) const
inlinevirtualinherited
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::SubstitutionModel.

Definition at line 112 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::d2Pij_dt2(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ d2Pij_dt2() [2/2]

virtual double bpp::SubstitutionModel::d2Pij_dt2 ( size_t  i,
size_t  j,
double  t 
) const
pure virtualinherited
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()

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, bpp::F84, bpp::HKY85, bpp::JCprot, bpp::T92, bpp::K80, bpp::RN95, bpp::TN93, bpp::RE08, bpp::JCnuc, bpp::RN95s, bpp::BinarySubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::AbstractBiblioSubstitutionModel::d2Pij_dt2().

◆ dPij_dt() [1/2]

virtual double bpp::AbstractBiblioSubstitutionModel::dPij_dt ( size_t  i,
size_t  j,
double  t 
) const
inlinevirtualinherited
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::SubstitutionModel.

Definition at line 111 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::dPij_dt(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ dPij_dt() [2/2]

virtual double bpp::SubstitutionModel::dPij_dt ( size_t  i,
size_t  j,
double  t 
) const
pure virtualinherited
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()

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, bpp::F84, bpp::HKY85, bpp::JCprot, bpp::T92, bpp::K80, bpp::RN95, bpp::TN93, bpp::RE08, bpp::JCnuc, bpp::RN95s, bpp::BinarySubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::AbstractBiblioSubstitutionModel::dPij_dt().

◆ enableEigenDecomposition() [1/4]

void bpp::AbstractBiblioSubstitutionModel::enableEigenDecomposition ( bool  yn)
inlinevirtualinherited

Set if eigenValues and Vectors must be computed.

Implements bpp::SubstitutionModel.

Definition at line 128 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::enableEigenDecomposition(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ enableEigenDecomposition() [2/4]

bool bpp::AbstractBiblioSubstitutionModel::enableEigenDecomposition ( )
inlinevirtualinherited

Tell if eigenValues and Vectors must be computed.

Implements bpp::SubstitutionModel.

Definition at line 130 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::enableEigenDecomposition(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ enableEigenDecomposition() [3/4]

virtual void bpp::SubstitutionModel::enableEigenDecomposition ( bool  yn)
pure virtualinherited

◆ enableEigenDecomposition() [4/4]

virtual bool bpp::SubstitutionModel::enableEigenDecomposition ( )
pure virtualinherited

Tell if eigenValues and Vectors must be computed.

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

◆ fireParameterChanged()

virtual void bpp::AbstractBiblioSubstitutionModel::fireParameterChanged ( const ParameterList &  parameters)
inlinevirtualinherited

Tells the model that a parameter value has changed.

This updates the matrices consequently.

Definition at line 177 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::updateMatrices().

◆ freq() [1/2]

virtual double bpp::AbstractBiblioSubstitutionModel::freq ( size_t  i) const
inlinevirtualinherited
Returns
Equilibrium frequency associated to character i.
See also
getFrequencies(), getStates()

Implements bpp::SubstitutionModel.

Definition at line 106 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::freq(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ freq() [2/2]

virtual double bpp::SubstitutionModel::freq ( size_t  i) const
pure virtualinherited

◆ getAlphabet() [1/2]

const Alphabet* bpp::AbstractBiblioSubstitutionModel::getAlphabet ( ) const
inlinevirtualinherited
Returns
Get the alphabet associated to this model.

Implements bpp::SubstitutionModel.

Definition at line 153 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getAlphabet(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getAlphabet() [2/2]

virtual const Alphabet* bpp::SubstitutionModel::getAlphabet ( ) const
pure virtualinherited
Returns
Get the alphabet associated to this model.

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::AAExteriorSubstitutionRegister::AAExteriorSubstitutionRegister(), bpp::AAInteriorSubstitutionRegister::AAInteriorSubstitutionRegister(), bpp::SubstitutionModelSet::addModel(), bpp::DecompositionReward::alphabetIndexHasChanged(), bpp::ComprehensiveSubstitutionRegister::ComprehensiveSubstitutionRegister(), bpp::DecompositionReward::DecompositionReward(), bpp::DecompositionSubstitutionCount::DecompositionSubstitutionCount(), bpp::AbstractMutationProcess::detailedEvolve(), bpp::LaplaceSubstitutionCount::getAllNumbersOfSubstitutions(), bpp::AbstractSubstitutionRegister::getAlphabet(), bpp::AbstractBiblioSubstitutionModel::getAlphabet(), bpp::MarkovModulatedSubstitutionModel::getAlphabet(), bpp::SubstitutionMappingTools::getNormalizationsPerBranch(), bpp::DnDsSubstitutionRegister::getType(), bpp::SelectedSubstitutionRegister::SelectedSubstitutionRegister(), bpp::CategorySubstitutionRegister::setCategories(), bpp::LaplaceSubstitutionCount::setSubstitutionModel(), bpp::UniformizationSubstitutionCount::setSubstitutionModel(), bpp::DecompositionSubstitutionCount::setSubstitutionModel(), bpp::DecompositionReward::setSubstitutionModel(), bpp::UniformizationSubstitutionCount::substitutionRegisterHasChanged(), bpp::DecompositionSubstitutionCount::substitutionRegisterHasChanged(), bpp::UniformizationSubstitutionCount::UniformizationSubstitutionCount(), bpp::YpR::updateMatrices(), and bpp::BppOSubstitutionModelFormat::writeMixed_().

◆ getAlphabetStateAsChar() [1/2]

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

Implements bpp::SubstitutionModel.

Definition at line 100 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getAlphabetStateAsChar(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getAlphabetStateAsChar() [2/2]

virtual std::string bpp::SubstitutionModel::getAlphabetStateAsChar ( size_t  index) const
pure virtualinherited

◆ getAlphabetStateAsInt() [1/2]

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

Implements bpp::SubstitutionModel.

Definition at line 98 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getAlphabetStateAsInt(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getAlphabetStateAsInt() [2/2]

◆ getAlphabetStates() [1/2]

const std::vector<int>& bpp::AbstractBiblioSubstitutionModel::getAlphabetStates ( ) const
inlinevirtualinherited
Returns
The alphabet states of each state of the model, as a vector of int codes.
See also
Alphabet

Implements bpp::SubstitutionModel.

Definition at line 94 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getAlphabetStates(), and bpp::AbstractBiblioSubstitutionModel::getModel().

Referenced by bpp::YNGKP_M1::YNGKP_M1(), YNGKP_M2(), bpp::YNGKP_M3::YNGKP_M3(), bpp::YNGKP_M7::YNGKP_M7(), and bpp::YNGKP_M8::YNGKP_M8().

◆ getAlphabetStates() [2/2]

◆ getColumnRightEigenVectors() [1/2]

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

Implements bpp::SubstitutionModel.

Definition at line 141 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getColumnRightEigenVectors(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getColumnRightEigenVectors() [2/2]

virtual const Matrix<double>& bpp::SubstitutionModel::getColumnRightEigenVectors ( ) const
pure virtualinherited

◆ getd2Pij_dt2() [1/2]

const Matrix<double>& bpp::AbstractBiblioSubstitutionModel::getd2Pij_dt2 ( double  t) const
inlinevirtualinherited
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::SubstitutionModel.

Definition at line 126 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getd2Pij_dt2(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getd2Pij_dt2() [2/2]

◆ getdPij_dt() [1/2]

const Matrix<double>& bpp::AbstractBiblioSubstitutionModel::getdPij_dt ( double  t) const
inlinevirtualinherited
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::SubstitutionModel.

Definition at line 124 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getdPij_dt(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getdPij_dt() [2/2]

◆ getEigenValues() [1/2]

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

Implements bpp::SubstitutionModel.

Definition at line 136 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getEigenValues(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getEigenValues() [2/2]

virtual const Vdouble& bpp::SubstitutionModel::getEigenValues ( ) const
pure virtualinherited

◆ getExchangeabilityMatrix() [1/2]

const Matrix<double>& bpp::AbstractBiblioSubstitutionModel::getExchangeabilityMatrix ( ) const
inlinevirtualinherited
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::SubstitutionModel.

Definition at line 118 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getExchangeabilityMatrix(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getExchangeabilityMatrix() [2/2]

virtual const Matrix<double>& bpp::SubstitutionModel::getExchangeabilityMatrix ( ) const
pure virtualinherited
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$.

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::Coala::Coala(), bpp::AbstractBiblioSubstitutionModel::getExchangeabilityMatrix(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().

◆ getFrequencies() [1/2]

virtual const Vdouble& bpp::AbstractBiblioSubstitutionModel::getFrequencies ( ) const
inlinevirtualinherited
Returns
A vector of all equilibrium frequencies.
See also
freq()

Implements bpp::SubstitutionModel.

Definition at line 114 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getFrequencies(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getFrequencies() [2/2]

◆ getFrequenciesSet()

const FrequenciesSet* bpp::YNGKP_M2::getFrequenciesSet ( ) const
inlineprivatevirtual

If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0.

Reimplemented from bpp::AbstractBiblioSubstitutionModel.

Definition at line 114 of file YNGKP_M2.h.

References pmixmodel_.

Referenced by YNGKP_M2().

◆ getGenerator() [1/2]

const Matrix<double>& bpp::AbstractBiblioSubstitutionModel::getGenerator ( ) const
inlinevirtualinherited
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. Additionnaly, the rate_ attibute 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::SubstitutionModel.

Definition at line 116 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getGenerator(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getGenerator() [2/2]

virtual const Matrix<double>& bpp::SubstitutionModel::getGenerator ( ) const
pure virtualinherited
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. Additionnaly, the rate_ attibute 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()

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::LaplaceSubstitutionCount::computeCounts(), bpp::UniformizationSubstitutionCount::computeCounts_(), bpp::AbstractBiblioSubstitutionModel::getGenerator(), bpp::SimpleMutationProcess::SimpleMutationProcess(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().

◆ getIEigenValues() [1/2]

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

Implements bpp::SubstitutionModel.

Definition at line 138 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getIEigenValues(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getIEigenValues() [2/2]

virtual const Vdouble& bpp::SubstitutionModel::getIEigenValues ( ) const
pure virtualinherited
Returns
A vector with all imaginary parts of the eigen values of the generator of this model;

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::AbstractBiblioSubstitutionModel::getIEigenValues().

◆ getInitValue() [1/2]

double bpp::AbstractBiblioSubstitutionModel::getInitValue ( size_t  i,
int  state 
) const
throw (BadIntException
)
inlinevirtualinherited

This method is used to initialize likelihoods in reccursions. 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::SubstitutionModel.

Definition at line 157 of file AbstractBiblioSubstitutionModel.h.

References bpp::SubstitutionModel::getInitValue(), and bpp::AbstractBiblioSubstitutionModel::getModel().

◆ getInitValue() [2/2]

virtual double bpp::SubstitutionModel::getInitValue ( size_t  i,
int  state 
) const
throw (IndexOutOfBoundsException,
BadIntException
)
pure virtualinherited

This method is used to initialize likelihoods in reccursions. 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();

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, bpp::RE08, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::AbstractBiblioSubstitutionModel::getInitValue().

◆ getMixedModel() [1/2]

const MixedSubstitutionModel& bpp::YNGKP_M2::getMixedModel ( ) const
inlinevirtual

Implements bpp::AbstractBiblioMixedSubstitutionModel.

Definition at line 105 of file YNGKP_M2.h.

References pmixmodel_.

◆ getMixedModel() [2/2]

MixedSubstitutionModel& bpp::YNGKP_M2::getMixedModel ( )
inlineprivatevirtual

Implements bpp::AbstractBiblioMixedSubstitutionModel.

Definition at line 112 of file YNGKP_M2.h.

References pmixmodel_.

◆ getModel() [1/2]

const SubstitutionModel& bpp::YNGKP_M2::getModel ( ) const
inlinevirtual

Implements bpp::AbstractBiblioSubstitutionModel.

Definition at line 103 of file YNGKP_M2.h.

References pmixmodel_.

◆ getModel() [2/2]

SubstitutionModel& bpp::YNGKP_M2::getModel ( )
inlineprivatevirtual

Implements bpp::AbstractBiblioSubstitutionModel.

Definition at line 110 of file YNGKP_M2.h.

References pmixmodel_.

◆ getModelStates() [1/4]

std::vector<size_t> bpp::AbstractBiblioSubstitutionModel::getModelStates ( int  code) const
inlinevirtualinherited

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

Definition at line 102 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getModelStates().

◆ getModelStates() [2/4]

std::vector<size_t> bpp::AbstractBiblioSubstitutionModel::getModelStates ( const std::string &  code) const
inlinevirtualinherited

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

Definition at line 104 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getModelStates().

◆ getModelStates() [3/4]

virtual std::vector<size_t> bpp::SubstitutionModel::getModelStates ( int  code) const
pure virtualinherited

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.

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::AbstractBiblioSubstitutionModel::getModelStates(), bpp::SubstitutionModelSet::getModelStates(), and bpp::MarginalAncestralStateReconstruction::recursiveMarginalAncestralStates().

◆ getModelStates() [4/4]

virtual std::vector<size_t> bpp::SubstitutionModel::getModelStates ( const std::string &  code) const
pure virtualinherited

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.

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

◆ getName()

std::string bpp::YNGKP_M2::getName ( ) const
inlinevirtual

Get the name of the model.

Returns
The name of this model.

Implements bpp::SubstitutionModel.

Definition at line 107 of file YNGKP_M2.h.

◆ getNModel() [1/2]

const SubstitutionModel* bpp::AbstractBiblioMixedSubstitutionModel::getNModel ( size_t  i) const
inlinevirtualinherited

◆ getNModel() [2/2]

SubstitutionModel* bpp::AbstractBiblioMixedSubstitutionModel::getNModel ( size_t  i)
inlinevirtualinherited

◆ getNProbability()

double bpp::AbstractBiblioMixedSubstitutionModel::getNProbability ( size_t  i) const
inlinevirtualinherited

Returns the probability of a specific model from the mixture.

Implements bpp::MixedSubstitutionModel.

Definition at line 91 of file AbstractBiblioMixedSubstitutionModel.h.

References bpp::AbstractBiblioMixedSubstitutionModel::getMixedModel(), and bpp::MixedSubstitutionModel::getNProbability().

◆ getNRate()

double bpp::AbstractBiblioMixedSubstitutionModel::getNRate ( size_t  i) const
inlinevirtualinherited

Returns the rate of a specific model from the mixture.

Implements bpp::MixedSubstitutionModel.

Definition at line 155 of file AbstractBiblioMixedSubstitutionModel.h.

References bpp::AbstractBiblioMixedSubstitutionModel::getMixedModel(), and bpp::MixedSubstitutionModel::getNRate().

◆ getNumberOfModels()

size_t bpp::AbstractBiblioMixedSubstitutionModel::getNumberOfModels ( ) const
inlinevirtualinherited

◆ getNumberOfStates() [1/2]

size_t bpp::AbstractBiblioSubstitutionModel::getNumberOfStates ( ) const
inlinevirtualinherited

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

Definition at line 155 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getNumberOfStates().

◆ getNumberOfStates() [2/2]

◆ getPij_t() [1/2]

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

Implements bpp::SubstitutionModel.

Definition at line 122 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getPij_t().

◆ getPij_t() [2/2]

◆ getProbabilities()

const std::vector<double>& bpp::AbstractBiblioMixedSubstitutionModel::getProbabilities ( ) const
inlinevirtualinherited

Returns the vector of the probabilities of the submodels of the mixture.

Implements bpp::MixedSubstitutionModel.

Definition at line 102 of file AbstractBiblioMixedSubstitutionModel.h.

References bpp::AbstractBiblioMixedSubstitutionModel::getMixedModel(), and bpp::MixedSubstitutionModel::getProbabilities().

◆ getRate() [1/2]

◆ getRate() [2/2]

virtual double bpp::SubstitutionModel::getRate ( ) const
pure virtualinherited

◆ getRowLeftEigenVectors() [1/2]

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

Implements bpp::SubstitutionModel.

Definition at line 140 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getRowLeftEigenVectors().

◆ getRowLeftEigenVectors() [2/2]

virtual const Matrix<double>& bpp::SubstitutionModel::getRowLeftEigenVectors ( ) const
pure virtualinherited

◆ getScale() [1/2]

double bpp::AbstractBiblioSubstitutionModel::getScale ( ) const
inlinevirtualinherited

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

Definition at line 190 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getScale().

◆ getScale() [2/2]

virtual double bpp::SubstitutionModel::getScale ( ) const
pure virtualinherited

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.

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::AbstractBiblioSubstitutionModel::getScale().

◆ getStateMap() [1/2]

const StateMap& bpp::AbstractBiblioSubstitutionModel::getStateMap ( ) const
inlinevirtualinherited
Returns
The mapping of model states with alphabet states.

Implements bpp::SubstitutionModel.

Definition at line 96 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getStateMap().

◆ getStateMap() [2/2]

virtual const StateMap& bpp::SubstitutionModel::getStateMap ( ) const
pure virtualinherited

◆ getSubmodelNumbers()

Vint AbstractBiblioMixedSubstitutionModel::getSubmodelNumbers ( std::string &  desc) const
virtualinherited

◆ getVRates()

const std::vector<double>& bpp::AbstractBiblioMixedSubstitutionModel::getVRates ( ) const
inlinevirtualinherited

Returns the vector of all the rates of the mixture.

Implements bpp::MixedSubstitutionModel.

Definition at line 147 of file AbstractBiblioMixedSubstitutionModel.h.

References bpp::AbstractBiblioMixedSubstitutionModel::getMixedModel(), and bpp::MixedSubstitutionModel::getVRates().

◆ isDiagonalizable() [1/2]

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

Implements bpp::SubstitutionModel.

Definition at line 132 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::isDiagonalizable().

◆ isDiagonalizable() [2/2]

virtual bool bpp::SubstitutionModel::isDiagonalizable ( ) const
pure virtualinherited

◆ isNonSingular() [1/2]

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

Implements bpp::SubstitutionModel.

Definition at line 134 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::isNonSingular().

◆ isNonSingular() [2/2]

virtual bool bpp::SubstitutionModel::isNonSingular ( ) const
pure virtualinherited

◆ normalizeVRates()

void bpp::AbstractBiblioMixedSubstitutionModel::normalizeVRates ( )
inlinevirtualinherited

◆ operator=()

YNGKP_M2 & YNGKP_M2::operator= ( const YNGKP_M2 mod2)

◆ Pij_t() [1/2]

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

Implements bpp::SubstitutionModel.

Definition at line 110 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::Pij_t().

◆ Pij_t() [2/2]

virtual double bpp::SubstitutionModel::Pij_t ( size_t  i,
size_t  j,
double  t 
) const
pure virtualinherited

◆ Qij() [1/2]

virtual double bpp::AbstractBiblioSubstitutionModel::Qij ( size_t  i,
size_t  j 
) const
inlinevirtualinherited
Returns
The rate in the generator of change from state i to state j.
See also
getStates();

Implements bpp::SubstitutionModel.

Definition at line 108 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::Qij().

◆ Qij() [2/2]

◆ setFreq() [1/2]

void AbstractBiblioSubstitutionModel::setFreq ( std::map< int, double > &  frequencies)
virtualinherited

Set equilibrium frequencies.

Parameters
frequenciesThe map of the frequencies to use.

Reimplemented from bpp::SubstitutionModel.

Definition at line 95 of file AbstractBiblioSubstitutionModel.cpp.

References bpp::AbstractBiblioSubstitutionModel::getModel(), bpp::AbstractBiblioSubstitutionModel::mapParNamesFromPmodel_, and bpp::SubstitutionModel::setFreq().

◆ setFreq() [2/2]

◆ setFreqFromData() [1/2]

void AbstractBiblioSubstitutionModel::setFreqFromData ( const SequenceContainer &  data,
double  pseudoCount = 0 
)
virtualinherited

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

Definition at line 110 of file AbstractBiblioSubstitutionModel.cpp.

References bpp::AbstractBiblioSubstitutionModel::getModel(), bpp::AbstractBiblioSubstitutionModel::mapParNamesFromPmodel_, and bpp::SubstitutionModel::setFreqFromData().

◆ setFreqFromData() [2/2]

virtual void bpp::SubstitutionModel::setFreqFromData ( const SequenceContainer &  data,
double  pseudoCount = 0 
)
pure virtualinherited

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)} \]

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, bpp::JCprot, bpp::K80, bpp::RE08, bpp::JCnuc, bpp::UserProteinSubstitutionModel, bpp::AbstractBiblioSubstitutionModel, bpp::WAG01, bpp::DSO78, bpp::JTT92, bpp::LG08, and bpp::Coala.

Referenced by bpp::BppOSubstitutionModelFormat::read(), bpp::AbstractBiblioSubstitutionModel::setFreqFromData(), and bpp::MarkovModulatedSubstitutionModel::setFreqFromData().

◆ setNProbability()

void bpp::AbstractBiblioMixedSubstitutionModel::setNProbability ( size_t  i,
double  prob 
)
inlinevirtualinherited

Sets the probabilities of the submodels of the mixture.

Implements bpp::MixedSubstitutionModel.

Definition at line 111 of file AbstractBiblioMixedSubstitutionModel.h.

References bpp::AbstractBiblioMixedSubstitutionModel::getMixedModel(), and bpp::MixedSubstitutionModel::setNProbability().

◆ setRate() [1/2]

void bpp::AbstractBiblioSubstitutionModel::setRate ( double  rate)
inlinevirtualinherited

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

Parameters
ratemust be positive.

Implements bpp::SubstitutionModel.

Definition at line 145 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::setRate().

◆ setRate() [2/2]

virtual void bpp::SubstitutionModel::setRate ( double  rate)
pure virtualinherited

◆ setScale() [1/2]

void bpp::AbstractBiblioSubstitutionModel::setScale ( double  scale)
inlinevirtualinherited

Multiplies the current generator by the given scale.

Parameters
scalethe scale by which the generator is multiplied.

Implements bpp::SubstitutionModel.

Definition at line 192 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::setScale().

◆ setScale() [2/2]

virtual void bpp::SubstitutionModel::setScale ( double  scale)
pure virtualinherited

Multiplies the current generator by the given scale.

Parameters
scalethe scale by which the generator is multiplied.

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::AbstractBiblioSubstitutionModel::setScale(), and bpp::MarkovModulatedSubstitutionModel::setScale().

◆ setVRates()

void bpp::AbstractBiblioMixedSubstitutionModel::setVRates ( const Vdouble &  vd)
inlinevirtualinherited

◆ Sij() [1/2]

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

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

Implements bpp::SubstitutionModel.

Definition at line 120 of file AbstractBiblioSubstitutionModel.h.

References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::Sij().

◆ Sij() [2/2]

virtual double bpp::SubstitutionModel::Sij ( size_t  i,
size_t  j 
) const
pure virtualinherited
Returns
The exchangeability between state i and state j.

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

Implemented in bpp::AbstractSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::AbstractBiblioSubstitutionModel::Sij().

◆ updateMatrices()

void YNGKP_M2::updateMatrices ( )
protectedvirtual

Member Data Documentation

◆ lParPmodel_

◆ mapParNamesFromPmodel_

◆ pmixmodel_

std::auto_ptr<MixtureOfASubstitutionModel> bpp::YNGKP_M2::pmixmodel_
private

◆ synfrom_

size_t bpp::YNGKP_M2::synfrom_
private

indexes of 2 codons between which the substitution is synonymous, to set a basis to the homogeneization of the rates.

Definition at line 86 of file YNGKP_M2.h.

Referenced by operator=(), updateMatrices(), and YNGKP_M2().

◆ synto_

size_t bpp::YNGKP_M2::synto_
private

Definition at line 86 of file YNGKP_M2.h.

Referenced by operator=(), updateMatrices(), and YNGKP_M2().


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