bpp-phyl  2.3.0
bpp::ReversibleSubstitutionModel Class Referenceabstract

Interface for reversible substitution models. More...

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

+ Inheritance diagram for bpp::ReversibleSubstitutionModel:
+ Collaboration diagram for bpp::ReversibleSubstitutionModel:

Public Member Functions

 ReversibleSubstitutionModel ()
 
virtual ~ReversibleSubstitutionModel ()
 
ReversibleSubstitutionModelclone () const =0
 
virtual double Qij (size_t i, size_t j) 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 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...
 
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 void setScalable (bool scalable)=0
 sets if model is scalable, ie scale can be changed. Default : true, set to false to avoid normalization for example. More...
 
virtual bool isScalable () const =0
 returns if model is scalable More...
 
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...
 
virtual void setScale (double scale)=0
 Multiplies the current generator by the given scale. More...
 
virtual void normalize ()=0
 Normalize the generator. More...
 
virtual double getRate () const =0
 Get the rate. More...
 
virtual void setRate (double rate)=0
 Set the rate of the model (must be positive). More...
 
virtual void addRateParameter ()=0
 
virtual std::string getName () const =0
 Get the name of the model. More...
 
virtual const std::vector< int > & getAlphabetStates () const =0
 
virtual const StateMapgetStateMap () const =0
 
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...
 
virtual int getAlphabetStateAsInt (size_t index) const =0
 
virtual std::string getAlphabetStateAsChar (size_t index) const =0
 
virtual double freq (size_t i) 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 > & 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 const AlphabetgetAlphabet () const =0
 
virtual size_t getNumberOfStates () const =0
 Get the number of states. More...
 
virtual double getInitValue (size_t i, int state) const =0 throw (IndexOutOfBoundsException, BadIntException)
 
virtual void setFreqFromData (const SequenceContainer &data, double pseudoCount=0)=0
 Set equilibrium frequencies equal to the frequencies estimated from the data. More...
 
virtual void setFreq (std::map< int, double > &frequencies)=0
 Set equilibrium frequencies. More...
 
virtual const FrequenciesSetgetFrequenciesSet () const
 If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0. More...
 
virtual size_t getNumberOfIndependentParameters () const =0
 
virtual void aliasParameters (const std::string &p1, const std::string &p2)=0
 
virtual void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)=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 std::map< std::string, std::string > getAliases () 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 reversible substitution models.

For reversible models,

\[ Q = S . \pi, \]

where $S$ is a symetric matrix called the exchangeability matrix, and $\Pi$ the diagonal matrix with all equilibrium frequencies. The frequencies may be retrieved as a vector by the getFrequencies() method or individually by the freq() method. The $S$ matrix may be obtained by the getExchangeabilityMatrix().

Definition at line 562 of file SubstitutionModel.h.

Constructor & Destructor Documentation

bpp::ReversibleSubstitutionModel::ReversibleSubstitutionModel ( )
inline

Definition at line 566 of file SubstitutionModel.h.

virtual bpp::ReversibleSubstitutionModel::~ReversibleSubstitutionModel ( )
inlinevirtual

Definition at line 567 of file SubstitutionModel.h.

Member Function Documentation

virtual double bpp::TransitionModel::d2Pij_dt2 ( size_t  i,
size_t  j,
double  t 
) const
pure virtualinherited
virtual double bpp::TransitionModel::dPij_dt ( size_t  i,
size_t  j,
double  t 
) const
pure virtualinherited
virtual bool bpp::SubstitutionModel::enableEigenDecomposition ( )
pure virtualinherited
virtual const Alphabet* bpp::TransitionModel::getAlphabet ( ) const
pure virtualinherited
Returns
Get the alphabet associated to this model.

Implemented in bpp::RE08Protein, bpp::AbstractSubstitutionModel, bpp::RE08Nucleotide, bpp::MarkovModulatedSubstitutionModel, bpp::FromMixtureSubstitutionModel, bpp::AbstractBiblioSubstitutionModel, bpp::AbstractReversibleNucleotideSubstitutionModel, bpp::AbstractReversibleProteinSubstitutionModel, bpp::AbstractFromSubstitutionModelTransitionModel, bpp::AbstractNucleotideSubstitutionModel, bpp::AbstractProteinSubstitutionModel, bpp::NucleotideSubstitutionModel, and bpp::ProteinSubstitutionModel.

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::AbstractFromSubstitutionModelTransitionModel::getAlphabet(), bpp::AbstractSubstitutionRegister::getAlphabet(), bpp::AbstractBiblioSubstitutionModel::getAlphabet(), bpp::FromMixtureSubstitutionModel::getAlphabet(), bpp::MarkovModulatedSubstitutionModel::getAlphabet(), bpp::MarkovModulatedSubstitutionModel::getInitValue(), bpp::SubstitutionMappingTools::getNormalizationsPerBranch(), bpp::SENCA::setFreq(), 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_().

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

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

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

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

virtual const Vdouble& bpp::SubstitutionModel::getIEigenValues ( ) const
pure virtualinherited
virtual double bpp::TransitionModel::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, bpp::FromMixtureSubstitutionModel, bpp::AbstractBiblioSubstitutionModel, and bpp::AbstractFromSubstitutionModelTransitionModel.

Referenced by bpp::AbstractFromSubstitutionModelTransitionModel::getInitValue(), bpp::AbstractBiblioSubstitutionModel::getInitValue(), bpp::FromMixtureSubstitutionModel::getInitValue(), and bpp::TwoTreeLikelihood::initTreeLikelihoods().

virtual std::vector<size_t> bpp::TransitionModel::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, bpp::AbstractFromSubstitutionModelTransitionModel, bpp::AbstractBiblioSubstitutionModel, and bpp::FromMixtureSubstitutionModel.

virtual std::string bpp::TransitionModel::getName ( ) const
pure virtualinherited

Get the name of the model.

Returns
The name of this model.

Implemented in bpp::YpR_Gen, bpp::YpR_Sym, bpp::FromMixtureSubstitutionModel, bpp::HKY85, bpp::F84, bpp::KroneckerCodonDistanceFrequenciesSubstitutionModel, bpp::AbstractFromSubstitutionModelTransitionModel, bpp::JCprot, bpp::T92, bpp::KroneckerCodonDistanceSubstitutionModel, bpp::K80, bpp::RE08, bpp::RN95, bpp::MixtureOfSubstitutionModels, bpp::GTR, bpp::TN93, bpp::JCnuc, bpp::CodonDistanceFrequenciesSubstitutionModel, bpp::KroneckerWordSubstitutionModel, bpp::RN95s, bpp::BinarySubstitutionModel, bpp::CodonDistancePhaseFrequenciesSubstitutionModel, bpp::MixtureOfASubstitutionModel, bpp::WordSubstitutionModel, bpp::CodonDistanceCpGSubstitutionModel, bpp::LLG08_EX3, bpp::UserProteinSubstitutionModel, bpp::LLG08_EHO, bpp::LLG08_UL3, bpp::CodonDistanceSubstitutionModel, bpp::LG10_EX_EHO, bpp::LGL08_CAT, bpp::LLG08_EX2, bpp::LLG08_UL2, bpp::SSR, bpp::WAG01, bpp::YNGP_M1, bpp::YNGP_M10, bpp::YNGP_M9, bpp::G2001, bpp::L95, bpp::CodonRateFrequenciesSubstitutionModel, bpp::YNGP_M8, bpp::DSO78, bpp::JTT92, bpp::GY94, bpp::SENCA, bpp::YNGP_M7, bpp::YNGP_M3, bpp::gBGC, bpp::LG08, bpp::YN98, bpp::YNGP_M2, bpp::KCM, bpp::TS98, bpp::TripletSubstitutionModel, bpp::CodonRateSubstitutionModel, bpp::MG94, 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::AbstractFromSubstitutionModelTransitionModel::getName(), bpp::FromMixtureSubstitutionModel::getName(), bpp::MixtureOfSubstitutionModels::getSubmodelNumbers(), bpp::BppOSubstitutionModelFormat::read(), bpp::BppOSubstitutionModelFormat::readMixed_(), bpp::AbstractBiblioSubstitutionModel::updateMatrices(), and bpp::BppOSubstitutionModelFormat::write().

virtual size_t bpp::TransitionModel::getNumberOfStates ( ) const
pure virtualinherited

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.

Implemented in bpp::RE08Codon, bpp::RE08Protein, bpp::RE08Nucleotide, bpp::AbstractWordSubstitutionModel, bpp::AbstractMixedSubstitutionModel, bpp::RE08, bpp::MarkovModulatedSubstitutionModel, bpp::YpR, bpp::FromMixtureSubstitutionModel, bpp::AbstractBiblioSubstitutionModel, bpp::BinarySubstitutionModel, bpp::AbstractFromSubstitutionModelTransitionModel, bpp::gBGC, bpp::NucleotideSubstitutionModel, and bpp::ProteinSubstitutionModel.

Referenced by bpp::SubstitutionModelSet::addModel(), bpp::OneJumpSubstitutionCount::getAllNumbersOfSubstitutions(), bpp::AbstractFromSubstitutionModelTransitionModel::getNumberOfStates(), bpp::TwoTreeLikelihood::getNumberOfStates(), bpp::AbstractHomogeneousTreeLikelihood::getNumberOfStates(), bpp::AbstractBiblioSubstitutionModel::getNumberOfStates(), bpp::FromMixtureSubstitutionModel::getNumberOfStates(), bpp::BranchLikelihood::initModel(), bpp::RE08::RE08(), bpp::CategorySubstitutionRegister::setModelCategories(), bpp::UniformizationSubstitutionCount::setSubstitutionModel(), bpp::DecompositionSubstitutionCount::setSubstitutionModel(), bpp::DecompositionReward::setSubstitutionModel(), bpp::AbstractHomogeneousTreeLikelihood::setSubstitutionModel(), bpp::SimpleMutationProcess::SimpleMutationProcess(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().

virtual const Matrix<double>& bpp::SubstitutionModel::getRowLeftEigenVectors ( ) const
pure virtualinherited
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, bpp::AbstractBiblioSubstitutionModel, and bpp::FromMixtureSubstitutionModel.

Referenced by bpp::FromMixtureSubstitutionModel::getScale(), and bpp::AbstractBiblioSubstitutionModel::getScale().

virtual bool bpp::SubstitutionModel::isDiagonalizable ( ) const
pure virtualinherited
virtual bool bpp::SubstitutionModel::isNonSingular ( ) const
pure virtualinherited
virtual void bpp::TransitionModel::setFreqFromData ( const SequenceContainer data,
double  pseudoCount = 0 
)
pure virtualinherited
virtual void bpp::SubstitutionModel::setScalable ( bool  scalable)
pure virtualinherited
virtual void bpp::SubstitutionModel::setScale ( double  scale)
pure virtualinherited
virtual double bpp::SubstitutionModel::Sij ( size_t  i,
size_t  j 
) const
pure virtualinherited

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