bpp-phyl3
3.0.0
|
From a transition model, compute the transition function probabilities. More...
#include <Bpp/Phyl/Model/TransitionFromTransitionModel.h>
Public Member Functions | |
TransitionFromTransitionModel (std::shared_ptr< TransitionModelInterface > originalModel) | |
TransitionFromTransitionModel (const TransitionFromTransitionModel &fmsm) | |
TransitionFromTransitionModel & | operator= (const TransitionFromTransitionModel &fmsm) |
virtual | ~TransitionFromTransitionModel () |
TransitionFromTransitionModel * | clone () const override |
void | fireParameterChanged (const ParameterList ¶meters) override |
const BranchModelInterface & | model () const override |
const TransitionModelInterface & | transitionModel () const |
const Eigen::VectorXd & | Lik_t (const Eigen::VectorXd &from, double t) const override |
const Eigen::VectorXd & | dLik_dt (const Eigen::VectorXd &from, double t) const override |
const Eigen::VectorXd & | d2Lik_dt2 (const Eigen::VectorXd &from, double t) const override |
void | setFreqFromData (const SequenceDataInterface &data, double pseudoCount) |
virtual void | setFreq (std::map< int, double > &m) |
double | getRate () const override |
Get the rate. More... | |
void | setRate (double rate) override |
Set the rate of the model (must be positive). More... | |
double | getInitValue (size_t i, int state) const override |
std::string | getName () const override |
Get the name of the model. More... | |
void | addRateParameter () override |
void | setNamespace (const std::string &prefix) |
bool | hasIndependentParameter (const std::string &name) const |
const ParameterList & | getIndependentParameters () 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 ParameterList & | getParameters () const override |
const Parameter & | parameter (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 ¶meters) override |
void | setParameterValue (const std::string &name, double value) override |
void | setParametersValues (const ParameterList ¶meters) override |
bool | matchParametersValues (const ParameterList ¶meters) 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 |
const std::vector< int > & | getAlphabetStates () const override |
const StateMapInterface & | stateMap () const override |
std::shared_ptr< const StateMapInterface > | getStateMap () 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 Alphabet & | alphabet () const override |
std::shared_ptr< const Alphabet > | getAlphabet () const override |
size_t | getNumberOfStates () const override |
Get the number of states. More... | |
const FrequencySetInterface & | frequencySet () const override |
Protected Member Functions | |
BranchModelInterface & | model_ () |
TransitionModelInterface & | transitionModel_ () |
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 ¶meters) |
void | shareParameter_ (const std::shared_ptr< Parameter > ¶meter) |
void | shareParameters_ (const ParameterList ¶meters) |
void | includeParameters_ (const ParameterList ¶meters) |
void | deleteParameter_ (size_t index) |
void | deleteParameter_ (std::string &name) |
void | deleteParameters_ (const std::vector< std::string > &names) |
void | resetParameters_ () |
Parameter & | getParameter_ (const std::string &name) |
Parameter & | getParameter_ (size_t index) |
const Parameter & | getParameter_ (size_t index) const |
Parameter & | getParameterWithNamespace_ (const std::string &name) |
const Parameter & | getParameterWithNamespace_ (const std::string &name) const |
ParameterList & | getParameters_ () override |
Private Attributes | |
std::shared_ptr< TransitionModelInterface > | subModel_ |
The related model. More... | |
size_t | size_ |
double | tref_ |
Reference time to avoid recomuputation of transition matrix when time has not changed. If <0, it means that transition matrix should be recomputed (for ex if parameters have changed). More... | |
const Matrix< double > * | Pij_t |
Transition Matrices owned by the submodel. More... | |
const Matrix< double > * | dPij_dt |
const Matrix< double > * | d2Pij_dt2 |
Eigen::VectorXd | Pi_ |
Used return vectors. More... | |
Eigen::VectorXd | dPi_ |
Eigen::VectorXd | d2Pi_ |
ParameterList | independentParameters_ |
std::map< std::string, std::shared_ptr< AliasParameterListener > > | aliasListenersRegister_ |
ParameterList | parameters_ |
std::string | prefix_ |
From a transition model, compute the transition function probabilities.
This class is (up to now) mostly for test purpose.
It has the same parameters as the SubModel.
Definition at line 21 of file TransitionFromTransitionModel.h.
|
inline |
Definition at line 58 of file TransitionFromTransitionModel.h.
References bpp::AbstractParameterAliasable::addParameters_(), bpp::AbstractParameterAliasable::getNamespace(), and subModel_.
Referenced by clone().
|
inline |
Definition at line 69 of file TransitionFromTransitionModel.h.
|
inlinevirtual |
Definition at line 92 of file TransitionFromTransitionModel.h.
|
inlineoverridevirtual |
Implements bpp::BranchModelInterface.
Definition at line 142 of file TransitionFromTransitionModel.h.
References bpp::AbstractParameterAliasable::addParameter_(), bpp::BranchModelInterface::addRateParameter(), bpp::AbstractParameterAliasable::getNamespace(), getRate(), model(), model_(), and bpp::Parameter::R_PLUS_STAR.
|
inlineoverridevirtualinherited |
Implements bpp::BranchModelInterface.
Reimplemented in bpp::RegisterRatesSubstitutionModel.
Definition at line 53 of file AbstractWrappedModel.h.
References bpp::BranchModelInterface::alphabet(), and bpp::WrappedModelInterface::model().
Referenced by bpp::RegisterRatesSubstitutionModel::alphabet(), and bpp::OneChangeRegisterTransitionModel::OneChangeRegisterTransitionModel().
|
inlineoverridevirtual |
Implements bpp::AbstractParameterAliasable.
Definition at line 94 of file TransitionFromTransitionModel.h.
References TransitionFromTransitionModel().
|
overridevirtual |
Implements bpp::BranchModelInterface.
Definition at line 59 of file TransitionFromTransitionModel.cpp.
References to().
|
overridevirtual |
Implements bpp::BranchModelInterface.
Definition at line 37 of file TransitionFromTransitionModel.cpp.
References to().
|
inlineoverridevirtual |
Reimplemented from bpp::AbstractParameterAliasable.
Definition at line 97 of file TransitionFromTransitionModel.h.
References bpp::AbstractParameterAliasable::fireParameterChanged(), bpp::AbstractParameterAliasable::matchParametersValues(), model_(), and tref_.
|
inlineoverridevirtualinherited |
Exception | if no FrequenceSet is associated to this model. |
Implements bpp::BranchModelInterface.
Reimplemented in bpp::RegisterRatesSubstitutionModel, bpp::OneChangeTransitionModel, bpp::OneChangeRegisterTransitionModel, bpp::YN98, and bpp::AbstractWrappedTransitionModel.
Definition at line 59 of file AbstractWrappedModel.h.
References bpp::BranchModelInterface::frequencySet(), and bpp::WrappedModelInterface::model().
Referenced by bpp::YN98::frequencySet().
|
inlineoverridevirtualinherited |
Implements bpp::BranchModelInterface.
Reimplemented in bpp::RegisterRatesSubstitutionModel.
Definition at line 55 of file AbstractWrappedModel.h.
References bpp::BranchModelInterface::getAlphabet(), and bpp::WrappedModelInterface::model().
Referenced by bpp::RegisterRatesSubstitutionModel::getAlphabet(), and bpp::OneChangeRegisterTransitionModel::OneChangeRegisterTransitionModel().
|
inlineoverridevirtualinherited |
index | The model state. |
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().
|
inlineoverridevirtualinherited |
index | The model state. |
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().
|
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().
|
inlineoverridevirtual |
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.
i | the index of the state in the model. |
state | An observed state in the sequence/site. |
IndexOutOfBoundsException | if array position is out of range. |
BadIntException | if states are not allowed in the associated alphabet. |
Implements bpp::BranchModelInterface.
Definition at line 132 of file TransitionFromTransitionModel.h.
References bpp::BranchModelInterface::getInitValue(), and transitionModel().
|
inlineoverridevirtualinherited |
Get the state in the model corresponding to a particular state in the alphabet.
code | The alphabet state to check. |
Implements bpp::BranchModelInterface.
Reimplemented in bpp::RegisterRatesSubstitutionModel.
Definition at line 50 of file AbstractWrappedModel.h.
References bpp::BranchModelInterface::getModelStates(), and bpp::WrappedModelInterface::model().
|
inlineoverridevirtualinherited |
Get the state in the model corresponding to a particular state in the alphabet.
code | The alphabet state to check. |
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().
|
inlineoverridevirtual |
Get the name of the model.
Reimplemented from bpp::AbstractWrappedModel.
Definition at line 137 of file TransitionFromTransitionModel.h.
|
inlineoverridevirtualinherited |
Get the number of states.
For most models, this equals the size of the alphabet.
Implements bpp::BranchModelInterface.
Reimplemented in bpp::RegisterRatesSubstitutionModel.
Definition at line 57 of file AbstractWrappedModel.h.
References bpp::BranchModelInterface::getNumberOfStates(), and bpp::WrappedModelInterface::model().
|
inlineoverridevirtual |
Get the rate.
Implements bpp::BranchModelInterface.
Definition at line 128 of file TransitionFromTransitionModel.h.
References bpp::BranchModelInterface::getRate(), and transitionModel().
Referenced by addRateParameter().
|
inlineoverridevirtualinherited |
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().
|
overridevirtual |
This method is used to compute likelihoods in recursions. It computes the probability of a vector given a start state.
values | An vector of states on the site. |
t | time |
IndexOutOfBoundsException | if array position is out of range. |
BadIntException | if states are not allowed in the associated alphabet. |
Implements bpp::BranchModelInterface.
Definition at line 14 of file TransitionFromTransitionModel.cpp.
References to().
|
inlineoverridevirtual |
Implements bpp::WrappedModelInterface.
Definition at line 104 of file TransitionFromTransitionModel.h.
References subModel_.
Referenced by addRateParameter().
|
inlineprotected |
Definition at line 149 of file TransitionFromTransitionModel.h.
References subModel_.
Referenced by addRateParameter(), and fireParameterChanged().
|
inline |
Definition at line 77 of file TransitionFromTransitionModel.h.
References d2Pi_, dPi_, bpp::AbstractParameterAliasable::operator=(), Pi_, size_, subModel_, and tref_.
|
inlinevirtual |
Definition at line 123 of file TransitionFromTransitionModel.h.
References bpp::TransitionModelInterface::setFreq(), and transitionModel_().
|
inline |
Definition at line 118 of file TransitionFromTransitionModel.h.
References bpp::TransitionModelInterface::setFreqFromData(), and transitionModel_().
|
inlineoverridevirtual |
Set the rate of the model (must be positive).
rate | must be positive. |
Implements bpp::BranchModelInterface.
Definition at line 130 of file TransitionFromTransitionModel.h.
References bpp::BranchModelInterface::setRate(), and transitionModel_().
|
inlineoverridevirtualinherited |
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().
|
inline |
Definition at line 109 of file TransitionFromTransitionModel.h.
References subModel_.
Referenced by getInitValue(), and getRate().
|
inlineprotected |
Definition at line 154 of file TransitionFromTransitionModel.h.
References subModel_.
Referenced by setFreq(), setFreqFromData(), and setRate().
|
private |
Definition at line 55 of file TransitionFromTransitionModel.h.
Referenced by operator=().
|
private |
Definition at line 50 of file TransitionFromTransitionModel.h.
|
private |
Definition at line 55 of file TransitionFromTransitionModel.h.
Referenced by operator=().
|
private |
Definition at line 50 of file TransitionFromTransitionModel.h.
|
mutableprivate |
Used return vectors.
Definition at line 55 of file TransitionFromTransitionModel.h.
Referenced by operator=().
|
mutableprivate |
Transition Matrices owned by the submodel.
These ones are for bookkeeping:
Definition at line 50 of file TransitionFromTransitionModel.h.
|
private |
The number of states
Definition at line 33 of file TransitionFromTransitionModel.h.
Referenced by operator=().
|
private |
The related model.
Definition at line 28 of file TransitionFromTransitionModel.h.
Referenced by model(), model_(), operator=(), TransitionFromTransitionModel(), transitionModel(), and transitionModel_().
|
mutableprivate |
Reference time to avoid recomuputation of transition matrix when time has not changed. If <0, it means that transition matrix should be recomputed (for ex if parameters have changed).
Definition at line 41 of file TransitionFromTransitionModel.h.
Referenced by fireParameterChanged(), and operator=().