bpp-phyl  2.1.0
bpp::RE08 Class Reference

The Rivas-Eddy substitution model with gap characters. More...

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

+ Inheritance diagram for bpp::RE08:
+ Collaboration diagram for bpp::RE08:

List of all members.

Public Member Functions

 RE08 (ReversibleSubstitutionModel *simpleModel, double lambda=0, double mu=0)
 Build a new Rivas & Eddy model from a standard substitution model.
 RE08 (const RE08 &model)
RE08operator= (const RE08 &model)
virtual ~RE08 ()
RE08clone () const
double Pij_t (size_t i, size_t j, double d) const
double dPij_dt (size_t i, size_t j, double d) const
double d2Pij_dt2 (size_t i, size_t j, double d) const
const Matrix< double > & getPij_t (double d) const
const Matrix< double > & getdPij_dt (double d) const
const Matrix< double > & getd2Pij_dt2 (double d) const
std::string getName () const
 Get the name of the model.
void setFreqFromData (const SequenceContainer &data)
 This method is forwarded to the simple model.
void fireParameterChanged (const ParameterList &parameters)
 Tells the model that a parameter value has changed.
size_t getNumberOfStates () const
 Get the number of states.
double getInitValue (size_t i, int state) const throw (IndexOutOfBoundsException, BadIntException)
void setNamespace (const std::string &prefix)
const SubstitutionModelgetNestedModel () const
const AlphabetgetAlphabet () const
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.
virtual const VdoublegetFrequencies () const
const Matrix< double > & getGenerator () const
const Matrix< double > & getExchangeabilityMatrix () const
double Sij (size_t i, size_t j) const
const VdoublegetEigenValues () const
const VdoublegetIEigenValues () const
bool isDiagonalizable () const
bool isNonSingular () const
const Matrix< double > & getRowLeftEigenVectors () const
const Matrix< double > & getColumnRightEigenVectors () const
virtual double freq (size_t i) const
virtual double Qij (size_t i, size_t j) const
void setFreqFromData (const SequenceContainer &data, double pseudoCount=0)
 Set equilibrium frequencies equal to the frequencies estimated from the data.
virtual void setFreq (std::map< int, double > &)
 Set equilibrium frequencies.
void enableEigenDecomposition (bool yn)
 Set if eigenValues and Vectors must be computed.
bool enableEigenDecomposition ()
 Tell if eigenValues and Vectors must be computed.
void addRateParameter ()
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)
 Multiplies the current generator by the given scale.
virtual double getRate () const
 Get the rate.
virtual void setRate (double rate)
 Set the rate of the model (must be positive).
virtual const FrequenciesSetgetFrequenciesSet () 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
virtual void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)=0
void aliasParameters (const std::string &p1, const std::string &p2)
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
virtual void unaliasParameters (const std::string &p1, const std::string &p2)=0
void unaliasParameters (const std::string &p1, const std::string &p2)
virtual const ParameterListgetIndependentParameters () const =0
const ParameterListgetIndependentParameters () 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 ParameterListgetParameters () const =0
const ParameterListgetParameters () const
virtual const ParametergetParameter (const std::string &name) const =0
const ParametergetParameter (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 &parameters)=0
void setAllParametersValues (const ParameterList &parameters)
virtual void setParameterValue (const std::string &name, double value)=0
void setParameterValue (const std::string &name, double value)
virtual void setParametersValues (const ParameterList &parameters)=0
void setParametersValues (const ParameterList &parameters)
virtual bool matchParametersValues (const ParameterList &parameters)=0
bool matchParametersValues (const ParameterList &parameters)
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
ParameterList getAliasedParameters (const ParameterList &pl) const
std::string getFrom (const std::string &name) const

Protected Member Functions

void updateMatrices ()
 Compute and diagonalize the $Q$ matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVectors_ matrices.
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_ ()

Protected Attributes

const Alphabetalphabet_
 The alphabet relevant to this model.
size_t size_
 The size of the generator, i.e. the number of states.
double rate_
 The rate of the model (default: 1). The generator (and all its vectorial components) is independent of the rate, since it should be normalized.
std::vector< int > chars_
 The list of supported chars.
RowMatrix< double > generator_
 The generator matrix $Q$ of the model.
Vdouble freq_
 The vector $\pi_e$ of equilibrium frequencies.
RowMatrix< double > exchangeability_
 The exchangeability matrix $S$ of the model, defined as $ S_{ij}=\frac{Q_{ij}}{\pi_j}$. When the model is reversible, this matrix is symetric.
RowMatrix< double > pijt_
 These ones are for bookkeeping:
RowMatrix< double > dpijt_
RowMatrix< double > d2pijt_
bool eigenDecompose_
 Tell if the eigen decomposition should be performed.
Vdouble eigenValues_
 The vector of eigen values.
Vdouble iEigenValues_
 The vector of the imaginary part of the eigen values.
bool isDiagonalizable_
 boolean value for diagonalizability in R of the generator_
RowMatrix< double > rightEigenVectors_
 The $U^-1$ matrix made of right eigen vectors (by column).
bool isNonSingular_
 boolean value for non-singularity of rightEigenVectors_
RowMatrix< double > leftEigenVectors_
 The $U$ matrix made of left eigen vectors (by row) if rightEigenVectors_ is non-singular.
std::vector< RowMatrix< double > > vPowGen_
 vector of the powers of generator_ for Taylor development (if rightEigenVectors_ is singular).
RowMatrix< double > tmpMat_
 For computational issues.

Private Attributes

ReversibleSubstitutionModelsimpleModel_
RowMatrix< double > simpleGenerator_
RowMatrix< double > simpleExchangeabilities_
double exp_
RowMatrix< double > p_
double lambda_
double mu_
std::string nestedPrefix_

Friends

class AbstractBiblioSubstitutionModel

Detailed Description

The Rivas-Eddy substitution model with gap characters.

This model expends any reversible substitution model with gaps as an additional state. Although the conditionnal subtitution process is reversible, the insertion/deletion process needs not be. The model hence adds two parameters for insertion and deletions, $\lambda$ and $\mu$. If we note $Q$ the (simple) transition matrix (= Markov generator) and $Q^\epsilon$ the extended one, we have:

\[ Q^\epsilon = \left( \begin{array}{ccc|c} & & & \mu \\ & \rule{0cm}{1cm}\rule{1cm}{0cm}Q-\mu\delta_{ij} & & \vdots \\ & & & \mu \\ \hline \lambda\pi_1 & \ldots & \lambda\pi_n & -\lambda \\ \end{array} \right) \]

where $n$ is the number of states of the simple model (in most case equal to the size of the alphabet) and $(\pi_1,\ldots,\pi_n)$ is the vector of equilibrium frequencies of the conditional model. $\delta_{ij}$ is 1 if i=j, 0 otherwise. Note that in the original paper $Q$ is noted as $R$, and $Q_t$ is used for the probability matrix, which is referred here as $P^\epsilon(t)$ for consistency with the documentation of other models.

The extended Markov model is reversible, and the equilibrium frequencies are

\[ \pi^\epsilon = \left( \pi \cdot \frac{\lambda}{\lambda + \mu}, \frac{\mu}{\lambda + \mu}\right). \]

The corresponding exchangeability matrix is:

\[ S^\epsilon = \left( \begin{array}{ccc|c} & & & \lambda + \mu \\ & \rule{0cm}{1cm}\rule{1cm}{0cm}(S - \frac{\mu\delta_{ij}}{\pi_i})\frac{\lambda+\mu}{\lambda} & & \vdots \\ & & & \lambda + \mu \\ \hline \lambda + \mu & \ldots & \lambda + \mu & - (\lambda + \mu) \\ \end{array} \right) \]

The eigen values and vectors are computed numerically, but the transition probabilities are computed analytically from the simple substitution model, together with the first and second order derivatives according to time.

Please note that the original Rivas and Eddy method uses this substitution model with a modification of the Felsenstein algorithm.

Reference:

  • Rivas E and Eddy SR (2008), _Probabilistic Phylogenetic Inference with Insertions and Deletions_, 4(9):e1000172, in _PLoS Computational Biology_.

Definition at line 96 of file RE08.h.


Constructor & Destructor Documentation

RE08::RE08 ( ReversibleSubstitutionModel simpleModel,
double  lambda = 0,
double  mu = 0 
)

Build a new Rivas & Eddy model from a standard substitution model.

The alphabet and number of states for the extended model will be derived from the simple one.

Parameters:
simpleModelThe simple model to use to build the extended one. THE RE08 class will own the simple one, meaning that it will be destroyed together with the RE08 instance, and cloned when cloning the RE08 instance. To prevent the original simple model to be destroyed, you should make a copy of it before creating the RE08 instance.
lambdaInsertion rate.
muDeletion rate.

Definition at line 50 of file RE08.cpp.

References bpp::AbstractParameterAliasable::addParameter_(), bpp::AbstractParameterAliasable::addParameters_(), bpp::AbstractSubstitutionModel::chars_, bpp::AbstractSubstitutionModel::eigenValues_, bpp::AbstractSubstitutionModel::exchangeability_, bpp::AbstractSubstitutionModel::freq_, bpp::AbstractSubstitutionModel::generator_, bpp::SubstitutionModel::getNumberOfStates(), bpp::ParameterAliasable::getParameters(), bpp::AbstractSubstitutionModel::leftEigenVectors_, nestedPrefix_, p_, bpp::Parameter::R_PLUS, bpp::RowMatrix< Scalar >::resize(), bpp::AbstractSubstitutionModel::rightEigenVectors_, bpp::ParameterAliasable::setNamespace(), simpleModel_, bpp::AbstractSubstitutionModel::size_, and updateMatrices().

Referenced by clone().

bpp::RE08::RE08 ( const RE08 model) [inline]

Definition at line 123 of file RE08.h.

virtual bpp::RE08::~RE08 ( ) [inline, virtual]

Definition at line 153 of file RE08.h.

References simpleModel_.


Member Function Documentation

RE08* bpp::RE08::clone ( ) const [inline, virtual]

Implements bpp::AbstractReversibleSubstitutionModel.

Definition at line 155 of file RE08.h.

References RE08().

double RE08::d2Pij_dt2 ( size_t  i,
size_t  j,
double  t 
) const [virtual]
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()

Reimplemented from bpp::AbstractSubstitutionModel.

Definition at line 183 of file RE08.cpp.

References bpp::SubstitutionModel::d2Pij_dt2(), bpp::SubstitutionModel::dPij_dt(), bpp::SubstitutionModel::freq(), bpp::AbstractSubstitutionModel::freq_, lambda_, mu_, bpp::SubstitutionModel::Pij_t(), simpleModel_, and bpp::AbstractSubstitutionModel::size_.

double RE08::dPij_dt ( size_t  i,
size_t  j,
double  t 
) const [virtual]
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()

Reimplemented from bpp::AbstractSubstitutionModel.

Definition at line 152 of file RE08.cpp.

References bpp::SubstitutionModel::dPij_dt(), bpp::SubstitutionModel::freq(), bpp::AbstractSubstitutionModel::freq_, lambda_, mu_, bpp::SubstitutionModel::Pij_t(), simpleModel_, and bpp::AbstractSubstitutionModel::size_.

void bpp::AbstractSubstitutionModel::enableEigenDecomposition ( bool  yn) [inline, virtual, inherited]

Set if eigenValues and Vectors must be computed.

Implements bpp::SubstitutionModel.

Definition at line 288 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::eigenDecompose_.

void bpp::RE08::fireParameterChanged ( const ParameterList parameters) [inline, virtual]

Tells the model that a parameter value has changed.

This updates the matrices consequently.

Reimplemented from bpp::AbstractSubstitutionModel.

Definition at line 175 of file RE08.h.

References bpp::AbstractParameterAliasable::getParameter_(), bpp::Parameter::getValue(), lambda_, bpp::ParameterAliasable::matchParametersValues(), mu_, simpleModel_, and updateMatrices().

virtual double bpp::AbstractSubstitutionModel::freq ( size_t  i) const [inline, virtual, inherited]
Returns:
Equilibrium frequency associated to character i.
See also:
getFrequencies(), getStates()

Implements bpp::SubstitutionModel.

Definition at line 274 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::freq_.

int bpp::AbstractSubstitutionModel::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.

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

Implements bpp::SubstitutionModel.

Definition at line 246 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::chars_.

const std::vector<int>& bpp::AbstractSubstitutionModel::getAlphabetChars ( ) const [inline, virtual, inherited]
Returns:
The supported states of the model, as a vector of int codes.
See also:
Alphabet

Implements bpp::SubstitutionModel.

Definition at line 244 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::chars_.

const Matrix<double>& bpp::AbstractSubstitutionModel::getColumnRightEigenVectors ( ) const [inline, virtual, inherited]
Returns:
A matrix with right eigen vectors. Each column in the matrix stands for an eigen vector.

Implements bpp::SubstitutionModel.

Definition at line 272 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::rightEigenVectors_.

const Matrix< double > & RE08::getd2Pij_dt2 ( double  t) const [virtual]
Returns:
All second order derivatives of the probability of change from state i to state j with respect to time t, at time t.
See also:
d2Pij_dt2()

Reimplemented from bpp::AbstractSubstitutionModel.

Definition at line 269 of file RE08.cpp.

References bpp::SubstitutionModel::freq(), bpp::AbstractSubstitutionModel::freq_, bpp::SubstitutionModel::getd2Pij_dt2(), bpp::SubstitutionModel::getdPij_dt(), bpp::SubstitutionModel::getPij_t(), lambda_, mu_, p_, simpleModel_, and bpp::AbstractSubstitutionModel::size_.

const Matrix< double > & RE08::getdPij_dt ( double  t) const [virtual]
Returns:
Get all first order derivatives of the probability of change from state i to state j with respect to time t, at time t.
See also:
dPij_dt()

Reimplemented from bpp::AbstractSubstitutionModel.

Definition at line 241 of file RE08.cpp.

References bpp::SubstitutionModel::freq(), bpp::AbstractSubstitutionModel::freq_, bpp::SubstitutionModel::getdPij_dt(), bpp::SubstitutionModel::getPij_t(), lambda_, mu_, p_, simpleModel_, and bpp::AbstractSubstitutionModel::size_.

const Vdouble& bpp::AbstractSubstitutionModel::getEigenValues ( ) const [inline, virtual, inherited]
Returns:
A vector with all real parts of the eigen values of the generator of this model;

Implements bpp::SubstitutionModel.

Definition at line 262 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::eigenValues_.

const Matrix<double>& bpp::AbstractSubstitutionModel::getExchangeabilityMatrix ( ) const [inline, 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$.

Implements bpp::SubstitutionModel.

Definition at line 254 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::exchangeability_.

const Matrix<double>& bpp::AbstractSubstitutionModel::getGenerator ( ) const [inline, 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()

Implements bpp::SubstitutionModel.

Definition at line 252 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::generator_.

const Vdouble& bpp::AbstractSubstitutionModel::getIEigenValues ( ) const [inline, virtual, inherited]
Returns:
A vector with all imaginary parts of the eigen values of the generator of this model;

Implements bpp::SubstitutionModel.

Definition at line 264 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::iEigenValues_.

double RE08::getInitValue ( size_t  i,
int  state 
) const throw (IndexOutOfBoundsException, BadIntException) [virtual]

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

Reimplemented from bpp::AbstractSubstitutionModel.

Definition at line 299 of file RE08.cpp.

std::vector<size_t> bpp::AbstractSubstitutionModel::getModelStates ( int  i) const [inline, 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.

Implements bpp::SubstitutionModel.

Definition at line 248 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::chars_, and bpp::VectorTools::whichAll().

std::string bpp::RE08::getName ( ) const [inline, virtual]

Get the name of the model.

Returns:
The name of this model.

Implements bpp::SubstitutionModel.

Definition at line 166 of file RE08.h.

const SubstitutionModel* bpp::RE08::getNestedModel ( ) const [inline]

Definition at line 190 of file RE08.h.

References simpleModel_.

Referenced by bpp::BppOSubstitutionModelFormat::write().

size_t bpp::RE08::getNumberOfStates ( ) const [inline, virtual]

Get the number of states.

For most models, this equals the size of the alphabet.

Returns:
The number of different states in the model.

Implements bpp::SubstitutionModel.

Definition at line 184 of file RE08.h.

References bpp::AbstractSubstitutionModel::size_.

const Matrix< double > & RE08::getPij_t ( double  t) const [virtual]
Returns:
All probabilities of change from state i to state j during time t.
See also:
Pij_t()

Reimplemented from bpp::AbstractSubstitutionModel.

Definition at line 215 of file RE08.cpp.

References bpp::SubstitutionModel::freq(), bpp::AbstractSubstitutionModel::freq_, bpp::SubstitutionModel::getPij_t(), lambda_, mu_, p_, simpleModel_, and bpp::AbstractSubstitutionModel::size_.

double AbstractSubstitutionModel::getRate ( ) const [virtual, inherited]

Get the rate.

Implements bpp::SubstitutionModel.

Definition at line 416 of file AbstractSubstitutionModel.cpp.

References bpp::AbstractSubstitutionModel::rate_.

const Matrix<double>& bpp::AbstractSubstitutionModel::getRowLeftEigenVectors ( ) const [inline, virtual, inherited]
Returns:
A matrix with left eigen vectors. Each row in the matrix stands for an eigen vector.

Implements bpp::SubstitutionModel.

Definition at line 270 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::leftEigenVectors_.

double AbstractSubstitutionModel::getScale ( ) const [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.

Implements bpp::SubstitutionModel.

Definition at line 401 of file AbstractSubstitutionModel.cpp.

References bpp::MatrixTools::diag(), bpp::AbstractSubstitutionModel::freq_, and bpp::AbstractSubstitutionModel::generator_.

Referenced by bpp::AbstractReversibleSubstitutionModel::updateMatrices().

bool bpp::AbstractSubstitutionModel::isDiagonalizable ( ) const [inline, virtual, inherited]
Returns:
True if the model is diagonalizable in R.

Implements bpp::SubstitutionModel.

Definition at line 266 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::isDiagonalizable_.

bool bpp::AbstractSubstitutionModel::isNonSingular ( ) const [inline, virtual, inherited]
Returns:
True is the model is non-singular.

Implements bpp::SubstitutionModel.

Definition at line 268 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::isNonSingular_.

RE08& bpp::RE08::operator= ( const RE08 model) [inline]
double RE08::Pij_t ( size_t  i,
size_t  j,
double  t 
) const [virtual]
Returns:
The probability of change from state i to state j during time t.
See also:
getPij_t(), getStates()

Reimplemented from bpp::AbstractSubstitutionModel.

Definition at line 122 of file RE08.cpp.

References bpp::SubstitutionModel::freq(), bpp::AbstractSubstitutionModel::freq_, lambda_, mu_, bpp::SubstitutionModel::Pij_t(), simpleModel_, and bpp::AbstractSubstitutionModel::size_.

virtual double bpp::AbstractSubstitutionModel::Qij ( size_t  i,
size_t  j 
) const [inline, virtual, inherited]
Returns:
The rate in the generator of change from state i to state j.
See also:
getStates();

Implements bpp::SubstitutionModel.

Reimplemented in bpp::AbstractMixedSubstitutionModel.

Definition at line 276 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::generator_.

void bpp::RE08::setFreqFromData ( const SequenceContainer data) [inline]

This method is forwarded to the simple model.

Parameters:
dataThe data to be passed to the simple model (gaps will be ignored).

Definition at line 173 of file RE08.h.

void AbstractSubstitutionModel::setFreqFromData ( const SequenceContainer data,
double  pseudoCount = 0 
) [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)} \]

Implements bpp::SubstitutionModel.

Definition at line 367 of file AbstractSubstitutionModel.cpp.

References bpp::SequenceContainerTools::getCounts(), bpp::AbstractSubstitutionModel::setFreq(), and bpp::AbstractSubstitutionModel::size_.

void RE08::setNamespace ( const std::string &  prefix) [virtual]

Reimplemented from bpp::AbstractParameterAliasable.

Definition at line 313 of file RE08.cpp.

References nestedPrefix_, bpp::ParameterAliasable::setNamespace(), and simpleModel_.

void AbstractSubstitutionModel::setRate ( double  rate) [virtual, inherited]
void AbstractSubstitutionModel::setScale ( double  scale) [virtual, inherited]

Multiplies the current generator by the given scale.

Parameters:
scalethe scale by which the generator is multiplied.

Implements bpp::SubstitutionModel.

Definition at line 410 of file AbstractSubstitutionModel.cpp.

References bpp::AbstractSubstitutionModel::generator_, and bpp::MatrixTools::scale().

double bpp::AbstractSubstitutionModel::Sij ( size_t  i,
size_t  j 
) const [inline, virtual, inherited]
Returns:
The exchangeability between state i and state j.

By definition Sij(i,j) = Sij(j,i).

Implements bpp::SubstitutionModel.

Definition at line 256 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::exchangeability_.

void RE08::updateMatrices ( ) [protected, virtual]

Compute and diagonalize the $Q$ matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVectors_ matrices.

The exchangeability_ matrix and freq_ vector must be initialized. This function computes the generator_ matrix with the formula

\[ Q = S \times \pi \]

where $Q$ is the generator matrix, $S$ is the exchangeability matrix and $Pi$ the diagonal matrix with frequencies.

The generator is then scaled so that

\[ \sum_i Q_{i,i} \times \pi_i = -1 \]

( $\pi_i$ are the equilibrium frequencies).

Eigen values and vectors are computed from the scaled generator and assigned to the eigenValues_, rightEigenVectors_ and leftEigenVectors_ variables.

Reimplemented from bpp::AbstractReversibleSubstitutionModel.

Definition at line 80 of file RE08.cpp.

References bpp::AbstractSubstitutionModel::exchangeability_, bpp::SubstitutionModel::freq(), bpp::AbstractSubstitutionModel::freq_, bpp::AbstractSubstitutionModel::generator_, bpp::SubstitutionModel::getExchangeabilityMatrix(), bpp::SubstitutionModel::getGenerator(), lambda_, mu_, simpleExchangeabilities_, simpleGenerator_, simpleModel_, and bpp::AbstractSubstitutionModel::size_.

Referenced by fireParameterChanged(), and RE08().


Friends And Related Function Documentation

friend class AbstractBiblioSubstitutionModel [friend, inherited]

Definition at line 342 of file AbstractSubstitutionModel.h.


Member Data Documentation

double bpp::RE08::exp_ [mutable, private]

Definition at line 103 of file RE08.h.

Referenced by operator=().

The vector $\pi_e$ of equilibrium frequencies.

Definition at line 113 of file AbstractSubstitutionModel.h.

Referenced by bpp::AbstractSubstitutionModel::AbstractSubstitutionModel(), bpp::WordSubstitutionModel::completeMatrices(), bpp::Coala::computeEquilibriumFrequencies(), d2Pij_dt2(), dPij_dt(), bpp::DSO78::DSO78(), bpp::LG08::fireParameterChanged(), bpp::DSO78::fireParameterChanged(), bpp::JTT92::fireParameterChanged(), bpp::WAG01::fireParameterChanged(), bpp::UserProteinSubstitutionModel::fireParameterChanged(), bpp::JCprot::fireParameterChanged(), bpp::AbstractSubstitutionModel::freq(), getd2Pij_dt2(), getdPij_dt(), bpp::AbstractSubstitutionModel::getFrequencies(), bpp::RN95s::getPij_t(), getPij_t(), bpp::RN95::getPij_t(), bpp::AbstractSubstitutionModel::getScale(), bpp::JCprot::JCprot(), bpp::JTT92::JTT92(), bpp::LG08::LG08(), bpp::AbstractSubstitutionModel::operator=(), bpp::RN95s::Pij_t(), Pij_t(), bpp::RN95::Pij_t(), RE08(), bpp::UserProteinSubstitutionModel::readFromFile(), bpp::AbstractSubstitutionModel::setFreq(), bpp::LG08::setFreqFromData(), bpp::DSO78::setFreqFromData(), bpp::JTT92::setFreqFromData(), bpp::WAG01::setFreqFromData(), bpp::UserProteinSubstitutionModel::setFreqFromData(), bpp::JCprot::setFreqFromData(), bpp::AbstractWordSubstitutionModel::updateMatrices(), bpp::gBGC::updateMatrices(), bpp::L95::updateMatrices(), bpp::SSR::updateMatrices(), bpp::MixtureOfASubstitutionModel::updateMatrices(), bpp::BinarySubstitutionModel::updateMatrices(), bpp::RN95s::updateMatrices(), bpp::MixtureOfSubstitutionModels::updateMatrices(), bpp::YpR::updateMatrices(), bpp::GTR::updateMatrices(), bpp::JCnuc::updateMatrices(), bpp::TN93::updateMatrices(), bpp::RN95::updateMatrices(), bpp::K80::updateMatrices(), updateMatrices(), bpp::T92::updateMatrices(), bpp::HKY85::updateMatrices(), bpp::F84::updateMatrices(), bpp::JCprot::updateMatrices(), bpp::AbstractSubstitutionModel::updateMatrices(), bpp::AbstractReversibleSubstitutionModel::updateMatrices(), bpp::UserProteinSubstitutionModel::UserProteinSubstitutionModel(), and bpp::WAG01::WAG01().

std::string bpp::RE08::nestedPrefix_ [private]

Definition at line 107 of file RE08.h.

Referenced by operator=(), RE08(), and setNamespace().

RowMatrix<double> bpp::RE08::p_ [mutable, private]

Definition at line 104 of file RE08.h.

Referenced by getd2Pij_dt2(), getdPij_dt(), getPij_t(), operator=(), and RE08().

double bpp::AbstractSubstitutionModel::rate_ [protected, inherited]

The rate of the model (default: 1). The generator (and all its vectorial components) is independent of the rate, since it should be normalized.

Definition at line 97 of file AbstractSubstitutionModel.h.

Referenced by bpp::AbstractSubstitutionModel::addRateParameter(), bpp::RN95s::d2Pij_dt2(), bpp::JCnuc::d2Pij_dt2(), bpp::TN93::d2Pij_dt2(), bpp::RN95::d2Pij_dt2(), bpp::K80::d2Pij_dt2(), bpp::T92::d2Pij_dt2(), bpp::JCprot::d2Pij_dt2(), bpp::HKY85::d2Pij_dt2(), bpp::F84::d2Pij_dt2(), bpp::RN95s::dPij_dt(), bpp::JCnuc::dPij_dt(), bpp::TN93::dPij_dt(), bpp::RN95::dPij_dt(), bpp::K80::dPij_dt(), bpp::T92::dPij_dt(), bpp::JCprot::dPij_dt(), bpp::HKY85::dPij_dt(), bpp::F84::dPij_dt(), bpp::WordSubstitutionModel::getd2Pij_dt2(), bpp::RN95s::getd2Pij_dt2(), bpp::JCnuc::getd2Pij_dt2(), bpp::TN93::getd2Pij_dt2(), bpp::RN95::getd2Pij_dt2(), bpp::K80::getd2Pij_dt2(), bpp::T92::getd2Pij_dt2(), bpp::JCprot::getd2Pij_dt2(), bpp::F84::getd2Pij_dt2(), bpp::HKY85::getd2Pij_dt2(), bpp::AbstractSubstitutionModel::getd2Pij_dt2(), bpp::WordSubstitutionModel::getdPij_dt(), bpp::RN95s::getdPij_dt(), bpp::JCnuc::getdPij_dt(), bpp::TN93::getdPij_dt(), bpp::RN95::getdPij_dt(), bpp::K80::getdPij_dt(), bpp::T92::getdPij_dt(), bpp::JCprot::getdPij_dt(), bpp::HKY85::getdPij_dt(), bpp::F84::getdPij_dt(), bpp::AbstractSubstitutionModel::getdPij_dt(), bpp::WordSubstitutionModel::getPij_t(), bpp::RN95s::getPij_t(), bpp::JCnuc::getPij_t(), bpp::TN93::getPij_t(), bpp::RN95::getPij_t(), bpp::K80::getPij_t(), bpp::T92::getPij_t(), bpp::JCprot::getPij_t(), bpp::HKY85::getPij_t(), bpp::F84::getPij_t(), bpp::AbstractSubstitutionModel::getPij_t(), bpp::AbstractSubstitutionModel::getRate(), bpp::AbstractMixedSubstitutionModel::normalizeVRates(), bpp::AbstractSubstitutionModel::operator=(), bpp::RN95s::Pij_t(), bpp::JCnuc::Pij_t(), bpp::TN93::Pij_t(), bpp::RN95::Pij_t(), bpp::K80::Pij_t(), bpp::T92::Pij_t(), bpp::JCprot::Pij_t(), bpp::HKY85::Pij_t(), bpp::F84::Pij_t(), bpp::AbstractMixedSubstitutionModel::setRate(), bpp::AbstractSubstitutionModel::setRate(), and bpp::BinarySubstitutionModel::updateMatrices().

Definition at line 102 of file RE08.h.

Referenced by operator=(), and updateMatrices().

Definition at line 101 of file RE08.h.

Referenced by operator=(), and updateMatrices().


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