bpp-phyl3  3.0.0
bpp::AbstractBiblioMixedTransitionModel Class Referenceabstract

Abstract class for mixture models based on the bibliography. More...

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

+ Inheritance diagram for bpp::AbstractBiblioMixedTransitionModel:
+ Collaboration diagram for bpp::AbstractBiblioMixedTransitionModel:

Public Member Functions

 AbstractBiblioMixedTransitionModel (const std::string &prefix)
 
 AbstractBiblioMixedTransitionModel (const AbstractBiblioMixedTransitionModel &model)
 
AbstractBiblioMixedTransitionModeloperator= (const AbstractBiblioMixedTransitionModel &model)
 
virtual ~AbstractBiblioMixedTransitionModel ()
 
const TransitionModelInterfacenModel (size_t i) const override
 Returns the submodel from the mixture. More...
 
std::shared_ptr< const TransitionModelInterfacegetNModel (size_t i) const override
 
double getNProbability (size_t i) const override
 Returns the probability of a specific model from the mixture. More...
 
const std::vector< double > & getProbabilities () const override
 Returns the vector of the probabilities of the submodels of the mixture. More...
 
void setNProbability (size_t i, double prob) override
 Sets the probabilities of the submodels of the mixture. More...
 
size_t getNumberOfModels () const override
 Returns the number of submodels. More...
 
void setVRates (const Vdouble &vd) override
 sets the rates of the submodels. More...
 
void normalizeVRates () override
 normalizes the rates of the submodels. More...
 
const std::vector< double > & getVRates () const override
 Returns the vector of all the rates of the mixture. More...
 
double getNRate (size_t i) const override
 Returns the rate of a specific model from the mixture. More...
 
const TransitionModelInterfacemodel (const std::string &name) const override
 Access the submodel with the given name. More...
 
Vuint getSubmodelNumbers (const std::string &desc) const override
 Returns the vector of numbers of the submodels in the mixture that match a description. More...
 
const TransitionModelInterfacetransitionModel () const override
 
const MixedTransitionModelInterfacemixedModel () const
 
const FrequencySetInterfacefrequencySet () const override
 
virtual MixedTransitionModelInterfaceclone () const override=0
 
virtual double freq (size_t i) const =0
 
virtual double Pij_t (size_t i, size_t j, double t) const =0
 
virtual double dPij_dt (size_t i, size_t j, double t) const =0
 
virtual double d2Pij_dt2 (size_t i, size_t j, double t) const =0
 
virtual const VdoublegetFrequencies () const =0
 
virtual bool computeFrequencies () const =0
 
virtual void computeFrequencies (bool yn)=0
 
virtual const Matrix< double > & getPij_t (double t) const =0
 
virtual const Matrix< double > & getdPij_dt (double t) const =0
 
virtual const Matrix< double > & getd2Pij_dt2 (double t) const =0
 
virtual const Eigen::VectorXd & Lik_t (const Eigen::VectorXd &values, double t) const =0
 
virtual const Eigen::VectorXd & dLik_dt (const Eigen::VectorXd &values, double t) const =0
 
virtual const Eigen::VectorXd & d2Lik_dt2 (const Eigen::VectorXd &values, double t) const =0
 
virtual void setFreqFromData (const SequenceDataInterface &data, double pseudoCount=0)=0
 Set equilibrium frequencies equal to the frequencies estimated from the data. More...
 
virtual void setFreq (std::map< int, double > &frequencies)=0
 Set equilibrium frequencies. More...
 
virtual std::string getName () const =0
 Get the name of the model. More...
 
virtual const std::vector< int > & getAlphabetStates () const =0
 
virtual const StateMapInterfacestateMap () const =0
 
virtual std::shared_ptr< const StateMapInterfacegetStateMap () const =0
 
virtual std::vector< size_t > getModelStates (int code) const =0
 Get the state in the model corresponding to a particular state in the alphabet. More...
 
virtual std::vector< size_t > getModelStates (const std::string &code) const =0
 Get the state in the model corresponding to a particular state in the alphabet. More...
 
virtual int getAlphabetStateAsInt (size_t index) const =0
 
virtual std::string getAlphabetStateAsChar (size_t index) const =0
 
virtual const Alphabetalphabet () const =0
 
virtual std::shared_ptr< const AlphabetgetAlphabet () const =0
 
virtual size_t getNumberOfStates () const =0
 Get the number of states. More...
 
virtual double getInitValue (size_t i, int state) const =0
 
virtual double getRate () const =0
 Get the rate. More...
 
virtual void setRate (double rate)=0
 Set the rate of the model (must be positive). More...
 
virtual void addRateParameter ()=0
 
virtual size_t getNumberOfIndependentParameters () const=0
 
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
 
virtual void unaliasParameters (const std::string &p1, const std::string &p2)=0
 
virtual const ParameterListgetIndependentParameters () const=0
 
virtual std::vector< std::string > getAlias (const std::string &name) const=0
 
virtual std::map< std::string, std::string > getAliases () const=0
 
virtual bool hasParameter (const std::string &name) const=0
 
virtual const ParameterListgetParameters () const=0
 
virtual const Parameterparameter (const std::string &name) const=0
 
virtual double getParameterValue (const std::string &name) const=0
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
virtual void setParameterValue (const std::string &name, double value)=0
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
virtual void removeConstraint (const std::string &name)=0
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 
virtual size_t getNumberOfParameters () const=0
 
virtual void setNamespace (const std::string &prefix)=0
 
virtual std::string getNamespace () const=0
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const=0
 
std::string getParNameFromPmodel (const std::string &name) const
 get the name of a parameter from its name in a submodel More...
 
std::string getPmodelParName (const std::string &name) const
 get the name of a parameter in the submodel from its apparent name More...
 
const BranchModelInterfacemodel () const override
 
virtual std::string getName () const override
 Get the name of the model. More...
 
bool hasIndependentParameter (const std::string &name) const
 
const ParameterListgetIndependentParameters () const
 
size_t getNumberOfIndependentParameters () const
 
void aliasParameters (const std::string &p1, const std::string &p2)
 
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 
void unaliasParameters (const std::string &p1, const std::string &p2)
 
ParameterList getAliasedParameters (const ParameterList &pl) const
 
ParameterList getFromParameters (const ParameterList &pl) const
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const
 
std::string getFrom (const std::string &name) const
 
bool hasParameter (const std::string &name) const override
 
const ParameterListgetParameters () const override
 
const Parameterparameter (const std::string &name) const override
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 
double getParameterValue (const std::string &name) const override
 
void setAllParametersValues (const ParameterList &parameters) override
 
void setParameterValue (const std::string &name, double value) override
 
void setParametersValues (const ParameterList &parameters) override
 
bool matchParametersValues (const ParameterList &parameters) override
 
void removeConstraint (const std::string &name) override
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
size_t getNumberOfParameters () const override
 
std::string getNamespace () const override
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 
virtual Clonableclone () const=0
 
const Eigen::VectorXd & Lik_t (const Eigen::VectorXd &values, double t) const override
 
const Eigen::VectorXd & dLik_dt (const Eigen::VectorXd &values, double t) const override
 
const Eigen::VectorXd & d2Lik_dt2 (const Eigen::VectorXd &values, double t) const override
 
void addRateParameter () override
 Methods to supersede TransitionModel methods. More...
 
void setFreqFromData (const SequenceDataInterface &data, double pseudoCount=0) override
 Set equilibrium frequencies equal to the frequencies estimated from the data. More...
 
void setFreq (std::map< int, double > &frequ) override
 Set equilibrium frequencies. More...
 
virtual void fireParameterChanged (const ParameterList &parameters) override
 Methods to supersede AbstractTransitionModel methods. More...
 
void setNamespace (const std::string &name) override
 
double freq (size_t i) const override
 Methods to supersede TransitionModel methods. More...
 
double Pij_t (size_t i, size_t j, double t) const override
 
double dPij_dt (size_t i, size_t j, double t) const override
 
double d2Pij_dt2 (size_t i, size_t j, double t) const override
 
const VdoublegetFrequencies () const override
 
const Matrix< double > & getPij_t (double t) const override
 
const Matrix< double > & getdPij_dt (double t) const override
 
const Matrix< double > & getd2Pij_dt2 (double t) const override
 
double getInitValue (size_t i, int state) const override
 
double getRate () const override
 Get the rate. More...
 
void setRate (double rate) override
 Set the rate of the model (must be positive). More...
 
bool computeFrequencies () const override
 
void computeFrequencies (bool yn) override
 
const std::vector< int > & getAlphabetStates () const override
 
const StateMapInterfacestateMap () const override
 
std::shared_ptr< const StateMapInterfacegetStateMap () const override
 
int getAlphabetStateAsInt (size_t i) const override
 
std::string getAlphabetStateAsChar (size_t i) const override
 
std::vector< size_t > getModelStates (int code) const override
 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 override
 Get the state in the model corresponding to a particular state in the alphabet. More...
 
const Alphabetalphabet () const override
 
std::shared_ptr< const AlphabetgetAlphabet () const override
 
size_t getNumberOfStates () const override
 Get the number of states. More...
 

Protected Member Functions

TransitionModelInterfacetransitionModel_ () override
 
MixedTransitionModelInterfacemixedModel_ ()
 
TransitionModelInterfacenModel_ (size_t i) override
 
virtual VdoublegetFrequencies_ ()=0
 
virtual ParameterListgetParameters_ ()=0
 
virtual void updateMatrices_ ()
 
VdoublegetFrequencies_ () override
 
BranchModelInterfacemodel_ ()
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
void addParameter_ (Parameter *parameter)
 
void addParameters_ (const ParameterList &parameters)
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
void shareParameters_ (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_ ()
 
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_ () override
 

Protected Attributes

std::unique_ptr< MixedTransitionModelInterfacemixedModelPtr_
 
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 Attributes

ParameterList independentParameters_
 
std::map< std::string, std::shared_ptr< AliasParameterListener > > aliasListenersRegister_
 
ParameterList parameters_
 
std::string prefix_
 
Eigen::VectorXd lik_
 

Detailed Description

Abstract class for mixture models based on the bibliography.

Author
Laurent Guéguen

Definition at line 18 of file AbstractBiblioMixedTransitionModel.h.

Constructor & Destructor Documentation

◆ AbstractBiblioMixedTransitionModel() [1/2]

AbstractBiblioMixedTransitionModel::AbstractBiblioMixedTransitionModel ( const std::string &  prefix)

Definition at line 12 of file AbstractBiblioMixedTransitionModel.cpp.

◆ AbstractBiblioMixedTransitionModel() [2/2]

AbstractBiblioMixedTransitionModel::AbstractBiblioMixedTransitionModel ( const AbstractBiblioMixedTransitionModel model)

Definition at line 17 of file AbstractBiblioMixedTransitionModel.cpp.

◆ ~AbstractBiblioMixedTransitionModel()

AbstractBiblioMixedTransitionModel::~AbstractBiblioMixedTransitionModel ( )
virtual

Definition at line 29 of file AbstractBiblioMixedTransitionModel.cpp.

Member Function Documentation

◆ addRateParameter() [1/2]

◆ addRateParameter() [2/2]

◆ alphabet() [1/2]

◆ alphabet() [2/2]

const Alphabet& bpp::AbstractWrappedModel::alphabet ( ) const
inlineoverridevirtualinherited

◆ clone()

◆ computeFrequencies() [1/4]

◆ computeFrequencies() [2/4]

bool bpp::AbstractTotallyWrappedTransitionModel::computeFrequencies ( ) const
inlineoverridevirtualinherited
Returns
Says if equilibrium frequencies should be computed

Implements bpp::TransitionModelInterface.

Definition at line 162 of file AbstractWrappedModel.h.

References bpp::TransitionModelInterface::computeFrequencies(), and bpp::WrappedTransitionModelInterface::transitionModel().

Referenced by bpp::DFP07::DFP07(), and bpp::YN98::YN98().

◆ computeFrequencies() [3/4]

void bpp::AbstractTotallyWrappedTransitionModel::computeFrequencies ( bool  yn)
inlineoverridevirtualinherited
Returns
Set if equilibrium frequencies should be computed from the generator

Implements bpp::TransitionModelInterface.

Definition at line 171 of file AbstractWrappedModel.h.

References bpp::TransitionModelInterface::computeFrequencies(), and bpp::AbstractWrappedTransitionModel::transitionModel_().

◆ computeFrequencies() [4/4]

virtual void bpp::TransitionModelInterface::computeFrequencies ( bool  yn)
pure virtualinherited

◆ d2Lik_dt2() [1/2]

virtual const Eigen::VectorXd& bpp::TransitionModelInterface::d2Lik_dt2 ( const Eigen::VectorXd &  values,
double  t 
) const
pure virtualinherited

◆ d2Lik_dt2() [2/2]

const Eigen::VectorXd& bpp::AbstractLkTransitionModel::d2Lik_dt2 ( const Eigen::VectorXd &  values,
double  t 
) const
inlineoverridevirtualinherited

◆ d2Pij_dt2() [1/2]

◆ d2Pij_dt2() [2/2]

double bpp::AbstractTotallyWrappedTransitionModel::d2Pij_dt2 ( size_t  i,
size_t  j,
double  t 
) const
inlineoverridevirtualinherited
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()

Implements bpp::TransitionModelInterface.

Definition at line 124 of file AbstractWrappedModel.h.

References bpp::TransitionModelInterface::d2Pij_dt2(), and bpp::WrappedTransitionModelInterface::transitionModel().

◆ dLik_dt() [1/2]

virtual const Eigen::VectorXd& bpp::TransitionModelInterface::dLik_dt ( const Eigen::VectorXd &  values,
double  t 
) const
pure virtualinherited

◆ dLik_dt() [2/2]

const Eigen::VectorXd& bpp::AbstractLkTransitionModel::dLik_dt ( const Eigen::VectorXd &  values,
double  t 
) const
inlineoverridevirtualinherited

◆ dPij_dt() [1/2]

◆ dPij_dt() [2/2]

double bpp::AbstractTotallyWrappedTransitionModel::dPij_dt ( size_t  i,
size_t  j,
double  t 
) const
inlineoverridevirtualinherited
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()

Implements bpp::TransitionModelInterface.

Definition at line 123 of file AbstractWrappedModel.h.

References bpp::TransitionModelInterface::dPij_dt(), and bpp::WrappedTransitionModelInterface::transitionModel().

◆ fireParameterChanged()

virtual void bpp::AbstractBiblioTransitionModel::fireParameterChanged ( const ParameterList parameters)
inlineoverridevirtualinherited

◆ freq() [1/2]

◆ freq() [2/2]

double bpp::AbstractTotallyWrappedTransitionModel::freq ( size_t  i) const
inlineoverridevirtualinherited

Methods to supersede TransitionModel methods.

Implements bpp::TransitionModelInterface.

Definition at line 120 of file AbstractWrappedModel.h.

References bpp::TransitionModelInterface::freq(), and bpp::WrappedTransitionModelInterface::transitionModel().

◆ frequencySet()

const FrequencySetInterface& bpp::AbstractBiblioMixedTransitionModel::frequencySet ( ) const
inlineoverridevirtual
Returns
Get the FrequencySet of equilibrium of this model.
Exceptions
Exceptionif no FrequenceSet is associated to this model.

Implements bpp::BranchModelInterface.

Definition at line 138 of file AbstractBiblioMixedTransitionModel.h.

References mixedModelPtr_.

Referenced by bpp::RELAX::RELAX(), bpp::YNGP_M1::YNGP_M1(), bpp::YNGP_M10::YNGP_M10(), bpp::YNGP_M2::YNGP_M2(), bpp::YNGP_M3::YNGP_M3(), bpp::YNGP_M7::YNGP_M7(), bpp::YNGP_M8::YNGP_M8(), and bpp::YNGP_M9::YNGP_M9().

◆ getAlphabet() [1/2]

◆ getAlphabet() [2/2]

std::shared_ptr<const Alphabet> bpp::AbstractWrappedModel::getAlphabet ( ) const
inlineoverridevirtualinherited

◆ getAlphabetStateAsChar() [1/2]

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

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 46 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getAlphabetStateAsChar(), and bpp::WrappedModelInterface::model().

Referenced by bpp::RegisterRatesSubstitutionModel::getAlphabetStateAsChar().

◆ getAlphabetStateAsChar() [2/2]

virtual std::string bpp::BranchModelInterface::getAlphabetStateAsChar ( size_t  index) const
pure virtualinherited

◆ getAlphabetStateAsInt() [1/2]

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

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 44 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getAlphabetStateAsInt(), and bpp::WrappedModelInterface::model().

Referenced by bpp::RegisterRatesSubstitutionModel::getAlphabetStateAsInt().

◆ getAlphabetStateAsInt() [2/2]

virtual int bpp::BranchModelInterface::getAlphabetStateAsInt ( size_t  index) const
pure virtualinherited

◆ getAlphabetStates() [1/2]

virtual const std::vector<int>& bpp::BranchModelInterface::getAlphabetStates ( ) const
pure virtualinherited

◆ getAlphabetStates() [2/2]

const std::vector<int>& bpp::AbstractWrappedModel::getAlphabetStates ( ) const
inlineoverridevirtualinherited

@ brief Methods to supersede TransitionModel methods.

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 38 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getAlphabetStates(), and bpp::WrappedModelInterface::model().

Referenced by bpp::RegisterRatesSubstitutionModel::getAlphabetStates().

◆ getd2Pij_dt2() [1/2]

◆ getd2Pij_dt2() [2/2]

const Matrix<double>& bpp::AbstractTotallyWrappedTransitionModel::getd2Pij_dt2 ( double  t) const
inlineoverridevirtualinherited
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()

Implements bpp::TransitionModelInterface.

Definition at line 132 of file AbstractWrappedModel.h.

References bpp::TransitionModelInterface::getd2Pij_dt2(), and bpp::WrappedTransitionModelInterface::transitionModel().

◆ getdPij_dt() [1/2]

◆ getdPij_dt() [2/2]

const Matrix<double>& bpp::AbstractTotallyWrappedTransitionModel::getdPij_dt ( double  t) const
inlineoverridevirtualinherited
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()

Implements bpp::TransitionModelInterface.

Definition at line 130 of file AbstractWrappedModel.h.

References bpp::TransitionModelInterface::getdPij_dt(), and bpp::WrappedTransitionModelInterface::transitionModel().

◆ getFrequencies() [1/2]

◆ getFrequencies() [2/2]

const Vdouble& bpp::AbstractTotallyWrappedTransitionModel::getFrequencies ( ) const
inlineoverridevirtualinherited
Returns
A vector of all equilibrium frequencies.
See also
freq()

Implements bpp::TransitionModelInterface.

Definition at line 126 of file AbstractWrappedModel.h.

References bpp::TransitionModelInterface::getFrequencies(), and bpp::WrappedTransitionModelInterface::transitionModel().

◆ getFrequencies_() [1/2]

Vdouble& bpp::AbstractTotallyWrappedTransitionModel::getFrequencies_ ( )
inlineoverrideprotectedvirtualinherited

◆ getFrequencies_() [2/2]

◆ getInitValue() [1/2]

virtual double bpp::BranchModelInterface::getInitValue ( size_t  i,
int  state 
) const
pure virtualinherited

This method is used to initialize likelihoods in recursions. 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();

Implemented in bpp::TransitionFromTransitionModel, bpp::RE08, bpp::OneChangeTransitionModel, bpp::OneChangeRegisterTransitionModel, bpp::MultinomialFromTransitionModel, bpp::MarkovModulatedSubstitutionModel, bpp::InMixedSubstitutionModel, bpp::AbstractTotallyWrappedTransitionModel, and bpp::AbstractTransitionModel.

Referenced by bpp::AbstractTotallyWrappedTransitionModel::getInitValue(), bpp::InMixedSubstitutionModel::getInitValue(), bpp::MultinomialFromTransitionModel::getInitValue(), bpp::OneChangeRegisterTransitionModel::getInitValue(), bpp::OneChangeTransitionModel::getInitValue(), and bpp::TransitionFromTransitionModel::getInitValue().

◆ getInitValue() [2/2]

double bpp::AbstractTotallyWrappedTransitionModel::getInitValue ( size_t  i,
int  state 
) const
inlineoverridevirtualinherited

This method is used to initialize likelihoods in recursions. 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::BranchModelInterface.

Definition at line 134 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getInitValue(), and bpp::WrappedTransitionModelInterface::transitionModel().

◆ getModelStates() [1/4]

virtual std::vector<size_t> bpp::BranchModelInterface::getModelStates ( const std::string &  code) const
pure virtualinherited

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.

Implemented in bpp::RegisterRatesSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, bpp::AbstractWrappedModel, and bpp::AbstractTransitionModel.

◆ getModelStates() [2/4]

std::vector<size_t> bpp::AbstractWrappedModel::getModelStates ( const std::string &  code) const
inlineoverridevirtualinherited

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::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 50 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getModelStates(), and bpp::WrappedModelInterface::model().

◆ getModelStates() [3/4]

virtual std::vector<size_t> bpp::BranchModelInterface::getModelStates ( int  code) const
pure virtualinherited

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.

Implemented in bpp::RegisterRatesSubstitutionModel, bpp::MarkovModulatedSubstitutionModel, bpp::AbstractWrappedModel, and bpp::AbstractTransitionModel.

Referenced by bpp::SubstitutionModelSet::getModelStates(), and bpp::AbstractWrappedModel::getModelStates().

◆ getModelStates() [4/4]

std::vector<size_t> bpp::AbstractWrappedModel::getModelStates ( int  code) const
inlineoverridevirtualinherited

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::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 48 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getModelStates(), and bpp::WrappedModelInterface::model().

Referenced by bpp::RegisterRatesSubstitutionModel::getModelStates().

◆ getName() [1/2]

virtual std::string bpp::BranchModelInterface::getName ( ) const
pure virtualinherited

Get the name of the model.

Returns
The name of this model.

Implemented in bpp::WordSubstitutionModel, bpp::TS98, bpp::TransitionFromTransitionModel, bpp::RegisterRatesSubstitutionModel, bpp::RE08, bpp::WAG01, bpp::UserProteinSubstitutionModel, bpp::LLG08_UL3, bpp::LLG08_UL3::EmbeddedModel, bpp::LLG08_UL2, bpp::LLG08_UL2::EmbeddedModel, bpp::LLG08_EX3, bpp::LLG08_EX3::EmbeddedModel, bpp::LLG08_EX2, bpp::LLG08_EX2::EmbeddedModel, bpp::LLG08_EHO, bpp::LLG08_EHO::EmbeddedModel, bpp::LGL08_CAT, bpp::LGL08_CAT::EmbeddedModel, bpp::LG08, bpp::JTT92, bpp::JCprot, bpp::DSO78, bpp::Coala, bpp::POMO, bpp::OneChangeTransitionModel, bpp::OneChangeRegisterTransitionModel, bpp::YpR_Gen, bpp::YpR_Sym, bpp::TN93, bpp::T92, bpp::SSR, bpp::RN95s, bpp::RN95, bpp::L95, bpp::K80, bpp::JCnuc, bpp::GTR, bpp::gBGC, bpp::F81, bpp::MultinomialFromTransitionModel, bpp::MixtureOfTransitionModels, bpp::MixtureOfATransitionModel, bpp::KroneckerWordSubstitutionModel, bpp::InMixedSubstitutionModel, bpp::G2001, bpp::FromMixtureSubstitutionModel, bpp::EquiprobableSubstitutionModel, bpp::D1WalkSubstitutionModel, bpp::YNGP_M9, bpp::YNGP_M8, bpp::YNGP_M7, bpp::YNGP_M3, bpp::YNGP_M2, bpp::YNGP_M10, bpp::YNGP_M1, bpp::YN98, bpp::TripletSubstitutionModel, bpp::SENCA, bpp::RELAX, bpp::MG94, bpp::KroneckerCodonDistanceSubstitutionModel, bpp::KroneckerCodonDistanceFrequenciesSubstitutionModel, bpp::KCM, bpp::GY94, bpp::DFPDistanceFrequenciesSubstitutionModel, bpp::DFP07, bpp::CodonSameAARateSubstitutionModel, bpp::CodonDistancePhaseFrequenciesSubstitutionModel, bpp::CodonDistanceFrequenciesSubstitutionModel, bpp::CodonAdHocSubstitutionModel, bpp::AnonymousSubstitutionModel, bpp::AbstractWrappedModel, bpp::TwoParameterBinarySubstitutionModel, bpp::LG10_EX_EHO, bpp::LG10_EX_EHO::EmbeddedModel, bpp::HKY85, bpp::F84, bpp::CodonDistanceSubstitutionModel, and bpp::BinarySubstitutionModel.

Referenced by bpp::YpR::checkModel(), bpp::TransitionMatrixFromModel::compute(), bpp::AbstractWrappedModel::getName(), bpp::FromMixtureSubstitutionModel::getName(), bpp::AbstractSubstitutionModel::getPij_t(), bpp::BppOSubstitutionModelFormat::initialize_(), bpp::MixtureOfSubstitutionModels::MixtureOfSubstitutionModels(), bpp::MixtureOfATransitionModel::model(), bpp::LegacyPhylogeneticsApplicationTools::setSubstitutionModelParametersInitialValuesWithAliases(), bpp::ModelPath::toString(), and bpp::BppOSubstitutionModelFormat::write().

◆ getName() [2/2]

◆ getNModel()

std::shared_ptr<const TransitionModelInterface> bpp::AbstractBiblioMixedTransitionModel::getNModel ( size_t  i) const
inlineoverridevirtual

◆ getNProbability()

double bpp::AbstractBiblioMixedTransitionModel::getNProbability ( size_t  i) const
inlineoverridevirtual

Returns the probability of a specific model from the mixture.

Implements bpp::MixedTransitionModelInterface.

Definition at line 51 of file AbstractBiblioMixedTransitionModel.h.

References bpp::MixedTransitionModelInterface::getNProbability(), and mixedModel().

◆ getNRate()

double bpp::AbstractBiblioMixedTransitionModel::getNRate ( size_t  i) const
inlineoverridevirtual

Returns the rate of a specific model from the mixture.

Implements bpp::MixedTransitionModelInterface.

Definition at line 112 of file AbstractBiblioMixedTransitionModel.h.

References bpp::MixedTransitionModelInterface::getNRate(), and mixedModel().

◆ getNumberOfModels()

size_t bpp::AbstractBiblioMixedTransitionModel::getNumberOfModels ( ) const
inlineoverridevirtual

Returns the number of submodels.

Implements bpp::MixedTransitionModelInterface.

Definition at line 78 of file AbstractBiblioMixedTransitionModel.h.

References bpp::MixedTransitionModelInterface::getNumberOfModels(), and mixedModel().

◆ getNumberOfStates() [1/2]

◆ getNumberOfStates() [2/2]

size_t bpp::AbstractWrappedModel::getNumberOfStates ( ) const
inlineoverridevirtualinherited

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::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 57 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getNumberOfStates(), and bpp::WrappedModelInterface::model().

◆ getParNameFromPmodel()

std::string AbstractBiblioTransitionModel::getParNameFromPmodel ( const std::string &  name) const
inherited

get the name of a parameter from its name in a submodel

Parameters
namethe name of the parameter in the submodel

Definition at line 37 of file AbstractBiblioSubstitutionModel.cpp.

References bpp::AbstractBiblioTransitionModel::mapParNamesFromPmodel_.

◆ getPij_t() [1/2]

◆ getPij_t() [2/2]

const Matrix<double>& bpp::AbstractTotallyWrappedTransitionModel::getPij_t ( double  t) const
inlineoverridevirtualinherited
Returns
All probabilities of change from state i to state j during time t.
See also
Pij_t()

Implements bpp::TransitionModelInterface.

Definition at line 128 of file AbstractWrappedModel.h.

References bpp::TransitionModelInterface::getPij_t(), and bpp::WrappedTransitionModelInterface::transitionModel().

◆ getPmodelParName()

std::string AbstractBiblioTransitionModel::getPmodelParName ( const std::string &  name) const
inherited

get the name of a parameter in the submodel from its apparent name

Parameters
namethe name of the parameter

Definition at line 47 of file AbstractBiblioSubstitutionModel.cpp.

References bpp::AbstractBiblioTransitionModel::mapParNamesFromPmodel_.

◆ getProbabilities()

const std::vector<double>& bpp::AbstractBiblioMixedTransitionModel::getProbabilities ( ) const
inlineoverridevirtual

Returns the vector of the probabilities of the submodels of the mixture.

Implements bpp::MixedTransitionModelInterface.

Definition at line 61 of file AbstractBiblioMixedTransitionModel.h.

References bpp::MixedTransitionModelInterface::getProbabilities(), and mixedModel().

◆ getRate() [1/2]

◆ getRate() [2/2]

double bpp::AbstractTotallyWrappedTransitionModel::getRate ( ) const
inlineoverridevirtualinherited

◆ getStateMap() [1/2]

virtual std::shared_ptr<const StateMapInterface> bpp::BranchModelInterface::getStateMap ( ) const
pure virtualinherited

◆ getStateMap() [2/2]

std::shared_ptr<const StateMapInterface> bpp::AbstractWrappedModel::getStateMap ( ) const
inlineoverridevirtualinherited
Returns
A shared_ptr to the mapping of model states with alphabet states.

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 42 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::getStateMap(), and bpp::WrappedModelInterface::model().

Referenced by bpp::RegisterRatesSubstitutionModel::getStateMap().

◆ getSubmodelNumbers()

Vuint AbstractBiblioMixedTransitionModel::getSubmodelNumbers ( const std::string &  desc) const
overridevirtual

◆ getVRates()

const std::vector<double>& bpp::AbstractBiblioMixedTransitionModel::getVRates ( ) const
inlineoverridevirtual

Returns the vector of all the rates of the mixture.

Implements bpp::MixedTransitionModelInterface.

Definition at line 104 of file AbstractBiblioMixedTransitionModel.h.

References bpp::MixedTransitionModelInterface::getVRates(), and mixedModel().

◆ Lik_t() [1/2]

virtual const Eigen::VectorXd& bpp::TransitionModelInterface::Lik_t ( const Eigen::VectorXd &  values,
double  t 
) const
pure virtualinherited

This method is used to compute likelihoods in recursions. It computes the probability of a vector given a start state.

Parameters
valuesAn vector of states on the site.
tthe branch length

Implements bpp::BranchModelInterface.

Implemented in bpp::AbstractLkTransitionModel.

◆ Lik_t() [2/2]

const Eigen::VectorXd& bpp::AbstractLkTransitionModel::Lik_t ( const Eigen::VectorXd &  values,
double  t 
) const
inlineoverridevirtualinherited

This method is used to compute likelihoods in recursions. It computes the probability of a vector given a start state.

Parameters
valuesAn vector of states on the site.
tthe branch length

Implements bpp::TransitionModelInterface.

Definition at line 30 of file AbstractSubstitutionModel.h.

References bpp::TransitionModelInterface::getPij_t(), and bpp::AbstractLkTransitionModel::lik_.

◆ mixedModel()

◆ mixedModel_()

MixedTransitionModelInterface& bpp::AbstractBiblioMixedTransitionModel::mixedModel_ ( )
inlineprotected

◆ model() [1/2]

◆ model() [2/2]

const TransitionModelInterface& bpp::AbstractBiblioMixedTransitionModel::model ( const std::string &  name) const
inlineoverridevirtual

Access the submodel with the given name.

Exceptions
NullPointerExceptionif no model with the given name is found.

Implements bpp::MixedTransitionModelInterface.

Definition at line 123 of file AbstractBiblioMixedTransitionModel.h.

References mixedModel(), and bpp::MixedTransitionModelInterface::model().

◆ model_()

◆ nModel()

const TransitionModelInterface& bpp::AbstractBiblioMixedTransitionModel::nModel ( size_t  i) const
inlineoverridevirtual

Returns the submodel from the mixture.

Implements bpp::MixedTransitionModelInterface.

Definition at line 38 of file AbstractBiblioMixedTransitionModel.h.

References mixedModel(), and bpp::MixedTransitionModelInterface::nModel().

Referenced by bpp::DFP07::proteinModel().

◆ nModel_()

TransitionModelInterface& bpp::AbstractBiblioMixedTransitionModel::nModel_ ( size_t  i)
inlineoverrideprotectedvirtual

◆ normalizeVRates()

void bpp::AbstractBiblioMixedTransitionModel::normalizeVRates ( )
inlineoverridevirtual

normalizes the rates of the submodels.

Implements bpp::MixedTransitionModelInterface.

Definition at line 96 of file AbstractBiblioMixedTransitionModel.h.

References mixedModel_(), and bpp::MixedTransitionModelInterface::normalizeVRates().

◆ operator=()

◆ Pij_t() [1/2]

◆ Pij_t() [2/2]

double bpp::AbstractTotallyWrappedTransitionModel::Pij_t ( size_t  i,
size_t  j,
double  t 
) const
inlineoverridevirtualinherited
Returns
The probability of change from state i to state j during time t.
See also
getPij_t(), getStates()

Implements bpp::TransitionModelInterface.

Definition at line 122 of file AbstractWrappedModel.h.

References bpp::TransitionModelInterface::Pij_t(), and bpp::WrappedTransitionModelInterface::transitionModel().

◆ setFreq() [1/2]

◆ setFreq() [2/2]

virtual void bpp::TransitionModelInterface::setFreq ( std::map< int, double > &  frequencies)
pure virtualinherited

◆ setFreqFromData() [1/2]

void AbstractBiblioTransitionModel::setFreqFromData ( const SequenceDataInterface data,
double  pseudoCount = 0 
)
overridevirtualinherited

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::TransitionModelInterface.

Definition at line 125 of file AbstractBiblioSubstitutionModel.cpp.

References bpp::SequenceContainerTools::getFrequencies(), and bpp::AbstractBiblioTransitionModel::setFreq().

◆ setFreqFromData() [2/2]

virtual void bpp::TransitionModelInterface::setFreqFromData ( const SequenceDataInterface data,
double  pseudoCount = 0 
)
pure virtualinherited

◆ setNamespace()

◆ setNProbability()

void bpp::AbstractBiblioMixedTransitionModel::setNProbability ( size_t  i,
double  prob 
)
inlineoverridevirtual

Sets the probabilities of the submodels of the mixture.

Implements bpp::MixedTransitionModelInterface.

Definition at line 70 of file AbstractBiblioMixedTransitionModel.h.

References mixedModel_(), and bpp::MixedTransitionModelInterface::setNProbability().

◆ setRate() [1/2]

void bpp::AbstractTotallyWrappedTransitionModel::setRate ( double  rate)
inlineoverridevirtualinherited

Set the rate of the model (must be positive).

Parameters
ratemust be positive.

Implements bpp::BranchModelInterface.

Definition at line 144 of file AbstractWrappedModel.h.

References bpp::BranchModelInterface::setRate(), and bpp::AbstractWrappedTransitionModel::transitionModel_().

◆ setRate() [2/2]

◆ setVRates()

void bpp::AbstractBiblioMixedTransitionModel::setVRates ( const Vdouble vd)
inlineoverridevirtual

sets the rates of the submodels.

Implements bpp::MixedTransitionModelInterface.

Definition at line 87 of file AbstractBiblioMixedTransitionModel.h.

References mixedModel_(), and bpp::MixedTransitionModelInterface::setVRates().

◆ stateMap() [1/2]

virtual const StateMapInterface& bpp::BranchModelInterface::stateMap ( ) const
pure virtualinherited

◆ stateMap() [2/2]

const StateMapInterface& bpp::AbstractWrappedModel::stateMap ( ) const
inlineoverridevirtualinherited
Returns
The mapping of model states with alphabet states.

Implements bpp::BranchModelInterface.

Reimplemented in bpp::RegisterRatesSubstitutionModel.

Definition at line 40 of file AbstractWrappedModel.h.

References bpp::WrappedModelInterface::model(), and bpp::BranchModelInterface::stateMap().

Referenced by bpp::RegisterRatesSubstitutionModel::stateMap().

◆ transitionModel()

const TransitionModelInterface& bpp::AbstractBiblioMixedTransitionModel::transitionModel ( ) const
inlineoverridevirtual

◆ transitionModel_()

TransitionModelInterface& bpp::AbstractBiblioMixedTransitionModel::transitionModel_ ( )
inlineoverrideprotectedvirtual

◆ updateMatrices_()

Member Data Documentation

◆ lik_

Eigen::VectorXd bpp::AbstractLkTransitionModel::lik_
mutableprivateinherited

◆ lParPmodel_

◆ mapParNamesFromPmodel_

◆ mixedModelPtr_


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