bpp-phyl
2.2.0
|
The Yang and Nielsen (1998) substitution model for codons. More...
#include <Bpp/Phyl/Model/Codon/YN98.h>
Public Member Functions | |
YN98 (const GeneticCode *gc, FrequenciesSet *codonFreqs) | |
YN98 (const YN98 &yn98) | |
YN98 & | operator= (const YN98 &) |
virtual | ~YN98 () |
YN98 * | clone () const |
std::string | getName () const |
Get the name of the model. More... | |
const SubstitutionModel & | getModel () const |
const GeneticCode * | getGeneticCode () const |
double | getCodonsMulRate (size_t i, size_t j) 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. More... | |
const std::vector< int > & | getAlphabetStates () const |
const StateMap & | getStateMap () const |
int | getAlphabetStateAsInt (size_t i) const |
std::string | getAlphabetStateAsChar (size_t i) const |
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 double | freq (size_t i) const |
virtual double | Qij (size_t i, size_t j) const |
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 |
virtual double | d2Pij_dt2 (size_t i, size_t j, double t) const |
virtual const Vdouble & | getFrequencies () const |
const Matrix< double > & | getGenerator () const |
const Matrix< double > & | getExchangeabilityMatrix () const |
double | Sij (size_t i, size_t j) 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 |
void | enableEigenDecomposition (bool yn) |
Set if eigenValues and Vectors must be computed. More... | |
bool | enableEigenDecomposition () |
Tell if eigenValues and Vectors must be computed. More... | |
bool | isDiagonalizable () const |
bool | isNonSingular () const |
const Vdouble & | getEigenValues () const |
const Vdouble & | getIEigenValues () const |
const Matrix< double > & | getRowLeftEigenVectors () const |
const Matrix< double > & | getColumnRightEigenVectors () const |
double | getRate () const |
Get the rate. More... | |
void | setRate (double rate) |
Set the rate of the model (must be positive). More... | |
void | addRateParameter () |
void | setFreqFromData (const SequenceContainer &data, double pseudoCount=0) |
Set equilibrium frequencies equal to the frequencies estimated from the data. More... | |
void | setFreq (std::map< int, double > &frequ) |
Set equilibrium frequencies. More... | |
const Alphabet * | getAlphabet () const |
size_t | getNumberOfStates () const |
Get the number of states. More... | |
double | getInitValue (size_t i, int state) const throw (BadIntException) |
const FrequenciesSet * | getFrequenciesSet () const |
If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0. More... | |
virtual void | fireParameterChanged (const ParameterList ¶meters) |
Tells the model that a parameter value has changed. 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... | |
void | setScale (double scale) |
Multiplies the current generator by the given scale. More... | |
Protected Member Functions | |
virtual 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 | |
SubstitutionModel & | getModel () |
Private Attributes | |
std::auto_ptr< CodonDistanceFrequenciesSubstitutionModel > | pmodel_ |
The Yang and Nielsen (1998) substitution model for codons.
This model has one rate of transitions and one rate of transversion. It also allows distinct equilibrium frequencies between codons. A multiplicative factor accounts for the selective restraints at the amino acid level, depending on the synonymy of the amino acids.
For codons and
, the generator term
is:
0 if 2 or 3 of the pair are different.
if exactly 1 of the pairs
is different, that difference is a transversion and amino acids coded by i and j are different.
if exactly 1 of the pairs
is different, that difference is a transversion and amino acids coded by i and j are the same.
if exactly 1 of the pairs
is different, that difference is a transition and amino acids coded by i and j are different.
if exactly 1 of the pairs
is different, that difference is a transition and amino acids coded by
and
are the same.
is a normalization factor.
This model includes 2 parameters ( and
). The codon frequencies
are either observed or infered.
Reference:
YN98::YN98 | ( | const GeneticCode * | gc, |
FrequenciesSet * | codonFreqs | ||
) |
Definition at line 51 of file YN98.cpp.
References bpp::AbstractBiblioSubstitutionModel::lParPmodel_, bpp::AbstractBiblioSubstitutionModel::mapParNamesFromPmodel_, pmodel_, and bpp::AbstractBiblioSubstitutionModel::updateMatrices().
Referenced by clone().
|
virtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 84 of file AbstractBiblioSubstitutionModel.cpp.
References bpp::SubstitutionModel::addRateParameter(), bpp::AbstractBiblioSubstitutionModel::getModel(), bpp::AbstractBiblioSubstitutionModel::getRate(), bpp::AbstractBiblioSubstitutionModel::lParPmodel_, and bpp::AbstractBiblioSubstitutionModel::mapParNamesFromPmodel_.
|
inlinevirtual |
Implements bpp::AbstractBiblioSubstitutionModel.
Definition at line 105 of file YN98.h.
References YN98().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 112 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::d2Pij_dt2(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 111 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::dPij_dt(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
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().
|
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().
|
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().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 106 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::freq(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 153 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getAlphabet(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
index | The model state. |
Implements bpp::SubstitutionModel.
Definition at line 100 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getAlphabetStateAsChar(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
index | The model state. |
Implements bpp::SubstitutionModel.
Definition at line 98 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getAlphabetStateAsInt(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
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(), bpp::YNGKP_M2::YNGKP_M2(), bpp::YNGKP_M3::YNGKP_M3(), bpp::YNGKP_M7::YNGKP_M7(), and bpp::YNGKP_M8::YNGKP_M8().
|
inlinevirtual |
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.
Definition at line 114 of file YN98.h.
References pmodel_.
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 141 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getColumnRightEigenVectors(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 126 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getd2Pij_dt2(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 124 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getdPij_dt(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 136 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getEigenValues(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 118 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getExchangeabilityMatrix(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 114 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getFrequencies(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0.
Reimplemented from bpp::SubstitutionModel.
Reimplemented in bpp::YNGKP_M1, bpp::YNGKP_M8, bpp::YNGKP_M7, bpp::YNGKP_M3, and bpp::YNGKP_M2.
Definition at line 159 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getFrequenciesSet(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtualinherited |
See Kosiol and Goldman (2005), Molecular Biology And Evolution 22(2) 193-9.
Implements bpp::SubstitutionModel.
Definition at line 116 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getGenerator(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtual |
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 138 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getIEigenValues(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
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.
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 157 of file AbstractBiblioSubstitutionModel.h.
References bpp::SubstitutionModel::getInitValue(), and bpp::AbstractBiblioSubstitutionModel::getModel().
|
inlinevirtual |
Implements bpp::AbstractBiblioSubstitutionModel.
Definition at line 110 of file YN98.h.
References pmodel_.
|
inlineprivatevirtual |
Implements bpp::AbstractBiblioSubstitutionModel.
Definition at line 117 of file YN98.h.
References pmodel_.
|
inlinevirtualinherited |
Get the state in the model corresponding to a particular state in the alphabet.
code | The alphabet state to check. |
Implements bpp::SubstitutionModel.
Definition at line 102 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getModelStates().
|
inlinevirtualinherited |
Get the state in the model corresponding to a particular state in the alphabet.
code | The alphabet state to check. |
Implements bpp::SubstitutionModel.
Definition at line 104 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getModelStates().
|
inlinevirtual |
|
inlinevirtualinherited |
Get the number of states.
For most models, this equals the size of the alphabet.
Implements bpp::SubstitutionModel.
Definition at line 155 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getNumberOfStates().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 122 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getPij_t().
|
inlinevirtualinherited |
Get the rate.
Implements bpp::SubstitutionModel.
Definition at line 143 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getRate().
Referenced by bpp::AbstractBiblioSubstitutionModel::addRateParameter(), bpp::LG10_EX_EHO::LG10_EX_EHO(), bpp::LGL08_CAT::LGL08_CAT(), bpp::LLG08_EHO::LLG08_EHO(), bpp::LLG08_EX2::LLG08_EX2(), bpp::LLG08_EX3::LLG08_EX3(), bpp::LLG08_UL2::LLG08_UL2(), and bpp::LLG08_UL3::LLG08_UL3().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 140 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getRowLeftEigenVectors().
|
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.
Implements bpp::SubstitutionModel.
Definition at line 190 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getScale().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 96 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::getStateMap().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 132 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::isDiagonalizable().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 134 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::isNonSingular().
Definition at line 80 of file YN98.cpp.
References bpp::AbstractBiblioSubstitutionModel::operator=(), and pmodel_.
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 110 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::Pij_t().
|
inlinevirtualinherited |
Implements bpp::SubstitutionModel.
Definition at line 108 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::Qij().
|
virtualinherited |
Set equilibrium frequencies.
frequencies | The 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().
|
virtualinherited |
Set equilibrium frequencies equal to the frequencies estimated from the data.
data | The sequences to use. |
pseudoCount | A quantity ![]()
|
Implements bpp::SubstitutionModel.
Definition at line 110 of file AbstractBiblioSubstitutionModel.cpp.
References bpp::AbstractBiblioSubstitutionModel::getModel(), bpp::AbstractBiblioSubstitutionModel::mapParNamesFromPmodel_, and bpp::SubstitutionModel::setFreqFromData().
|
inlinevirtualinherited |
Set the rate of the model (must be positive).
rate | must be positive. |
Implements bpp::SubstitutionModel.
Definition at line 145 of file AbstractBiblioSubstitutionModel.h.
References bpp::AbstractBiblioSubstitutionModel::getModel(), and bpp::SubstitutionModel::setRate().
|
inlinevirtualinherited |
Multiplies the current generator by the given scale.
scale | the 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().
|
inlinevirtualinherited |
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().
|
protectedvirtualinherited |
Reimplemented in bpp::YNGKP_M1, bpp::YNGKP_M8, bpp::YNGKP_M7, bpp::YNGKP_M3, and bpp::YNGKP_M2.
Definition at line 70 of file AbstractBiblioSubstitutionModel.cpp.
References bpp::AbstractBiblioSubstitutionModel::getModel(), bpp::SubstitutionModel::getName(), bpp::AbstractBiblioSubstitutionModel::lParPmodel_, and bpp::AbstractBiblioSubstitutionModel::mapParNamesFromPmodel_.
Referenced by bpp::AbstractBiblioSubstitutionModel::fireParameterChanged(), bpp::GY94::GY94(), bpp::LG10_EX_EHO::LG10_EX_EHO(), bpp::LGL08_CAT::LGL08_CAT(), bpp::LLG08_EHO::LLG08_EHO(), bpp::LLG08_EX2::LLG08_EX2(), bpp::LLG08_EX3::LLG08_EX3(), bpp::LLG08_UL2::LLG08_UL2(), bpp::LLG08_UL3::LLG08_UL3(), bpp::MG94::MG94(), bpp::YNGKP_M2::updateMatrices(), bpp::YNGKP_M7::updateMatrices(), bpp::YNGKP_M8::updateMatrices(), bpp::YNGKP_M1::updateMatrices(), and YN98().
|
protectedinherited |
Definition at line 70 of file AbstractBiblioSubstitutionModel.h.
Referenced by bpp::AbstractBiblioSubstitutionModel::addRateParameter(), bpp::GY94::GY94(), bpp::LG10_EX_EHO::LG10_EX_EHO(), bpp::LGL08_CAT::LGL08_CAT(), bpp::LLG08_EHO::LLG08_EHO(), bpp::LLG08_EX2::LLG08_EX2(), bpp::LLG08_EX3::LLG08_EX3(), bpp::LLG08_UL2::LLG08_UL2(), bpp::LLG08_UL3::LLG08_UL3(), bpp::MG94::MG94(), bpp::AbstractBiblioSubstitutionModel::operator=(), bpp::YNGKP_M3::updateMatrices(), bpp::AbstractBiblioSubstitutionModel::updateMatrices(), YN98(), bpp::YNGKP_M1::YNGKP_M1(), bpp::YNGKP_M2::YNGKP_M2(), bpp::YNGKP_M3::YNGKP_M3(), bpp::YNGKP_M7::YNGKP_M7(), and bpp::YNGKP_M8::YNGKP_M8().
|
protectedinherited |
Tools to make the link between the Parameters of the object and those of pmixmodel_.
Definition at line 68 of file AbstractBiblioSubstitutionModel.h.
Referenced by bpp::AbstractBiblioSubstitutionModel::addRateParameter(), bpp::GY94::GY94(), bpp::LG10_EX_EHO::LG10_EX_EHO(), bpp::LGL08_CAT::LGL08_CAT(), bpp::LLG08_EHO::LLG08_EHO(), bpp::LLG08_EX2::LLG08_EX2(), bpp::LLG08_EX3::LLG08_EX3(), bpp::LLG08_UL2::LLG08_UL2(), bpp::LLG08_UL3::LLG08_UL3(), bpp::MG94::MG94(), bpp::AbstractBiblioSubstitutionModel::operator=(), bpp::AbstractBiblioSubstitutionModel::setFreq(), bpp::AbstractBiblioSubstitutionModel::setFreqFromData(), bpp::YNGKP_M3::updateMatrices(), bpp::AbstractBiblioSubstitutionModel::updateMatrices(), YN98(), bpp::YNGKP_M1::YNGKP_M1(), bpp::YNGKP_M2::YNGKP_M2(), bpp::YNGKP_M3::YNGKP_M3(), bpp::YNGKP_M7::YNGKP_M7(), and bpp::YNGKP_M8::YNGKP_M8().
|
private |
Definition at line 94 of file YN98.h.
Referenced by getCodonsMulRate(), getGeneticCode(), getModel(), operator=(), and YN98().