bpp-phyl3 3.0.0
AbstractBiblioMixedTransitionModel.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: The Bio++ Development Group
2//
3// SPDX-License-Identifier: CECILL-2.1
4
5#ifndef BPP_PHYL_MODEL_ABSTRACTBIBLIOMIXEDTRANSITIONMODEL_H
6#define BPP_PHYL_MODEL_ABSTRACTBIBLIOMIXEDTRANSITIONMODEL_H
7
8
11
12namespace bpp
13{
19 public virtual MixedTransitionModelInterface,
21{
22protected:
23 std::unique_ptr<MixedTransitionModelInterface> mixedModelPtr_;
24
25public:
26 AbstractBiblioMixedTransitionModel(const std::string& prefix);
27
29
31
33
34public:
38 const TransitionModelInterface& nModel(size_t i) const override
39 {
40 return mixedModel().nModel(i);
41 }
42
43 std::shared_ptr<const TransitionModelInterface> getNModel(size_t i) const override
44 {
45 return mixedModel().getNModel(i);
46 }
47
51 double getNProbability(size_t i) const override
52 {
53 return mixedModel().getNProbability(i);
54 }
55
61 const std::vector<double>& getProbabilities() const override
62 {
64 }
65
70 void setNProbability(size_t i, double prob) override
71 {
73 }
74
78 size_t getNumberOfModels() const override
79 {
81 }
82
87 void setVRates(const Vdouble& vd) override
88 {
90 }
91
96 void normalizeVRates() override
97 {
99 }
100
104 const std::vector<double>& getVRates() const override
105 {
106 return mixedModel().getVRates();
107 }
108
112 double getNRate(size_t i) const override
113 {
114 return mixedModel().getNRate(i);
115 }
116
123 const TransitionModelInterface& model(const std::string& name) const override
124 {
125 return mixedModel().model(name);
126 }
127
132 Vuint getSubmodelNumbers(const std::string& desc) const override;
133
134 const TransitionModelInterface& transitionModel() const override { return *mixedModelPtr_; }
135
137
138 const FrequencySetInterface& frequencySet() const override
139 {
140 return mixedModelPtr_->nModel(0).frequencySet();
141 }
142
143protected:
145 {
146 return *mixedModelPtr_;
147 }
148
150
152 {
153 return mixedModel_().nModel_(i);
154 }
155};
156} // end of namespace bpp.
157#endif // BPP_PHYL_MODEL_ABSTRACTBIBLIOMIXEDTRANSITIONMODEL_H
Abstract class for mixture models based on the bibliography.
TransitionModelInterface & transitionModel_() override
double getNRate(size_t i) const override
Returns the rate of a specific model from the mixture.
void setNProbability(size_t i, double prob) override
Sets the probabilities of the submodels of the mixture.
void normalizeVRates() override
normalizes the rates of the submodels.
AbstractBiblioMixedTransitionModel & operator=(const AbstractBiblioMixedTransitionModel &model)
const TransitionModelInterface & transitionModel() const override
void setVRates(const Vdouble &vd) override
sets the rates of the submodels.
Vuint getSubmodelNumbers(const std::string &desc) const override
Returns the vector of numbers of the submodels in the mixture that match a description.
TransitionModelInterface & nModel_(size_t i) override
const std::vector< double > & getVRates() const override
Returns the vector of all the rates of the mixture.
const MixedTransitionModelInterface & mixedModel() const
const std::vector< double > & getProbabilities() const override
Returns the vector of the probabilities of the submodels of the mixture.
size_t getNumberOfModels() const override
Returns the number of submodels.
std::unique_ptr< MixedTransitionModelInterface > mixedModelPtr_
const TransitionModelInterface & model(const std::string &name) const override
Access the submodel with the given name.
const FrequencySetInterface & frequencySet() const override
const TransitionModelInterface & nModel(size_t i) const override
Returns the submodel from the mixture.
std::shared_ptr< const TransitionModelInterface > getNModel(size_t i) const override
double getNProbability(size_t i) const override
Returns the probability of a specific model from the mixture.
Partial implementation of the SubstitutionModel interface for models that are set for matching the bi...
const BranchModelInterface & model() const override
Parametrize a set of state frequencies.
Definition: FrequencySet.h:29
Interface for Transition models, defined as a mixture of "simple" transition models.
virtual double getNProbability(size_t i) const =0
Returns the probability of a specific model from the mixture.
virtual double getNRate(size_t i) const =0
Returns the rate of a specific submodel.
virtual void setVRates(const Vdouble &vd)=0
Sets the rates of the submodels to be proportional to a given vector, and normalizes them so that the...
virtual TransitionModelInterface & nModel_(size_t i)=0
virtual const std::vector< double > & getProbabilities() const =0
virtual const std::vector< double > & getVRates() const =0
Returns the rates of the submodels.
virtual void setNProbability(size_t i, double prob)=0
Sets the probability of a specific model from the mixture.
virtual void normalizeVRates()=0
Normalizes the rates of the submodels so that the mean rate of the mixture equals rate_.
virtual const TransitionModelInterface & model(const std::string &name) const =0
Access the submodel with the given name.
virtual std::shared_ptr< const TransitionModelInterface > getNModel(size_t i) const =0
virtual size_t getNumberOfModels() const =0
virtual const TransitionModelInterface & nModel(size_t i) const =0
Returns a specific model from the mixture.
Interface for all transition models.
virtual const BranchModelInterface & model() const =0
Defines the basic types of data flow nodes.
std::vector< double > Vdouble
std::vector< unsigned int > Vuint