bpp-phyl3 3.0.0
AbstractBiblioSubstitutionModel.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_ABSTRACTBIBLIOSUBSTITUTIONMODEL_H
6#define BPP_PHYL_MODEL_ABSTRACTBIBLIOSUBSTITUTIONMODEL_H
7
9
11#include "SubstitutionModel.h"
12
13namespace bpp
14{
22{
23protected:
28 std::map<std::string, std::string> mapParNamesFromPmodel_;
29
31
32public:
33 AbstractBiblioTransitionModel(const std::string& prefix);
34
36
38
40
41protected:
42 virtual void updateMatrices_();
43
44public:
50 std::string getParNameFromPmodel(const std::string& name) const;
51
57 std::string getPmodelParName(const std::string& name) const;
58
64 void addRateParameter() override;
65
66 void setFreqFromData(const SequenceDataInterface& data, double pseudoCount = 0) override;
67
68 void setFreq(std::map<int, double>& frequ) override;
69
70 /*
71 * @}
72 *
73 */
74
86 virtual void fireParameterChanged(const ParameterList& parameters) override
87 {
88 if (parameters.hasParameter(getNamespace() + "rate"))
89 {
90 model_().setRate(parameters.getParameterValue(getNamespace() + "rate"));
91 if (parameters.size() != 1)
93 }
94 else
96 }
97
98 void setNamespace(const std::string& name) override;
99
100 /*
101 * @}
102 */
103};
104
106 public virtual AbstractBiblioTransitionModel,
108{
109public:
110 AbstractBiblioSubstitutionModel(const std::string& prefix) :
113 {}
114
117 {}
118
119
121 {
123 return *this;
124 }
125
127
128protected:
129 void updateMatrices_() override
130 {
132 }
133};
134} // end of namespace bpp.
135#endif // BPP_PHYL_MODEL_ABSTRACTBIBLIOSUBSTITUTIONMODEL_H
AbstractBiblioSubstitutionModel & operator=(const AbstractBiblioSubstitutionModel &model)
AbstractBiblioSubstitutionModel(const AbstractBiblioSubstitutionModel &model)
Partial implementation of the SubstitutionModel interface for models that are set for matching the bi...
std::map< std::string, std::string > mapParNamesFromPmodel_
Tools to make the link between the Parameters of the object and those of pmixmodel_.
void setFreq(std::map< int, double > &frequ) override
Set equilibrium frequencies.
std::string getPmodelParName(const std::string &name) const
get the name of a parameter in the submodel from its apparent name
void addRateParameter() override
Methods to supersede TransitionModel methods.
AbstractBiblioTransitionModel & operator=(const AbstractBiblioTransitionModel &model)
virtual void fireParameterChanged(const ParameterList &parameters) override
Methods to supersede AbstractTransitionModel methods.
void setNamespace(const std::string &name) override
void setFreqFromData(const SequenceDataInterface &data, double pseudoCount=0) override
Set equilibrium frequencies equal to the frequencies estimated from the data.
std::string getParNameFromPmodel(const std::string &name) const
get the name of a parameter from its name in a submodel
std::string getNamespace() const override
const BranchModelInterface & model() const override
virtual void setRate(double rate)=0
Set the rate of the model (must be positive).
virtual bool hasParameter(const std::string &name) const
size_t size() const
virtual double getParameterValue(const std::string &name) const
Defines the basic types of data flow nodes.