|
bpp-phyl
2.1.0
|
Tuffley and Steel's 1998 covarion model. More...
#include <Bpp/Phyl/Model/TS98.h>
Inheritance diagram for bpp::TS98:
Collaboration diagram for bpp::TS98:Public Member Functions | |
| TS98 (ReversibleSubstitutionModel *model, double s1=1., double s2=1., bool normalizeRateChanges=false) | |
| Build a new TS98 substitution model. | |
| virtual | ~TS98 () |
| TS98 * | clone () const |
| std::string | getName () const |
| Get the name of the model. | |
| double | getRate () const |
| Get the rate. | |
| void | setRate (double rate) |
| Set the rate of the model (must be positive). | |
| void | addRateParameter () |
| const Alphabet * | getAlphabet () const |
| size_t | getNumberOfStates () const |
| Get the number of states. | |
| const Vdouble & | getFrequencies () const |
| const Matrix< double > & | getExchangeabilityMatrix () const |
| const Matrix< double > & | getGenerator () const |
| const Matrix< double > & | getPij_t (double t) const |
| const Matrix< double > & | getdPij_dt (double t) const |
| const Matrix< double > & | getd2Pij_dt2 (double t) const |
| const Vdouble & | getEigenValues () const |
| const Vdouble & | getIEigenValues () const |
| bool | isDiagonalizable () const |
| bool | isNonSingular () const |
| const Matrix< double > & | getRowLeftEigenVectors () const |
| const Matrix< double > & | getColumnRightEigenVectors () const |
| double | freq (size_t i) const |
| double | Sij (size_t i, size_t j) const |
| double | Qij (size_t i, size_t j) const |
| double | Pij_t (size_t i, size_t j, double t) const |
| double | dPij_dt (size_t i, size_t j, double t) const |
| double | d2Pij_dt2 (size_t i, size_t j, double t) const |
| double | getInitValue (size_t i, int state) const throw (IndexOutOfBoundsException, BadIntException) |
| void | setFreqFromData (const SequenceContainer &data, double pseudoCount=0) |
| Set equilibrium frequencies equal to the frequencies estimated from the data. | |
| const std::vector< int > & | getAlphabetChars () const |
| int | getAlphabetChar (size_t i) const |
| Get the char in the alphabet corresponding to a given state in the model. | |
| std::vector< size_t > | getModelStates (int i) const |
| Get the state in the model corresponding to a particular char in the alphabet. | |
| const ReversibleSubstitutionModel * | getNestedModel () const |
| size_t | getRate (size_t i) const |
| Get the rate category corresponding to a particular state in the compound model. | |
| 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. | |
| void | setScale (double scale) |
| Set the rate of the generator, defined as the scalar product of diagonal elements of the generator and the frequencies vector. | |
| void | enableEigenDecomposition (bool yn) |
| Set if eigenValues and Vectors must be computed. | |
| bool | enableEigenDecomposition () |
| Tell if eigenValues and Vectors must be computed. | |
| virtual void | fireParameterChanged (const ParameterList ¶meters) |
| Tells the model that a parameter value has changed. | |
| void | setNamespace (const std::string &prefix) |
| virtual void | setFreq (std::map< int, double > &frequencies) |
| Set equilibrium frequencies. | |
| virtual const FrequenciesSet * | getFrequenciesSet () const |
| If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0. | |
| virtual size_t | getNumberOfIndependentParameters () const =0 |
| size_t | getNumberOfIndependentParameters () const |
| virtual void | aliasParameters (const std::string &p1, const std::string &p2)=0 |
| void | aliasParameters (const std::string &p1, const std::string &p2) |
| virtual void | unaliasParameters (const std::string &p1, const std::string &p2)=0 |
| void | unaliasParameters (const std::string &p1, const std::string &p2) |
| virtual const ParameterList & | getIndependentParameters () const =0 |
| const ParameterList & | getIndependentParameters () const |
| virtual std::vector< std::string > | getAlias (const std::string &name) const =0 |
| std::vector< std::string > | getAlias (const std::string &name) const |
| virtual bool | hasParameter (const std::string &name) const =0 |
| bool | hasParameter (const std::string &name) const |
| virtual const ParameterList & | getParameters () const =0 |
| const ParameterList & | getParameters () const |
| virtual const Parameter & | getParameter (const std::string &name) const =0 |
| const Parameter & | getParameter (const std::string &name) const |
| virtual double | getParameterValue (const std::string &name) const =0 |
| double | getParameterValue (const std::string &name) const |
| virtual void | setAllParametersValues (const ParameterList ¶meters)=0 |
| void | setAllParametersValues (const ParameterList ¶meters) |
| virtual void | setParameterValue (const std::string &name, double value)=0 |
| void | setParameterValue (const std::string &name, double value) |
| virtual void | setParametersValues (const ParameterList ¶meters)=0 |
| void | setParametersValues (const ParameterList ¶meters) |
| virtual bool | matchParametersValues (const ParameterList ¶meters)=0 |
| bool | matchParametersValues (const ParameterList ¶meters) |
| virtual size_t | getNumberOfParameters () const =0 |
| size_t | getNumberOfParameters () const |
| virtual std::string | getNamespace () const =0 |
| std::string | getNamespace () const |
| virtual std::string | getParameterNameWithoutNamespace (const std::string &name) const =0 |
| std::string | getParameterNameWithoutNamespace (const std::string &name) const |
| std::string | getFrom (const std::string &name) const |
Protected Member Functions | |
| void | updateRatesModel () |
| Update the rates vector, generator and equilibrium frequencies. | |
| virtual void | updateMatrices () |
| void | addParameter_ (Parameter *parameter) |
| void | addParameters_ (const ParameterList ¶meters) |
| void | deleteParameter_ (size_t index) |
| void | resetParameters_ () |
| Parameter & | getParameter_ (const std::string &name) |
| Parameter & | getParameter_ (size_t index) |
| const Parameter & | getParameter_ (size_t index) const |
| Parameter & | getParameterWithNamespace_ (const std::string &name) |
| const Parameter & | getParameterWithNamespace_ (const std::string &name) const |
| ParameterList & | getParameters_ () |
Protected Attributes | |
| ReversibleSubstitutionModel * | model_ |
| size_t | nbStates_ |
| size_t | nbRates_ |
| RowMatrix< double > | ratesGenerator_ |
| std::vector< int > | chars_ |
| The list of supported chars. | |
| RowMatrix< double > | generator_ |
The generator matrix of the model. | |
| RowMatrix< double > | exchangeability_ |
The exchangeability matrix of the model. | |
| RowMatrix< double > | leftEigenVectors_ |
The matrix made of left eigen vectors (by row). | |
| RowMatrix< double > | rightEigenVectors_ |
The matrix made of right eigen vectors (by column). | |
| Vdouble | eigenValues_ |
| The vector of real parts of eigen values. | |
| Vdouble | iEigenValues_ |
| The vector of imaginary parts of the eigen values (zero in case of reversible pmodel). | |
| bool | eigenDecompose_ |
| Tell if the eigen decomposition should be performed. | |
| RowMatrix< double > | pijt_ |
| These ones are for bookkeeping: | |
| RowMatrix< double > | dpijt_ |
| RowMatrix< double > | d2pijt_ |
| Vdouble | freq_ |
| The vector of equilibrium frequencies. | |
| bool | normalizeRateChanges_ |
| std::string | nestedPrefix_ |
Rate generator. | |
These variables must be initialized in the constructor of the derived class. | |
| RowMatrix< double > | rates_ |
| RowMatrix< double > | ratesExchangeability_ |
| Vdouble | ratesFreq_ |
Tuffley and Steel's 1998 covarion model.
This model is a subclass of the so-called Markov-modulated substitution models, with a rate matrix
and
This model was originally designed for nucleotides sequences, but it can be used with other alphabets.
Tuffley C. and Steel M. A., Modelling the covarion hypothesis of nucleotide substitution (1998), _Math. Biosci._, 147:63-91.
| bpp::TS98::TS98 | ( | ReversibleSubstitutionModel * | model, |
| double | s1 = 1., |
||
| double | s2 = 1., |
||
| bool | normalizeRateChanges = false |
||
| ) | [inline] |
Build a new TS98 substitution model.
| model | The substitution model to use. May be of any alphabet type. |
| s1 | First rate parameter. |
| s2 | Second rate parameter. |
| normalizeRateChanges | Tell if the rate transition matrix should be normalized. |
Definition at line 89 of file TS98.h.
References bpp::AbstractParameterAliasable::addParameter_(), bpp::MarkovModulatedSubstitutionModel::nbRates_, bpp::Parameter::R_PLUS_STAR, bpp::MarkovModulatedSubstitutionModel::rates_, bpp::MarkovModulatedSubstitutionModel::ratesExchangeability_, bpp::MarkovModulatedSubstitutionModel::ratesFreq_, bpp::RowMatrix< Scalar >::resize(), bpp::MarkovModulatedSubstitutionModel::updateMatrices(), and updateRatesModel().
Referenced by clone().
| virtual bpp::TS98::~TS98 | ( | ) | [inline, virtual] |
| void bpp::TS98::addRateParameter | ( | ) | [inline, virtual] |
Implements bpp::SubstitutionModel.
| TS98* bpp::TS98::clone | ( | ) | const [inline, virtual] |
Implements bpp::MarkovModulatedSubstitutionModel.
Definition at line 109 of file TS98.h.
References TS98().
| double bpp::MarkovModulatedSubstitutionModel::d2Pij_dt2 | ( | size_t | i, |
| size_t | j, | ||
| double | t | ||
| ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 220 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::getd2Pij_dt2().
| double bpp::MarkovModulatedSubstitutionModel::dPij_dt | ( | size_t | i, |
| size_t | j, | ||
| double | t | ||
| ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 219 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::getdPij_dt().
| void bpp::MarkovModulatedSubstitutionModel::enableEigenDecomposition | ( | bool | yn | ) | [inline, virtual, inherited] |
Set if eigenValues and Vectors must be computed.
Implements bpp::SubstitutionModel.
Definition at line 280 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::eigenDecompose_.
| bool bpp::MarkovModulatedSubstitutionModel::enableEigenDecomposition | ( | ) | [inline, virtual, inherited] |
Tell if eigenValues and Vectors must be computed.
Implements bpp::SubstitutionModel.
Definition at line 282 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::eigenDecompose_.
| virtual void bpp::MarkovModulatedSubstitutionModel::fireParameterChanged | ( | const ParameterList & | parameters | ) | [inline, virtual, inherited] |
Tells the model that a parameter value has changed.
This updates the matrices consequently.
Reimplemented from bpp::AbstractParameterAliasable.
Reimplemented in bpp::G2001.
Definition at line 289 of file MarkovModulatedSubstitutionModel.h.
References bpp::ParameterAliasable::matchParametersValues(), bpp::MarkovModulatedSubstitutionModel::model_, bpp::MarkovModulatedSubstitutionModel::updateMatrices(), and bpp::MarkovModulatedSubstitutionModel::updateRatesModel().
| double bpp::MarkovModulatedSubstitutionModel::freq | ( | size_t | i | ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 214 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::freq_.
| const Alphabet* bpp::MarkovModulatedSubstitutionModel::getAlphabet | ( | ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 191 of file MarkovModulatedSubstitutionModel.h.
References bpp::SubstitutionModel::getAlphabet(), and bpp::MarkovModulatedSubstitutionModel::model_.
| int bpp::MarkovModulatedSubstitutionModel::getAlphabetChar | ( | size_t | i | ) | const [inline, virtual, inherited] |
Get the char in the alphabet corresponding to a given state in the model.
In most cases, this method will return i.
| i | The index of the state. |
Implements bpp::SubstitutionModel.
Definition at line 235 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::chars_.
| const std::vector<int>& bpp::MarkovModulatedSubstitutionModel::getAlphabetChars | ( | ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 230 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::chars_.
| const Matrix<double>& bpp::MarkovModulatedSubstitutionModel::getColumnRightEigenVectors | ( | ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 212 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::rightEigenVectors_.
| const Matrix< double > & MarkovModulatedSubstitutionModel::getd2Pij_dt2 | ( | double | t | ) | const [virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 196 of file MarkovModulatedSubstitutionModel.cpp.
References bpp::MarkovModulatedSubstitutionModel::d2pijt_, bpp::MarkovModulatedSubstitutionModel::eigenValues_, bpp::VectorTools::exp(), bpp::MarkovModulatedSubstitutionModel::leftEigenVectors_, bpp::MatrixTools::mult(), bpp::MarkovModulatedSubstitutionModel::rightEigenVectors_, and bpp::NumTools::sqr().
Referenced by bpp::MarkovModulatedSubstitutionModel::d2Pij_dt2().
| const Matrix< double > & MarkovModulatedSubstitutionModel::getdPij_dt | ( | double | t | ) | const [virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 190 of file MarkovModulatedSubstitutionModel.cpp.
References bpp::MarkovModulatedSubstitutionModel::dpijt_, bpp::MarkovModulatedSubstitutionModel::eigenValues_, bpp::VectorTools::exp(), bpp::MarkovModulatedSubstitutionModel::leftEigenVectors_, bpp::MatrixTools::mult(), and bpp::MarkovModulatedSubstitutionModel::rightEigenVectors_.
Referenced by bpp::MarkovModulatedSubstitutionModel::dPij_dt().
| const Vdouble& bpp::MarkovModulatedSubstitutionModel::getEigenValues | ( | ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 205 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::eigenValues_.
| const Matrix<double>& bpp::MarkovModulatedSubstitutionModel::getExchangeabilityMatrix | ( | ) | const [inline, virtual, inherited] |
. Implements bpp::SubstitutionModel.
Definition at line 197 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::exchangeability_.
| const Vdouble& bpp::MarkovModulatedSubstitutionModel::getFrequencies | ( | ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 195 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::freq_.
| virtual const FrequenciesSet* bpp::SubstitutionModel::getFrequenciesSet | ( | ) | const [inline, virtual, inherited] |
If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0.
Reimplemented in bpp::JCprot, bpp::AbstractBiblioSubstitutionModel, bpp::UserProteinSubstitutionModel, bpp::WAG01, bpp::DSO78, bpp::JTT92, bpp::LG08, bpp::AbstractCodonPhaseFrequenciesSubstitutionModel, and bpp::AbstractCodonFrequenciesSubstitutionModel.
Definition at line 463 of file SubstitutionModel.h.
Referenced by bpp::AbstractBiblioSubstitutionModel::getFrequenciesSet(), and bpp::BppOSubstitutionModelFormat::write().
| const Matrix<double>& bpp::MarkovModulatedSubstitutionModel::getGenerator | ( | ) | const [inline, virtual, inherited] |
, meaning that $
, and (ii)
. This means that, under normalization, the mean rate of replacement at equilibrium is 1 and that time
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.
Implements bpp::SubstitutionModel.
Definition at line 199 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::generator_.
| const Vdouble& bpp::MarkovModulatedSubstitutionModel::getIEigenValues | ( | ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 206 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::iEigenValues_.
| double MarkovModulatedSubstitutionModel::getInitValue | ( | size_t | i, |
| int | state | ||
| ) | const throw (IndexOutOfBoundsException, BadIntException) [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.
| i | the index of the state in the model. |
| state | An observed state in the sequence/site. |
| IndexOutOfBoundsException | if array position is out of range. |
| BadIntException | if states are not allowed in the associated alphabet. |
Implements bpp::SubstitutionModel.
Definition at line 204 of file MarkovModulatedSubstitutionModel.cpp.
References bpp::Alphabet::getAlias(), and bpp::BadIntException::getAlphabet().
| std::vector<size_t> bpp::MarkovModulatedSubstitutionModel::getModelStates | ( | int | i | ) | const [inline, virtual, inherited] |
Get the state in the model corresponding to a particular char in the alphabet.
| i | The alphabet char to check. |
Implements bpp::SubstitutionModel.
Definition at line 240 of file MarkovModulatedSubstitutionModel.h.
References bpp::SubstitutionModel::getModelStates(), bpp::MarkovModulatedSubstitutionModel::model_, bpp::MarkovModulatedSubstitutionModel::nbRates_, and bpp::MarkovModulatedSubstitutionModel::nbStates_.
| std::string bpp::TS98::getName | ( | ) | const [inline, virtual] |
| const ReversibleSubstitutionModel* bpp::MarkovModulatedSubstitutionModel::getNestedModel | ( | ) | const [inline, inherited] |
Definition at line 250 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::model_.
Referenced by bpp::BppOSubstitutionModelFormat::write().
| size_t bpp::MarkovModulatedSubstitutionModel::getNumberOfStates | ( | ) | const [inline, virtual, inherited] |
Get the number of states.
For most models, this equals the size of the alphabet.
Implements bpp::SubstitutionModel.
Definition at line 193 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::nbRates_, and bpp::MarkovModulatedSubstitutionModel::nbStates_.
| const Matrix< double > & MarkovModulatedSubstitutionModel::getPij_t | ( | double | t | ) | const [virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 181 of file MarkovModulatedSubstitutionModel.cpp.
References bpp::MarkovModulatedSubstitutionModel::eigenValues_, bpp::VectorTools::exp(), bpp::MarkovModulatedSubstitutionModel::leftEigenVectors_, bpp::MatrixTools::mult(), bpp::MarkovModulatedSubstitutionModel::nbRates_, bpp::MarkovModulatedSubstitutionModel::nbStates_, bpp::MarkovModulatedSubstitutionModel::pijt_, and bpp::MarkovModulatedSubstitutionModel::rightEigenVectors_.
Referenced by bpp::MarkovModulatedSubstitutionModel::Pij_t().
| double bpp::TS98::getRate | ( | ) | const [inline, virtual] |
Get the rate.
Reimplemented from bpp::MarkovModulatedSubstitutionModel.
| size_t bpp::MarkovModulatedSubstitutionModel::getRate | ( | size_t | i | ) | const [inline, inherited] |
Get the rate category corresponding to a particular state in the compound model.
| i | The state. |
Definition at line 259 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::nbStates_.
| const Matrix<double>& bpp::MarkovModulatedSubstitutionModel::getRowLeftEigenVectors | ( | ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 211 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::leftEigenVectors_.
| double bpp::MarkovModulatedSubstitutionModel::getScale | ( | ) | const [inline, 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.
Implements bpp::SubstitutionModel.
Definition at line 268 of file MarkovModulatedSubstitutionModel.h.
References bpp::MatrixTools::diag(), bpp::MarkovModulatedSubstitutionModel::freq_, and bpp::MarkovModulatedSubstitutionModel::generator_.
| bool bpp::MarkovModulatedSubstitutionModel::isDiagonalizable | ( | ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 208 of file MarkovModulatedSubstitutionModel.h.
| bool bpp::MarkovModulatedSubstitutionModel::isNonSingular | ( | ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 209 of file MarkovModulatedSubstitutionModel.h.
| double bpp::MarkovModulatedSubstitutionModel::Pij_t | ( | size_t | i, |
| size_t | j, | ||
| double | t | ||
| ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 218 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::getPij_t().
| double bpp::MarkovModulatedSubstitutionModel::Qij | ( | size_t | i, |
| size_t | j | ||
| ) | const [inline, virtual, inherited] |
Implements bpp::SubstitutionModel.
Definition at line 216 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::generator_.
| virtual void bpp::SubstitutionModel::setFreq | ( | std::map< int, double > & | frequencies | ) | [inline, virtual, inherited] |
Set equilibrium frequencies.
| frequencies | The map of the frequencies to use. |
Reimplemented in bpp::AbstractSubstitutionModel, bpp::F84, bpp::HKY85, bpp::MixtureOfSubstitutionModels, bpp::T92, bpp::AbstractWordSubstitutionModel, bpp::GTR, bpp::CodonDistanceFrequenciesSubstitutionModel, bpp::RN95, bpp::TN93, bpp::CodonDistancePhaseFrequenciesSubstitutionModel, bpp::RN95s, bpp::CodonDistanceFitnessPhaseFrequenciesSubstitutionModel, bpp::MixtureOfASubstitutionModel, bpp::AbstractBiblioSubstitutionModel, bpp::BinarySubstitutionModel, bpp::SSR, bpp::L95, bpp::CodonRateFrequenciesSubstitutionModel, bpp::AbstractCodonPhaseFrequenciesSubstitutionModel, bpp::AbstractCodonFrequenciesSubstitutionModel, and bpp::AbstractCodonFitnessSubstitutionModel.
Definition at line 455 of file SubstitutionModel.h.
Referenced by bpp::AbstractBiblioSubstitutionModel::setFreq().
| void bpp::MarkovModulatedSubstitutionModel::setFreqFromData | ( | const SequenceContainer & | data, |
| double | pseudoCount = 0 |
||
| ) | [inline, virtual, inherited] |
Set equilibrium frequencies equal to the frequencies estimated from the data.
| data | The sequences to use. |
| pseudoCount | A quantity 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
|
Implements bpp::SubstitutionModel.
Definition at line 224 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::model_, bpp::SubstitutionModel::setFreqFromData(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
| void MarkovModulatedSubstitutionModel::setNamespace | ( | const std::string & | prefix | ) | [virtual, inherited] |
Reimplemented from bpp::AbstractParameterAliasable.
Reimplemented in bpp::G2001.
Definition at line 221 of file MarkovModulatedSubstitutionModel.cpp.
References bpp::MarkovModulatedSubstitutionModel::model_, bpp::MarkovModulatedSubstitutionModel::nestedPrefix_, and bpp::ParameterAliasable::setNamespace().
| void bpp::TS98::setRate | ( | double | rate | ) | [inline, virtual] |
Set the rate of the model (must be positive).
| rate | must be positive. |
Reimplemented from bpp::MarkovModulatedSubstitutionModel.
| void bpp::MarkovModulatedSubstitutionModel::setScale | ( | double | scale | ) | [inline, 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.
Implements bpp::SubstitutionModel.
Definition at line 275 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::model_, bpp::SubstitutionModel::setScale(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
| double bpp::MarkovModulatedSubstitutionModel::Sij | ( | size_t | i, |
| size_t | j | ||
| ) | const [inline, virtual, inherited] |
By definition Sij(i,j) = Sij(j,i).
Implements bpp::SubstitutionModel.
Definition at line 215 of file MarkovModulatedSubstitutionModel.h.
References bpp::MarkovModulatedSubstitutionModel::exchangeability_.
| void MarkovModulatedSubstitutionModel::updateMatrices | ( | ) | [protected, virtual, inherited] |
Definition at line 107 of file MarkovModulatedSubstitutionModel.cpp.
References bpp::MatrixTools::add(), bpp::MarkovModulatedSubstitutionModel::chars_, bpp::MarkovModulatedSubstitutionModel::d2pijt_, bpp::MatrixTools::diag(), bpp::MarkovModulatedSubstitutionModel::dpijt_, bpp::MarkovModulatedSubstitutionModel::eigenValues_, bpp::MarkovModulatedSubstitutionModel::exchangeability_, bpp::MarkovModulatedSubstitutionModel::freq_, bpp::MarkovModulatedSubstitutionModel::generator_, bpp::SubstitutionModel::getAlphabetChars(), bpp::SubstitutionModel::getColumnRightEigenVectors(), bpp::SubstitutionModel::getEigenValues(), bpp::SubstitutionModel::getExchangeabilityMatrix(), bpp::SubstitutionModel::getFrequencies(), bpp::SubstitutionModel::getGenerator(), bpp::RowMatrix< Scalar >::getNumberOfColumns(), bpp::SubstitutionModel::getNumberOfStates(), bpp::EigenValue< Real >::getRealEigenValues(), bpp::EigenValue< Real >::getV(), bpp::MarkovModulatedSubstitutionModel::iEigenValues_, bpp::MatrixTools::inv(), bpp::VectorTools::kroneckerMult(), bpp::MatrixTools::kroneckerMult(), bpp::MarkovModulatedSubstitutionModel::leftEigenVectors_, bpp::MarkovModulatedSubstitutionModel::model_, bpp::MatrixTools::mult(), bpp::MarkovModulatedSubstitutionModel::nbRates_, bpp::MarkovModulatedSubstitutionModel::nbStates_, bpp::MarkovModulatedSubstitutionModel::normalizeRateChanges_, bpp::MarkovModulatedSubstitutionModel::pijt_, bpp::MarkovModulatedSubstitutionModel::rates_, bpp::MarkovModulatedSubstitutionModel::ratesExchangeability_, bpp::MarkovModulatedSubstitutionModel::ratesFreq_, bpp::MarkovModulatedSubstitutionModel::ratesGenerator_, bpp::VectorTools::rep(), bpp::RowMatrix< Scalar >::resize(), bpp::MarkovModulatedSubstitutionModel::rightEigenVectors_, and bpp::MatrixTools::scale().
Referenced by bpp::MarkovModulatedSubstitutionModel::fireParameterChanged(), bpp::G2001::G2001(), bpp::MarkovModulatedSubstitutionModel::setFreqFromData(), bpp::MarkovModulatedSubstitutionModel::setScale(), and TS98().
| void bpp::TS98::updateRatesModel | ( | ) | [inline, protected, virtual] |
Update the rates vector, generator and equilibrium frequencies.
This method must be implemented by the derived class. It is called by the fireParameterChanged() method.
Implements bpp::MarkovModulatedSubstitutionModel.
Definition at line 121 of file TS98.h.
References bpp::AbstractParameterAliasable::getParameterValue(), bpp::MarkovModulatedSubstitutionModel::rates_, bpp::MarkovModulatedSubstitutionModel::ratesExchangeability_, and bpp::MarkovModulatedSubstitutionModel::ratesFreq_.
Referenced by TS98().
std::vector<int> bpp::MarkovModulatedSubstitutionModel::chars_ [protected, inherited] |
The list of supported chars.
Definition at line 100 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getAlphabetChar(), bpp::MarkovModulatedSubstitutionModel::getAlphabetChars(), bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
RowMatrix<double> bpp::MarkovModulatedSubstitutionModel::d2pijt_ [mutable, protected, inherited] |
Definition at line 143 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getd2Pij_dt2(), bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
RowMatrix<double> bpp::MarkovModulatedSubstitutionModel::dpijt_ [mutable, protected, inherited] |
Definition at line 142 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getdPij_dt(), bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
bool bpp::MarkovModulatedSubstitutionModel::eigenDecompose_ [protected, inherited] |
Tell if the eigen decomposition should be performed.
Definition at line 136 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::enableEigenDecomposition(), and bpp::MarkovModulatedSubstitutionModel::operator=().
Vdouble bpp::MarkovModulatedSubstitutionModel::eigenValues_ [protected, inherited] |
The vector of real parts of eigen values.
Definition at line 125 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getd2Pij_dt2(), bpp::MarkovModulatedSubstitutionModel::getdPij_dt(), bpp::MarkovModulatedSubstitutionModel::getEigenValues(), bpp::MarkovModulatedSubstitutionModel::getPij_t(), bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
RowMatrix<double> bpp::MarkovModulatedSubstitutionModel::exchangeability_ [protected, inherited] |
The exchangeability matrix
of the model.
Definition at line 110 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getExchangeabilityMatrix(), bpp::MarkovModulatedSubstitutionModel::operator=(), bpp::MarkovModulatedSubstitutionModel::Sij(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
Vdouble bpp::MarkovModulatedSubstitutionModel::freq_ [protected, inherited] |
The vector of equilibrium frequencies.
Definition at line 148 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::freq(), bpp::MarkovModulatedSubstitutionModel::getFrequencies(), bpp::MarkovModulatedSubstitutionModel::getScale(), bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
RowMatrix<double> bpp::MarkovModulatedSubstitutionModel::generator_ [protected, inherited] |
The generator matrix
of the model.
Definition at line 105 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getGenerator(), bpp::MarkovModulatedSubstitutionModel::getScale(), bpp::MarkovModulatedSubstitutionModel::operator=(), bpp::MarkovModulatedSubstitutionModel::Qij(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
Vdouble bpp::MarkovModulatedSubstitutionModel::iEigenValues_ [protected, inherited] |
The vector of imaginary parts of the eigen values (zero in case of reversible pmodel).
Definition at line 131 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getIEigenValues(), bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
RowMatrix<double> bpp::MarkovModulatedSubstitutionModel::leftEigenVectors_ [protected, inherited] |
The
matrix made of left eigen vectors (by row).
Definition at line 115 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getd2Pij_dt2(), bpp::MarkovModulatedSubstitutionModel::getdPij_dt(), bpp::MarkovModulatedSubstitutionModel::getPij_t(), bpp::MarkovModulatedSubstitutionModel::getRowLeftEigenVectors(), bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
ReversibleSubstitutionModel* bpp::MarkovModulatedSubstitutionModel::model_ [protected, inherited] |
Definition at line 81 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::fireParameterChanged(), bpp::MarkovModulatedSubstitutionModel::getAlphabet(), bpp::MarkovModulatedSubstitutionModel::getModelStates(), bpp::MarkovModulatedSubstitutionModel::getNestedModel(), bpp::MarkovModulatedSubstitutionModel::getRate(), bpp::MarkovModulatedSubstitutionModel::MarkovModulatedSubstitutionModel(), bpp::MarkovModulatedSubstitutionModel::operator=(), bpp::MarkovModulatedSubstitutionModel::setFreqFromData(), bpp::MarkovModulatedSubstitutionModel::setNamespace(), bpp::MarkovModulatedSubstitutionModel::setRate(), bpp::MarkovModulatedSubstitutionModel::setScale(), bpp::MarkovModulatedSubstitutionModel::updateMatrices(), and bpp::MarkovModulatedSubstitutionModel::~MarkovModulatedSubstitutionModel().
size_t bpp::MarkovModulatedSubstitutionModel::nbRates_ [protected, inherited] |
Definition at line 83 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::G2001::G2001(), bpp::MarkovModulatedSubstitutionModel::getModelStates(), bpp::MarkovModulatedSubstitutionModel::getNumberOfStates(), bpp::MarkovModulatedSubstitutionModel::getPij_t(), bpp::MarkovModulatedSubstitutionModel::operator=(), TS98(), bpp::MarkovModulatedSubstitutionModel::updateMatrices(), and bpp::G2001::updateRatesModel().
size_t bpp::MarkovModulatedSubstitutionModel::nbStates_ [protected, inherited] |
Definition at line 82 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getModelStates(), bpp::MarkovModulatedSubstitutionModel::getNumberOfStates(), bpp::MarkovModulatedSubstitutionModel::getPij_t(), bpp::MarkovModulatedSubstitutionModel::getRate(), bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
std::string bpp::MarkovModulatedSubstitutionModel::nestedPrefix_ [protected, inherited] |
bool bpp::MarkovModulatedSubstitutionModel::normalizeRateChanges_ [protected, inherited] |
Definition at line 150 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
RowMatrix<double> bpp::MarkovModulatedSubstitutionModel::pijt_ [mutable, protected, inherited] |
These ones are for bookkeeping:
Definition at line 141 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getPij_t(), bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
RowMatrix<double> bpp::MarkovModulatedSubstitutionModel::rates_ [protected, inherited] |
Definition at line 91 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::G2001::G2001(), bpp::MarkovModulatedSubstitutionModel::operator=(), TS98(), bpp::MarkovModulatedSubstitutionModel::updateMatrices(), updateRatesModel(), and bpp::G2001::updateRatesModel().
RowMatrix<double> bpp::MarkovModulatedSubstitutionModel::ratesExchangeability_ [protected, inherited] |
Definition at line 92 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::G2001::G2001(), bpp::MarkovModulatedSubstitutionModel::operator=(), TS98(), bpp::MarkovModulatedSubstitutionModel::updateMatrices(), updateRatesModel(), and bpp::G2001::updateRatesModel().
Vdouble bpp::MarkovModulatedSubstitutionModel::ratesFreq_ [protected, inherited] |
Definition at line 93 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::G2001::G2001(), bpp::MarkovModulatedSubstitutionModel::operator=(), TS98(), bpp::MarkovModulatedSubstitutionModel::updateMatrices(), and updateRatesModel().
RowMatrix<double> bpp::MarkovModulatedSubstitutionModel::ratesGenerator_ [protected, inherited] |
Definition at line 95 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().
RowMatrix<double> bpp::MarkovModulatedSubstitutionModel::rightEigenVectors_ [protected, inherited] |
The
matrix made of right eigen vectors (by column).
Definition at line 120 of file MarkovModulatedSubstitutionModel.h.
Referenced by bpp::MarkovModulatedSubstitutionModel::getColumnRightEigenVectors(), bpp::MarkovModulatedSubstitutionModel::getd2Pij_dt2(), bpp::MarkovModulatedSubstitutionModel::getdPij_dt(), bpp::MarkovModulatedSubstitutionModel::getPij_t(), bpp::MarkovModulatedSubstitutionModel::operator=(), and bpp::MarkovModulatedSubstitutionModel::updateMatrices().