bpp-phyl3 3.0.0
FromMixtureSubstitutionModel.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_FROMMIXTURESUBSTITUTIONMODEL_H
6#define BPP_PHYL_MODEL_FROMMIXTURESUBSTITUTIONMODEL_H
7
8
12
13namespace bpp
14{
23{
24private:
30 std::unique_ptr<SubstitutionModelInterface> subModel_;
31
35 std::string mixtName_;
36
37public:
39 const MixedTransitionModelInterface& mixedModel,
40 const std::string& subModelName, const std::string& mixtDesc);
41
43 const MixedTransitionModelInterface& mixedModel,
44 size_t subModelNumber,
45 const std::string& mixtDesc);
46
48
50
52
53 FromMixtureSubstitutionModel* clone() const override { return new FromMixtureSubstitutionModel(*this); }
54
55public:
57 {
58 return *subModel_.get();
59 }
60
61protected:
63 {
64 return *subModel_;
65 }
66
67public:
80 void fireParameterChanged(const ParameterList& parameters) override
81 {
82 model_().matchParametersValues(parameters);
83 }
84
85 virtual void setNamespace(const std::string& name) override
86 {
88 model_().setNamespace(name);
89 }
90
91 virtual void addRateParameter() override
92 {
95 }
96
97 /*
98 * @}
99 */
100 std::string getName() const override
101 {
102 size_t posp = mixtName_.find("(");
103 return mixtName_.substr(0, posp) + "_" + model().getName() + mixtName_.substr(posp);
104 }
105};
106} // end of namespace bpp.
107#endif // BPP_PHYL_MODEL_FROMMIXTURESUBSTITUTIONMODEL_H
void addParameter_(Parameter *parameter)
void setNamespace(const std::string &prefix)
std::string getNamespace() const override
double getRate() const override
Get the rate.
const BranchModelInterface & model() const override
virtual std::string getName() const =0
Get the name of the model.
virtual void addRateParameter()=0
Model taken from a SubModel of a Mixture of SubstitutionModels.
void fireParameterChanged(const ParameterList &parameters) override
Tells the model that a parameter value has changed.
FromMixtureSubstitutionModel & operator=(const FromMixtureSubstitutionModel &fmsm)
std::unique_ptr< SubstitutionModelInterface > subModel_
The subModel taken from the AbstractTotallyWrappedSubstitutionModel.
std::string mixtName_
The name of the mixture model (for io purpose).
FromMixtureSubstitutionModel(const MixedTransitionModelInterface &mixedModel, const std::string &subModelName, const std::string &mixtDesc)
std::string getName() const override
Get the name of the model.
FromMixtureSubstitutionModel * clone() const override
virtual void setNamespace(const std::string &name) override
const SubstitutionModelInterface & substitutionModel() const override
SubstitutionModelInterface & substitutionModel_() override
Interface for Transition models, defined as a mixture of "simple" transition models.
static const std::shared_ptr< IntervalConstraint > R_PLUS_STAR
virtual bool matchParametersValues(const ParameterList &parameters)=0
virtual void setNamespace(const std::string &prefix)=0
Interface for all substitution models.
Defines the basic types of data flow nodes.