bpp-phyl  2.3.0
bpp::JCnuc Class Referenceabstract

The Jukes-Cantor substitution model for nucleotides. More...

#include <Bpp/Phyl/Model/Nucleotide/JCnuc.h>

+ Inheritance diagram for bpp::JCnuc:
+ Collaboration diagram for bpp::JCnuc:

Public Member Functions

 JCnuc (const NucleicAlphabet *alpha)
 
virtual ~JCnuc ()
 
JCnucclone () 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. More...
 
void setFreqFromData (const SequenceContainer &data, double pseudoCount=0)
 This method is disabled in this model since frequencies are not free parameters. More...
 
const NucleicAlphabetgetAlphabet () const
 
const StateMapgetStateMap () const
 
const std::vector< int > & getAlphabetStates () const
 
std::string getAlphabetStateAsChar (size_t index) const
 
int getAlphabetStateAsInt (size_t index) 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 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
 
double getInitValue (size_t i, int state) const throw (IndexOutOfBoundsException, BadIntException)
 
virtual void setFreq (std::map< int, double > &)
 Set equilibrium frequencies. More...
 
void enableEigenDecomposition (bool yn)
 Set if eigenValues and Vectors must be computed. More...
 
bool enableEigenDecomposition ()
 Tell if eigenValues and Vectors must be computed. More...
 
virtual void fireParameterChanged (const ParameterList &parameters)
 Tells the model that a parameter value has changed. More...
 
void addRateParameter ()
 add a "rate" parameter to the model, that handles the overall rate of the process. More...
 
void setScalable (bool scalable)
 sets if model is scalable, ie scale can be changed. Default : true, set to false to avoid normalization for example. More...
 
virtual bool isScalable () const
 returns if model is scalable More...
 
double getScale () const
 return scale More...
 
void setScale (double scale)
 Multiplies the current generator by the given scale. More...
 
virtual void normalize ()
 normalize the generator More...
 
virtual double getRate () const
 The rate of the substitution process. More...
 
virtual void setRate (double rate)
 Set the rate of the model (must be positive). More...
 
virtual size_t getNumberOfStates () const =0
 Get the number of states. More...
 
size_t getNumberOfStates () const
 Get the number of states. More...
 
virtual const FrequenciesSetgetFrequenciesSet () const
 If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0. More...
 
virtual size_t getNumberOfIndependentParameters () const =0
 
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
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const =0
 
virtual std::map< std::string, std::string > getAliases () 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 void setNamespace (const std::string &prefix)=0
 
void setNamespace (const std::string &prefix)
 
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
 
bool hasIndependentParameter (const std::string &name) const
 
ParameterList getAliasedParameters (const ParameterList &pl) const
 
ParameterList getFromParameters (const ParameterList &pl) const
 
std::string getFrom (const std::string &name) const
 
const std::shared_ptr< Parameter > & getSharedParameter (const std::string &name) const
 

Protected Member Functions

void updateMatrices ()
 
const std::shared_ptr< Parameter > & getSharedParameter (size_t i) const
 
std::shared_ptr< Parameter > & getSharedParameter (size_t i)
 
void addParameter_ (Parameter *parameter)
 
void addParameters_ (const ParameterList &parameters)
 
void includeParameters_ (const ParameterList &parameters)
 
void deleteParameter_ (size_t index)
 
void deleteParameter_ (std::string &name)
 
void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
void shareParameters_ (const ParameterList &parameters)
 
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. More...
 
std::unique_ptr< StateMapstateMap_
 The map of model states with alphabet states. More...
 
size_t size_
 The size of the generator, i.e. the number of states. More...
 
bool isScalable_
 If the model is scalable (ie generator can be normalized automatically). More...
 
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. More...
 
RowMatrix< double > generator_
 The generator matrix $Q$ of the model. More...
 
Vdouble freq_
 The vector $\pi_e$ of equilibrium frequencies. More...
 
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. More...
 
RowMatrix< double > pijt_
 These ones are for bookkeeping: More...
 
RowMatrix< double > dpijt_
 
RowMatrix< double > d2pijt_
 
bool eigenDecompose_
 Tell if the eigen decomposition should be performed. More...
 
Vdouble eigenValues_
 The vector of eigen values. More...
 
Vdouble iEigenValues_
 The vector of the imaginary part of the eigen values. More...
 
bool isDiagonalizable_
 boolean value for diagonalizability in R of the generator_ More...
 
RowMatrix< double > rightEigenVectors_
 The $U^-1$ matrix made of right eigen vectors (by column). More...
 
bool isNonSingular_
 boolean value for non-singularity of rightEigenVectors_ More...
 
RowMatrix< double > leftEigenVectors_
 The $U$ matrix made of left eigen vectors (by row) if rightEigenVectors_ is non-singular. More...
 
std::vector< RowMatrix< double > > vPowGen_
 vector of the powers of generator_ for Taylor development (if rightEigenVectors_ is singular). More...
 
RowMatrix< double > tmpMat_
 For computational issues. More...
 

Private Attributes

double exp_
 
RowMatrix< double > p_
 

Detailed Description

The Jukes-Cantor substitution model for nucleotides.

All rates equal:

\[ S = \begin{pmatrix} \cdots & r & r & r \\ r & \cdots & r & r \\ r & r & \cdots & r \\ r & r & r & \cdots \\ \end{pmatrix} \]

\[ \pi = diag\left(\frac{1}{4}, \frac{1}{4}, \frac{1}{4}, \frac{1}{4}\right) \]

Normalization: $r$ is set so that $\sum_i Q_{i,i}\pi_i = -1$:

\[ S = \begin{pmatrix} -4 & \frac{4}{3} & \frac{4}{3} & \frac{4}{3} \\ \frac{4}{3} & -4 & \frac{4}{3} & \frac{4}{3} \\ \frac{4}{3} & \frac{4}{3} & -4 & \frac{4}{3} \\ \frac{4}{3} & \frac{4}{3} & \frac{4}{3} & -4 \\ \end{pmatrix} \]

The normalized generator is obtained by taking the dot product of $S$ and $pi$:

\[ Q = S . \pi = \begin{pmatrix} -1 & \frac{1}{3} & \frac{1}{3} & \frac{1}{3} \\ \frac{1}{3} & -1 & \frac{1}{3} & \frac{1}{3} \\ \frac{1}{3} & \frac{1}{3} & -1 & \frac{1}{3} \\ \frac{1}{3} & \frac{1}{3} & \frac{1}{3} & -1 \\ \end{pmatrix} \]

The eigen values are $\left(0, -\frac{4}{3}, -\frac{4}{3}, -\frac{4}{3}\right)$, the left eigen vectors are, by row:

\[ U = \begin{pmatrix} \frac{1}{4} & \frac{1}{4} & \frac{1}{4} & \frac{1}{4} \\ -\frac{1}{4} & -\frac{1}{4} & \frac{3}{4} & -\frac{1}{4} \\ -\frac{1}{4} & \frac{3}{4} & -\frac{1}{4} & -\frac{1}{4} \\ \frac{3}{4} & -\frac{1}{4} & -\frac{1}{4} & -\frac{1}{4} \\ \end{pmatrix} \]

and the right eigen vectors are, by column:

\[ U^-1 = \begin{pmatrix} 1 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ 1 & 1 & 0 & 0 \\ 1 & -1 & -1 & -1 \\ \end{pmatrix} \]

In addition, a rate_ factor defines the mean rate of the model.

The probabilities of changes are computed analytically using the formulas:

\[ P_{i,j}(t) = \begin{cases} \frac{1}{4} + \frac{3}{4}e^{-rate\_*\frac{4}{3}t} & \text{if $i=j$}, \\ \frac{1}{4} - \frac{1}{4}e^{-rate\_*\frac{4}{3}t} & \text{otherwise}. \end{cases} \]

First and second order derivatives are also computed analytically using the formulas:

\[ \frac{\partial P_{i,j}(t)}{\partial t} = rate\_ * \begin{cases} -e^{-rate\_*\frac{4}{3}t} & \text{if $i=j$}, \\ \frac{1}{3}e^{-rate*\frac{4}{3}t} & \text{otherwise}. \end{cases} \]

\[ \frac{\partial^2 P_{i,j}(t)}{\partial t^2} = rate\_^2 *\begin{cases} \frac{4}{3}e^{-rate\_*\frac{4}{3}t} & \text{if $i=j$}, \\ -\frac{4}{9}e^{-rate\_*\frac{4}{3}t} & \text{otherwise}. \end{cases} \]

Reference:

  • Jukes TH and Cantor CR (1969), Evolution_ of proteins molecules_, 121-123, in Mammalian_ protein metabolism_.

Definition at line 129 of file JCnuc.h.

Constructor & Destructor Documentation

JCnuc::JCnuc ( const NucleicAlphabet alpha)

Definition at line 50 of file JCnuc.cpp.

References updateMatrices().

Referenced by clone().

virtual bpp::JCnuc::~JCnuc ( )
inlinevirtual

Definition at line 139 of file JCnuc.h.

Member Function Documentation

void AbstractSubstitutionModel::addRateParameter ( )
virtualinherited
JCnuc* bpp::JCnuc::clone ( ) const
inlinevirtual
double JCnuc::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 138 of file JCnuc.cpp.

References bpp::AbstractSubstitutionModel::rate_.

Referenced by clone().

double JCnuc::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 128 of file JCnuc.cpp.

References bpp::AbstractSubstitutionModel::rate_.

Referenced by clone().

void bpp::AbstractSubstitutionModel::enableEigenDecomposition ( bool  yn)
inlinevirtualinherited

Set if eigenValues and Vectors must be computed.

Implements bpp::SubstitutionModel.

Definition at line 294 of file AbstractSubstitutionModel.h.

virtual void bpp::AbstractSubstitutionModel::fireParameterChanged ( const ParameterList parameters)
inlinevirtualinherited

Tells the model that a parameter value has changed.

This updates the matrices consequently.

Reimplemented from bpp::AbstractParameterAliasable.

Reimplemented in bpp::JCprot, bpp::KroneckerCodonDistanceFrequenciesSubstitutionModel, bpp::YpR, bpp::RE08, bpp::KroneckerCodonDistanceSubstitutionModel, bpp::CodonDistanceFrequenciesSubstitutionModel, bpp::CodonDistancePhaseFrequenciesSubstitutionModel, bpp::UserProteinSubstitutionModel, bpp::CodonDistanceCpGSubstitutionModel, bpp::WAG01, bpp::DSO78, bpp::JTT92, bpp::CodonDistanceSubstitutionModel, bpp::LG08, bpp::gBGC, bpp::CodonRateFrequenciesSubstitutionModel, and bpp::SENCA.

Definition at line 303 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::addRateParameter(), bpp::AbstractParameterAliasable::fireParameterChanged(), bpp::AbstractParameterAliasable::getNamespace(), bpp::ParameterList::getParameterValue(), bpp::ParameterList::hasParameter(), bpp::ParameterList::size(), and bpp::AbstractSubstitutionModel::updateMatrices().

Referenced by bpp::SENCA::fireParameterChanged(), bpp::CodonRateFrequenciesSubstitutionModel::fireParameterChanged(), bpp::gBGC::fireParameterChanged(), bpp::LG08::fireParameterChanged(), bpp::CodonDistanceSubstitutionModel::fireParameterChanged(), bpp::DSO78::fireParameterChanged(), bpp::JTT92::fireParameterChanged(), bpp::WAG01::fireParameterChanged(), bpp::CodonDistanceCpGSubstitutionModel::fireParameterChanged(), bpp::UserProteinSubstitutionModel::fireParameterChanged(), bpp::CodonDistancePhaseFrequenciesSubstitutionModel::fireParameterChanged(), bpp::CodonDistanceFrequenciesSubstitutionModel::fireParameterChanged(), bpp::KroneckerCodonDistanceSubstitutionModel::fireParameterChanged(), bpp::KroneckerCodonDistanceFrequenciesSubstitutionModel::fireParameterChanged(), and bpp::JCprot::fireParameterChanged().

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

Implements bpp::TransitionModel.

Definition at line 280 of file AbstractSubstitutionModel.h.

const NucleicAlphabet* bpp::AbstractReversibleNucleotideSubstitutionModel::getAlphabet ( ) const
inlinevirtualinherited
Returns
Get the alphabet associated to this model.

Implements bpp::NucleotideSubstitutionModel.

Definition at line 131 of file NucleotideSubstitutionModel.h.

std::string bpp::AbstractSubstitutionModel::getAlphabetStateAsChar ( size_t  index) const
inlinevirtualinherited
Parameters
indexThe model state.
Returns
The corresponding alphabet state as character code.

Implements bpp::TransitionModel.

Definition at line 248 of file AbstractSubstitutionModel.h.

int bpp::AbstractSubstitutionModel::getAlphabetStateAsInt ( size_t  index) const
inlinevirtualinherited
Parameters
indexThe model state.
Returns
The corresponding alphabet state as character code.

Implements bpp::TransitionModel.

Definition at line 250 of file AbstractSubstitutionModel.h.

Referenced by bpp::AbstractSubstitutionModel::getInitValue().

const std::vector<int>& bpp::AbstractSubstitutionModel::getAlphabetStates ( ) const
inlinevirtualinherited
Returns
The alphabet states of each state of the model, as a vector of int codes.
See also
Alphabet

Implements bpp::TransitionModel.

Definition at line 246 of file AbstractSubstitutionModel.h.

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

Implements bpp::SubstitutionModel.

Definition at line 278 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::rightEigenVectors_.

const Matrix< double > & JCnuc::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 174 of file JCnuc.cpp.

References exp_, p_, bpp::AbstractSubstitutionModel::rate_, and bpp::AbstractSubstitutionModel::size_.

Referenced by clone().

const Matrix< double > & JCnuc::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 161 of file JCnuc.cpp.

References exp_, p_, bpp::AbstractSubstitutionModel::rate_, and bpp::AbstractSubstitutionModel::size_.

Referenced by clone().

const Vdouble& bpp::AbstractSubstitutionModel::getEigenValues ( ) const
inlinevirtualinherited
Returns
A vector with all real parts of the eigen values of the generator of this model;

Implements bpp::SubstitutionModel.

Definition at line 268 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::eigenValues_.

const Matrix<double>& bpp::AbstractSubstitutionModel::getExchangeabilityMatrix ( ) const
inlinevirtualinherited
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 260 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::exchangeability_.

virtual const Vdouble& bpp::AbstractSubstitutionModel::getFrequencies ( ) const
inlinevirtualinherited
Returns
A vector of all equilibrium frequencies.
See also
freq()

Implements bpp::TransitionModel.

Definition at line 256 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::freq_.

Referenced by bpp::SENCA::setFreq().

const Matrix<double>& bpp::AbstractSubstitutionModel::getGenerator ( ) const
inlinevirtualinherited
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 258 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::generator_.

Referenced by bpp::AbstractKroneckerWordSubstitutionModel::fillBasicGenerator().

const Vdouble& bpp::AbstractSubstitutionModel::getIEigenValues ( ) const
inlinevirtualinherited
Returns
A vector with all imaginary parts of the eigen values of the generator of this model;

Implements bpp::SubstitutionModel.

Definition at line 270 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::iEigenValues_.

double AbstractSubstitutionModel::getInitValue ( size_t  i,
int  state 
) const
throw (IndexOutOfBoundsException,
BadIntException
)
virtualinherited

This method is used to initialize likelihoods in reccursions. It typically sends 1 if i = state, 0 otherwise, where i is one of the possible states of the alphabet allowed in the model and state is the observed state in the considered sequence/site.

Parameters
ithe index of the state in the model.
stateAn observed state in the sequence/site.
Returns
1 or 0 depending if the two states are compatible.
Exceptions
IndexOutOfBoundsExceptionif array position is out of range.
BadIntExceptionif states are not allowed in the associated alphabet.
See also
getStates();

Implements bpp::TransitionModel.

Reimplemented in bpp::RE08.

Definition at line 354 of file AbstractSubstitutionModel.cpp.

References bpp::AbstractSubstitutionModel::alphabet_, bpp::Alphabet::getAlias(), bpp::AbstractSubstitutionModel::getAlphabetStateAsInt(), bpp::Alphabet::intToChar(), and bpp::AbstractSubstitutionModel::size_.

Referenced by bpp::AbstractSubstitutionModel::d2Pij_dt2().

std::vector<size_t> bpp::AbstractSubstitutionModel::getModelStates ( int  code) const
inlinevirtualinherited

Get the state in the model corresponding to a particular state in the alphabet.

Parameters
codeThe alphabet state to check.
Returns
A vector of indices of model states.

Implements bpp::TransitionModel.

Definition at line 252 of file AbstractSubstitutionModel.h.

std::vector<size_t> bpp::AbstractSubstitutionModel::getModelStates ( const std::string &  code) const
inlinevirtualinherited

Get the state in the model corresponding to a particular state in the alphabet.

Parameters
codeThe alphabet state to check.
Returns
A vector of indices of model states.

Implements bpp::TransitionModel.

Definition at line 254 of file AbstractSubstitutionModel.h.

std::string bpp::JCnuc::getName ( ) const
inlinevirtual

Get the name of the model.

Returns
The name of this model.

Implements bpp::TransitionModel.

Definition at line 151 of file JCnuc.h.

size_t bpp::NucleotideSubstitutionModel::getNumberOfStates ( ) const
inlinevirtualinherited

Get the number of states.

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

See also
getAlphabetChars for the list of supported states.
Returns
The number of different states in the model.

Implements bpp::TransitionModel.

Reimplemented in bpp::RE08Nucleotide.

Definition at line 64 of file NucleotideSubstitutionModel.h.

References bpp::NucleotideSubstitutionModel::getAlphabet().

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

Get the number of states.

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

See also
getAlphabetChars for the list of supported states.
Returns
The number of different states in the model.

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

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

const Matrix< double > & JCnuc::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 148 of file JCnuc.cpp.

References exp_, p_, bpp::AbstractSubstitutionModel::rate_, and bpp::AbstractSubstitutionModel::size_.

Referenced by clone().

double AbstractSubstitutionModel::getRate ( ) const
virtualinherited

The rate of the substitution process.

Implements bpp::SubstitutionModel.

Definition at line 436 of file AbstractSubstitutionModel.cpp.

References bpp::AbstractSubstitutionModel::rate_.

Referenced by bpp::AbstractSubstitutionModel::isScalable().

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

Implements bpp::SubstitutionModel.

Definition at line 276 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::leftEigenVectors_.

double AbstractSubstitutionModel::getScale ( ) const
virtualinherited
const StateMap& bpp::AbstractSubstitutionModel::getStateMap ( ) const
inlinevirtualinherited
Returns
The mapping of model states with alphabet states.

Implements bpp::TransitionModel.

Definition at line 244 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::stateMap_.

bool bpp::AbstractSubstitutionModel::isDiagonalizable ( ) const
inlinevirtualinherited
Returns
True if the model is diagonalizable in R.

Implements bpp::SubstitutionModel.

Definition at line 272 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::isDiagonalizable_.

bool bpp::AbstractSubstitutionModel::isNonSingular ( ) const
inlinevirtualinherited
Returns
True is the model is non-singular.

Implements bpp::SubstitutionModel.

Definition at line 274 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::isNonSingular_.

double JCnuc::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 118 of file JCnuc.cpp.

References bpp::AbstractSubstitutionModel::rate_.

Referenced by clone().

virtual double bpp::AbstractSubstitutionModel::Qij ( size_t  i,
size_t  j 
) const
inlinevirtualinherited
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 282 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::generator_.

void bpp::JCnuc::setFreqFromData ( const SequenceContainer data,
double  pseudoCount = 0 
)
inlinevirtual

This method is disabled in this model since frequencies are not free parameters.

Consider using the HKY85 model for instance if you want to set frequencies as parameters.

Parameters
dataUnused parameter.
pseudoCountUnused parameter.

Reimplemented from bpp::AbstractSubstitutionModel.

Definition at line 161 of file JCnuc.h.

References updateMatrices().

void AbstractSubstitutionModel::setRate ( double  rate)
virtualinherited
void bpp::AbstractSubstitutionModel::setScalable ( bool  scalable)
inlinevirtualinherited

sets if model is scalable, ie scale can be changed. Default : true, set to false to avoid normalization for example.

Implements bpp::SubstitutionModel.

Definition at line 351 of file AbstractSubstitutionModel.h.

double bpp::AbstractSubstitutionModel::Sij ( size_t  i,
size_t  j 
) const
inlinevirtualinherited
Returns
The exchangeability between state i and state j.

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

Implements bpp::SubstitutionModel.

Definition at line 262 of file AbstractSubstitutionModel.h.

References bpp::AbstractSubstitutionModel::exchangeability_, bpp::AbstractSubstitutionModel::getd2Pij_dt2(), bpp::AbstractSubstitutionModel::getdPij_dt(), and bpp::AbstractSubstitutionModel::getPij_t().

void JCnuc::updateMatrices ( )
protectedvirtual

In the case of the model of Jukes & Cantor, this method is not usefull since the generator is fully determined. No matrice can be changed... This method is only used in the constructor of the class.

Reimplemented from bpp::AbstractReversibleSubstitutionModel.

Definition at line 61 of file JCnuc.cpp.

References bpp::AbstractSubstitutionModel::eigenValues_, bpp::AbstractSubstitutionModel::exchangeability_, bpp::AbstractSubstitutionModel::freq_, bpp::AbstractSubstitutionModel::generator_, bpp::AbstractSubstitutionModel::leftEigenVectors_, and bpp::AbstractSubstitutionModel::rightEigenVectors_.

Referenced by JCnuc(), and setFreqFromData().

Member Data Documentation

bool bpp::AbstractSubstitutionModel::eigenDecompose_
protectedinherited
double bpp::JCnuc::exp_
mutableprivate

Definition at line 133 of file JCnuc.h.

Referenced by getd2Pij_dt2(), getdPij_dt(), and getPij_t().

Vdouble bpp::AbstractSubstitutionModel::freq_
protectedinherited

The vector $\pi_e$ of equilibrium frequencies.

Definition at line 120 of file AbstractSubstitutionModel.h.

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

bool bpp::AbstractSubstitutionModel::isScalable_
protectedinherited
RowMatrix<double> bpp::JCnuc::p_
mutableprivate

Definition at line 134 of file JCnuc.h.

Referenced by getd2Pij_dt2(), getdPij_dt(), and getPij_t().

RowMatrix<double> bpp::AbstractSubstitutionModel::pijt_
mutableprotectedinherited
double bpp::AbstractSubstitutionModel::rate_
protectedinherited

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 110 of file AbstractSubstitutionModel.h.

Referenced by bpp::AbstractSubstitutionModel::addRateParameter(), bpp::BinarySubstitutionModel::d2Pij_dt2(), bpp::RN95s::d2Pij_dt2(), d2Pij_dt2(), bpp::TN93::d2Pij_dt2(), bpp::RN95::d2Pij_dt2(), bpp::K80::d2Pij_dt2(), bpp::T92::d2Pij_dt2(), bpp::JCprot::d2Pij_dt2(), bpp::F84::d2Pij_dt2(), bpp::HKY85::d2Pij_dt2(), bpp::BinarySubstitutionModel::dPij_dt(), bpp::RN95s::dPij_dt(), dPij_dt(), bpp::TN93::dPij_dt(), bpp::RN95::dPij_dt(), bpp::K80::dPij_dt(), bpp::T92::dPij_dt(), bpp::JCprot::dPij_dt(), bpp::F84::dPij_dt(), bpp::HKY85::dPij_dt(), bpp::WordSubstitutionModel::getd2Pij_dt2(), bpp::BinarySubstitutionModel::getd2Pij_dt2(), bpp::RN95s::getd2Pij_dt2(), 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::BinarySubstitutionModel::getdPij_dt(), bpp::RN95s::getdPij_dt(), getdPij_dt(), bpp::TN93::getdPij_dt(), bpp::RN95::getdPij_dt(), bpp::K80::getdPij_dt(), bpp::T92::getdPij_dt(), bpp::JCprot::getdPij_dt(), bpp::F84::getdPij_dt(), bpp::HKY85::getdPij_dt(), bpp::AbstractSubstitutionModel::getdPij_dt(), bpp::WordSubstitutionModel::getPij_t(), bpp::BinarySubstitutionModel::getPij_t(), bpp::RN95s::getPij_t(), getPij_t(), bpp::TN93::getPij_t(), bpp::RN95::getPij_t(), bpp::K80::getPij_t(), bpp::T92::getPij_t(), bpp::JCprot::getPij_t(), bpp::F84::getPij_t(), bpp::HKY85::getPij_t(), bpp::AbstractSubstitutionModel::getPij_t(), bpp::AbstractSubstitutionModel::getRate(), bpp::AbstractMixedSubstitutionModel::normalizeVRates(), bpp::AbstractSubstitutionModel::operator=(), bpp::BinarySubstitutionModel::Pij_t(), bpp::RN95s::Pij_t(), Pij_t(), bpp::TN93::Pij_t(), bpp::RN95::Pij_t(), bpp::K80::Pij_t(), bpp::T92::Pij_t(), bpp::JCprot::Pij_t(), bpp::F84::Pij_t(), bpp::HKY85::Pij_t(), bpp::AbstractMixedSubstitutionModel::setRate(), bpp::AbstractSubstitutionModel::setRate(), bpp::BinarySubstitutionModel::updateMatrices(), and bpp::MixtureOfSubstitutionModels::updateMatrices().

size_t bpp::AbstractSubstitutionModel::size_
protectedinherited
std::unique_ptr<StateMap> bpp::AbstractSubstitutionModel::stateMap_
protectedinherited

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