bpp-phyl  2.1.0
bpp::AbstractCodonPhaseFrequenciesSubstitutionModel Class Reference

Abstract Class for substitution models on codons parametrized by a frequency. More...

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

+ Inheritance diagram for bpp::AbstractCodonPhaseFrequenciesSubstitutionModel:
+ Collaboration diagram for bpp::AbstractCodonPhaseFrequenciesSubstitutionModel:

List of all members.

Public Member Functions

 AbstractCodonPhaseFrequenciesSubstitutionModel (FrequenciesSet *pfreq, const std::string &prefix)
 Build a AbstractCodonPhaseFrequenciesSubstitutionModel instance.
 AbstractCodonPhaseFrequenciesSubstitutionModel (const AbstractCodonPhaseFrequenciesSubstitutionModel &model)
AbstractCodonPhaseFrequenciesSubstitutionModeloperator= (const AbstractCodonPhaseFrequenciesSubstitutionModel &model)
virtual ~AbstractCodonPhaseFrequenciesSubstitutionModel ()
void fireParameterChanged (const ParameterList &parameters)
void setFreq (std::map< int, double > &frequencies)
 Set equilibrium frequencies.
const FrequenciesSetgetFrequenciesSet () const
 If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0.
void setNamespace (const std::string &prefix)
double getCodonsMulRate (size_t, size_t) const
 Returns the multiplicative rate specific to two codons specified by their number. The respective generator rate is this rate multiplied by the rate defined by the model defined on nucleotides.
virtual CodonSubstitutionModelclone () const =0
virtual const GeneticCodegetGeneticCode () 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
 Multiplies the current generator by the given scale.
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 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 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 std::string getNamespace () const =0
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const =0
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
std::vector< std::string > getAlias (const std::string &name) const
std::string getFrom (const std::string &name) const
bool hasParameter (const std::string &name) const
const ParameterListgetParameters () const
const ParametergetParameter (const std::string &name) const
double getParameterValue (const std::string &name) const
void setAllParametersValues (const ParameterList &parameters)
void setParameterValue (const std::string &name, double value)
void setParametersValues (const ParameterList &parameters)
bool matchParametersValues (const ParameterList &parameters)
size_t getNumberOfParameters () const
std::string getNamespace () const
std::string getParameterNameWithoutNamespace (const std::string &name) const
virtual Clonableclone () const =0

Protected Member Functions

void addParameter_ (Parameter *parameter)
void addParameters_ (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_ ()

Private Attributes

WordFrequenciesSetposfreqset_
 Position dependent version of Codon Frequencies Set.
std::string freqName_

Detailed Description

Abstract Class for substitution models on codons parametrized by a frequency.

Author:
Laurent Gu├ęguen

This class should be used with models which equilibrium distribution is fixed, ans does not depend on the parameters. Otherwise there may be problems of identifiability of the parameters.

If we denote $F$ the given frequencies for codons, $F_{j_k}$ is the frequency of letter $j$ in phase $k$.

For codons $i=i_1i_2i_3$ and $j=j_1j_2j_3$, the generator term defined from inherited and inheriting classes, $Q_{ij})$, is multiplied by the product of the $F_{j_k}$ for each $k \in 1, 2, 3$ such that $i_k \neq j_k$.

Definition at line 69 of file AbstractCodonPhaseFrequenciesSubstitutionModel.h.


Constructor & Destructor Documentation


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]
double AbstractCodonPhaseFrequenciesSubstitutionModel::getCodonsMulRate ( size_t  ,
size_t   
) const [virtual]

Returns the multiplicative rate specific to two codons specified by their number. The respective generator rate is this rate multiplied by the rate defined by the model defined on nucleotides.

Implements bpp::CodonSubstitutionModel.

Reimplemented in bpp::CodonDistancePhaseFrequenciesSubstitutionModel, and bpp::CodonDistanceFitnessPhaseFrequenciesSubstitutionModel.

Definition at line 111 of file AbstractCodonPhaseFrequenciesSubstitutionModel.cpp.

References bpp::FrequenciesSet::getFrequencies(), bpp::WordFrequenciesSet::getFrequenciesSetForLetter(), and posfreqset_.

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

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

Reimplemented from bpp::SubstitutionModel.

Definition at line 115 of file AbstractCodonPhaseFrequenciesSubstitutionModel.h.

References posfreqset_.

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::LG08, bpp::G2001, bpp::YNGKP_M1, bpp::YNGKP_M8, bpp::gBGC, 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::MixtureOfSubstitutionModels::getSubmodelNumbers(), bpp::BppOSubstitutionModelFormat::readMixed_(), bpp::AbstractBiblioSubstitutionModel::updateMatrices(), and bpp::BppOSubstitutionModelFormat::write().

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 bool bpp::SubstitutionModel::isDiagonalizable ( ) const [pure virtual, inherited]
virtual bool bpp::SubstitutionModel::isNonSingular ( ) const [pure virtual, inherited]
AbstractCodonPhaseFrequenciesSubstitutionModel& bpp::AbstractCodonPhaseFrequenciesSubstitutionModel::operator= ( const AbstractCodonPhaseFrequenciesSubstitutionModel model) [inline]
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::SubstitutionModel::setRate ( double  rate) [pure virtual, inherited]
virtual void bpp::SubstitutionModel::setScale ( double  scale) [pure virtual, inherited]

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

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


Member Data Documentation


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