bpp-phyl  2.1.0
bpp::MixedSubstitutionModel Class Reference

Interface for Substitution models, defined as a mixture of "simple" substitution models. More...

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

+ Inheritance diagram for bpp::MixedSubstitutionModel:
+ Collaboration diagram for bpp::MixedSubstitutionModel:

List of all members.

Public Member Functions

 MixedSubstitutionModel ()
virtual ~MixedSubstitutionModel ()
virtual MixedSubstitutionModelclone () const =0
virtual const SubstitutionModelgetNModel (size_t i) const =0
 Returns a specific model from the mixture.
virtual SubstitutionModelgetNModel (size_t i)=0
virtual double getNProbability (size_t i) const =0
 Returns the probability of a specific model from the mixture.
virtual const std::vector
< double > & 
getProbabilities () const =0
virtual void setNProbability (size_t i, double prob)=0
 Sets the probability of a specific model from the mixture.
virtual size_t getNumberOfModels () const =0
virtual const std::vector
< double > & 
getVRates () const =0
 Returns the rates of the submodels.
virtual double getNRate (size_t i) const =0
 Returns the rate of a specific submodel.
virtual void setVRates (const Vdouble &vd)=0
 Sets the rates of the submodels to be proportional to a given vector, and normalizes them so that the mean rate of the mixture equals rate_.
virtual void normalizeVRates ()=0
 Normalizes the rates of the submodels so that the mean rate of the mixture equals rate_.
virtual Vint getSubmodelNumbers (std::string &desc) const =0
virtual std::string getName () const =0
 Get the name of the model.
virtual const std::vector< int > & getAlphabetChars () const =0
virtual int getAlphabetChar (size_t i) const =0
 Get the char in the alphabet corresponding to a given state in the model.
virtual std::vector< size_t > getModelStates (int i) const =0
 Get the state in the model corresponding to a particular char in the alphabet.
virtual double freq (size_t i) const =0
virtual double Qij (size_t i, size_t j) const =0
virtual double Pij_t (size_t i, size_t j, double t) const =0
virtual double dPij_dt (size_t i, size_t j, double t) const =0
virtual double d2Pij_dt2 (size_t i, size_t j, double t) const =0
virtual const VdoublegetFrequencies () const =0
virtual const Matrix< double > & getGenerator () const =0
virtual const Matrix< double > & getExchangeabilityMatrix () const =0
virtual double Sij (size_t i, size_t j) const =0
virtual const Matrix< double > & getPij_t (double t) const =0
virtual const Matrix< double > & getdPij_dt (double t) const =0
virtual const Matrix< double > & getd2Pij_dt2 (double t) const =0
virtual void enableEigenDecomposition (bool yn)=0
 Set if eigenValues and Vectors must be computed.
virtual bool enableEigenDecomposition ()=0
 Tell if eigenValues and Vectors must be computed.
virtual const VdoublegetEigenValues () const =0
virtual const VdoublegetIEigenValues () const =0
virtual bool isDiagonalizable () const =0
virtual bool isNonSingular () const =0
virtual const Matrix< double > & getRowLeftEigenVectors () const =0
virtual const Matrix< double > & getColumnRightEigenVectors () const =0
virtual const AlphabetgetAlphabet () const =0
virtual size_t getNumberOfStates () const =0
 Get the number of states.
virtual double getInitValue (size_t i, int state) const =0 throw (IndexOutOfBoundsException, 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.
virtual void setScale (double scale)=0
 Set the rate of the generator, defined as the scalar product of diagonal elements of the generator and the frequencies vector.
virtual double getRate () const =0
 Get the rate.
virtual void setRate (double rate)=0
 Set the rate of the model (must be positive).
virtual void addRateParameter ()=0
virtual void setFreqFromData (const SequenceContainer &data, double pseudoCount=0)=0
 Set equilibrium frequencies equal to the frequencies estimated from the data.
virtual void setFreq (std::map< int, double > &frequencies)
 Set equilibrium frequencies.
virtual const FrequenciesSetgetFrequenciesSet () const
 If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0.
virtual size_t getNumberOfIndependentParameters () const =0
virtual void aliasParameters (const std::string &p1, const std::string &p2)=0
virtual void unaliasParameters (const std::string &p1, const std::string &p2)=0
virtual const ParameterListgetIndependentParameters () const =0
virtual std::vector< std::string > getAlias (const std::string &name) const =0
virtual bool hasParameter (const std::string &name) const =0
virtual const ParameterListgetParameters () const =0
virtual const ParametergetParameter (const std::string &name) const =0
virtual double getParameterValue (const std::string &name) const =0
virtual void setAllParametersValues (const ParameterList &parameters)=0
virtual void setParameterValue (const std::string &name, double value)=0
virtual void setParametersValues (const ParameterList &parameters)=0
virtual bool matchParametersValues (const ParameterList &parameters)=0
virtual size_t getNumberOfParameters () const =0
virtual void setNamespace (const std::string &prefix)=0
virtual std::string getNamespace () const =0
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const =0

Detailed Description

Interface for Substitution models, defined as a mixture of "simple" substitution models.

Author:
Laurent Guéguen

Definition at line 59 of file MixedSubstitutionModel.h.


Constructor & Destructor Documentation

Definition at line 65 of file MixedSubstitutionModel.h.


Member Function Documentation

virtual double bpp::SubstitutionModel::d2Pij_dt2 ( size_t  i,
size_t  j,
double  t 
) const [pure virtual, inherited]
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::RE08, bpp::JCnuc, bpp::BinarySubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::AbstractBiblioSubstitutionModel::d2Pij_dt2(), and bpp::RE08::d2Pij_dt2().

virtual double bpp::SubstitutionModel::dPij_dt ( size_t  i,
size_t  j,
double  t 
) const [pure virtual, inherited]
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::RE08, bpp::JCnuc, bpp::BinarySubstitutionModel, and bpp::AbstractBiblioSubstitutionModel.

Referenced by bpp::RE08::d2Pij_dt2(), bpp::AbstractBiblioSubstitutionModel::dPij_dt(), and bpp::RE08::dPij_dt().

virtual bool bpp::SubstitutionModel::enableEigenDecomposition ( ) [pure virtual, inherited]

Tell if eigenValues and Vectors must be computed.

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

virtual int bpp::SubstitutionModel::getAlphabetChar ( size_t  i) const [pure virtual, inherited]

Get the char in the alphabet corresponding to a given state in the model.

In most cases, this method will return i.

Parameters:
iThe index of the state.
Returns:
The corresponding state in the alphabet.
See also:
MarkovModulatedSubstitutionModel
getStates()

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

Referenced by bpp::AbstractBiblioSubstitutionModel::getAlphabetChar(), bpp::MarginalAncestralStateReconstruction::getAncestralSequenceForNode(), and bpp::NonHomogeneousSequenceSimulator::multipleEvolve().

virtual const std::vector<int>& bpp::SubstitutionModel::getAlphabetChars ( ) const [pure virtual, inherited]
virtual const Matrix<double>& bpp::SubstitutionModel::getExchangeabilityMatrix ( ) const [pure virtual, inherited]
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::AbstractBiblioSubstitutionModel::getExchangeabilityMatrix(), bpp::RE08::updateMatrices(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().

virtual const Matrix<double>& bpp::SubstitutionModel::getGenerator ( ) const [pure virtual, inherited]
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(), bpp::RE08::updateMatrices(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().

virtual const Vdouble& bpp::SubstitutionModel::getIEigenValues ( ) const [pure virtual, inherited]
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().

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

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().

virtual std::vector<size_t> bpp::SubstitutionModel::getModelStates ( int  i) const [pure virtual, inherited]

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

Parameters:
iThe alphabet char 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::MarkovModulatedSubstitutionModel::getModelStates(), and bpp::MarginalAncestralStateReconstruction::recursiveMarginalAncestralStates().

virtual std::string bpp::SubstitutionModel::getName ( ) const [pure virtual, inherited]

Get the name of the model.

Returns:
The name of this model.

Implemented in bpp::YpR_Gen, bpp::YpR_Sym, bpp::F84, bpp::HKY85, bpp::JCprot, bpp::T92, bpp::K80, bpp::RN95, bpp::GTR, bpp::TN93, bpp::RE08, bpp::MixtureOfSubstitutionModels, bpp::JCnuc, bpp::RN95s, bpp::CodonDistanceFrequenciesSubstitutionModel, bpp::BinarySubstitutionModel, bpp::CodonDistancePhaseFrequenciesSubstitutionModel, bpp::UserProteinSubstitutionModel, bpp::CodonDistanceFitnessPhaseFrequenciesSubstitutionModel, bpp::MixtureOfASubstitutionModel, bpp::LLG08_EX3, bpp::WAG01, bpp::WordSubstitutionModel, bpp::LLG08_EHO, bpp::LLG08_UL3, bpp::SSR, bpp::LG10_EX_EHO, bpp::CodonDistanceSubstitutionModel, bpp::L95, bpp::DSO78, bpp::JTT92, bpp::LGL08_CAT, bpp::LLG08_EX2, bpp::LLG08_UL2, bpp::CodonRateFrequenciesSubstitutionModel, bpp::gBGC, bpp::LG08, bpp::G2001, bpp::YNGKP_M1, bpp::YNGKP_M8, bpp::TS98, bpp::YNGKP_M7, bpp::GY94, bpp::YNGKP_M2, bpp::YNGKP_M3, bpp::TripletSubstitutionModel, bpp::YN98, bpp::MG94, bpp::CodonRateSubstitutionModel, bpp::Coala, bpp::LLG08_EX3::EmbeddedModel, bpp::LLG08_EHO::EmbeddedModel, bpp::LLG08_UL3::EmbeddedModel, bpp::LG10_EX_EHO::EmbeddedModel, bpp::LGL08_CAT::EmbeddedModel, bpp::LLG08_EX2::EmbeddedModel, and bpp::LLG08_UL2::EmbeddedModel.

Referenced by bpp::AbstractCodonFitnessSubstitutionModel::AbstractCodonFitnessSubstitutionModel(), bpp::AbstractSubstitutionModel::fireParameterChanged(), bpp::gBGC::getName(), bpp::MixtureOfSubstitutionModels::getSubmodelNumbers(), bpp::BppOSubstitutionModelFormat::readMixed_(), bpp::AbstractWordSubstitutionModel::updateMatrices(), bpp::AbstractBiblioSubstitutionModel::updateMatrices(), and bpp::BppOSubstitutionModelFormat::write().

virtual double bpp::MixedSubstitutionModel::getNRate ( size_t  i) const [pure virtual]
virtual const Matrix<double>& bpp::SubstitutionModel::getRowLeftEigenVectors ( ) const [pure virtual, inherited]
virtual double bpp::SubstitutionModel::getScale ( ) const [pure virtual, inherited]

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().

virtual const std::vector<double>& bpp::MixedSubstitutionModel::getVRates ( ) const [pure virtual]
virtual bool bpp::SubstitutionModel::isDiagonalizable ( ) const [pure virtual, inherited]
virtual bool bpp::SubstitutionModel::isNonSingular ( ) const [pure virtual, inherited]
virtual void bpp::MixedSubstitutionModel::normalizeVRates ( ) [pure virtual]

Normalizes the rates of the submodels so that the mean rate of the mixture equals rate_.

Implemented in bpp::AbstractMixedSubstitutionModel, and bpp::AbstractBiblioMixedSubstitutionModel.

Referenced by bpp::MixedSubstitutionModelSet::computeHyperNodesProbabilities(), and bpp::AbstractBiblioMixedSubstitutionModel::normalizeVRates().

virtual void bpp::SubstitutionModel::setFreqFromData ( const SequenceContainer data,
double  pseudoCount = 0 
) [pure virtual, inherited]

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, and bpp::AbstractBiblioSubstitutionModel.

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

virtual void bpp::MixedSubstitutionModel::setNProbability ( size_t  i,
double  prob 
) [pure virtual]
virtual void bpp::SubstitutionModel::setRate ( double  rate) [pure virtual, inherited]
virtual void bpp::SubstitutionModel::setScale ( double  scale) [pure virtual, inherited]

Set the rate of the generator, defined as the scalar product of diagonal elements of the generator and the frequencies vector.

When the generator is normalized, scale=1. Otherwise each element is multiplied such that the correct scale is set.

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

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

virtual void bpp::MixedSubstitutionModel::setVRates ( const Vdouble vd) [pure virtual]

Sets the rates of the submodels to be proportional to a given vector, and normalizes them so that the mean rate of the mixture equals rate_.

Parameters:
vda vector of positive values such that the rates of the respective submodels are in the same proportions (ie this vector does not need to be normalized).

Implemented in bpp::MixtureOfSubstitutionModels, bpp::AbstractMixedSubstitutionModel, and bpp::AbstractBiblioMixedSubstitutionModel.

Referenced by bpp::AbstractBiblioMixedSubstitutionModel::setVRates().

virtual double bpp::SubstitutionModel::Sij ( size_t  i,
size_t  j 
) const [pure virtual, inherited]
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().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends