40 #ifndef _SUBSTITUTIONMODEL_H_ 41 #define _SUBSTITUTIONMODEL_H_ 47 #include <Bpp/Exceptions.h> 48 #include <Bpp/Numeric/Parameter.h> 49 #include <Bpp/Numeric/ParameterList.h> 50 #include <Bpp/Numeric/ParameterAliasable.h> 51 #include <Bpp/Numeric/VectorTools.h> 52 #include <Bpp/Numeric/Matrix/Matrix.h> 55 #include <Bpp/Seq/Alphabet/Alphabet.h> 56 #include <Bpp/Seq/Container/SequenceContainer.h> 65 class SubstitutionModel;
86 Exception::operator=(sme);
200 public virtual ParameterAliasable
206 #ifndef NO_VIRTUAL_COV 216 virtual std::string
getName()
const = 0;
244 virtual std::vector<size_t>
getModelStates(
const std::string& code)
const = 0;
262 virtual double freq(
size_t i)
const = 0;
269 virtual double Qij(
size_t i,
size_t j)
const = 0;
275 virtual double Pij_t(
size_t i,
size_t j,
double t)
const = 0;
282 virtual double dPij_dt(
size_t i,
size_t j,
double t)
const = 0;
289 virtual double d2Pij_dt2(
size_t i,
size_t j,
double t)
const = 0;
327 virtual double Sij(
size_t i,
size_t j)
const = 0;
332 virtual const Matrix<double>&
getPij_t(
double t)
const = 0;
339 virtual const Matrix<double>&
getdPij_dt(
double t)
const = 0;
346 virtual const Matrix<double>&
getd2Pij_dt2(
double t)
const = 0;
418 virtual double getInitValue(
size_t i,
int state)
const throw (IndexOutOfBoundsException, BadIntException) = 0;
428 virtual double getScale()
const = 0;
438 virtual void setScale(
double scale) = 0;
443 virtual double getRate()
const = 0;
450 virtual void setRate(
double rate) = 0;
466 virtual void setFreqFromData(
const SequenceContainer& data,
double pseudoCount = 0) = 0;
473 virtual void setFreq(std::map<int, double>& frequencies) {}
501 #ifndef NO_VIRTUAL_COV 508 #endif //_SUBSTITUTIONMODEL_H_ virtual ~ReversibleSubstitutionModel()
Interface for all substitution models.
virtual std::vector< size_t > getModelStates(int code) const =0
Get the state in the model corresponding to a particular state in the alphabet.
virtual int getAlphabetStateAsInt(size_t index) const =0
virtual const Matrix< double > & getExchangeabilityMatrix() const =0
SubstitutionModelException(const std::string &text, const SubstitutionModel *sm=0)
virtual double getInitValue(size_t i, int state) const =0
virtual const StateMap & getStateMap() const =0
SubstitutionModelException & operator=(const SubstitutionModelException &sme)
virtual const std::vector< int > & getAlphabetStates() const =0
const SubstitutionModel * model_
SubstitutionModelException(const SubstitutionModelException &sme)
virtual const FrequenciesSet * getFrequenciesSet() const
If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0.
virtual const Alphabet * getAlphabet() const =0
virtual double Sij(size_t i, size_t j) const =0
virtual void addRateParameter()=0
Parametrize a set of state frequencies.
virtual void setScale(double scale)=0
Multiplies the current generator by the given scale.
virtual void setFreqFromData(const SequenceContainer &data, double pseudoCount=0)=0
Set equilibrium frequencies equal to the frequencies estimated from the data.
virtual void setRate(double rate)=0
Set the rate of the model (must be positive).
virtual const Vdouble & getFrequencies() const =0
virtual const Matrix< double > & getd2Pij_dt2(double t) const =0
virtual double d2Pij_dt2(size_t i, size_t j, double t) const =0
virtual const Vdouble & getEigenValues() const =0
virtual const Matrix< double > & getPij_t(double t) const =0
virtual const SubstitutionModel * getSubstitutionModel() const
Get the model that throws the exception.
virtual void setFreq(std::map< int, double > &frequencies)
Set equilibrium frequencies.
Interface for reversible substitution models.
virtual ~SubstitutionModel()
~SubstitutionModelException()
virtual double Pij_t(size_t i, size_t j, double t) const =0
virtual std::string getName() const =0
Get the name of the model.
virtual double Qij(size_t i, size_t j) const =0
virtual const Matrix< double > & getGenerator() const =0
virtual bool isDiagonalizable() const =0
Exception that may be thrown by susbstitution models.
virtual std::string getAlphabetStateAsChar(size_t index) const =0
virtual double getRate() const =0
Get the rate.
virtual const Matrix< double > & getRowLeftEigenVectors() const =0
virtual double freq(size_t i) const =0
virtual double getScale() const =0
Get the scalar product of diagonal elements of the generator and the frequencies vector. If the generator is normalized, then scale=1. Otherwise each element must be multiplied by 1/scale.
virtual const Matrix< double > & getdPij_dt(double t) const =0
ReversibleSubstitutionModel * clone() const =0
virtual double dPij_dt(size_t i, size_t j, double t) const =0
virtual const Matrix< double > & getColumnRightEigenVectors() const =0
virtual bool isNonSingular() const =0
virtual size_t getNumberOfStates() const =0
Get the number of states.
SubstitutionModel * clone() const =0
Map the states of a given alphabet which have a model state.
ReversibleSubstitutionModel()
virtual const Vdouble & getIEigenValues() const =0
virtual bool enableEigenDecomposition()=0
Tell if eigenValues and Vectors must be computed.