bpp-phyl3 3.0.0
YpR.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_NUCLEOTIDE_YPR_H
6#define BPP_PHYL_MODEL_NUCLEOTIDE_YPR_H
7
9
10#include "../AbstractSubstitutionModel.h"
12
13// From Utils:
14#include <Bpp/Exceptions.h>
15
16using namespace std;
17
18namespace bpp
19{
86class YpR :
88{
89protected:
90 std::unique_ptr<NucleotideSubstitutionModelInterface> pmodel_;
91
92 // Prefix of the native pmodel_
93 std::string nestedPrefix_;
94
95protected:
100 YpR(
101 std::shared_ptr<const RNY>,
102 std::unique_ptr<NucleotideSubstitutionModelInterface> const,
103 const std::string& prefix);
104
105 YpR(const YpR& ypr);
106
107 YpR& operator=(const YpR& ypr)
108 {
112 pmodel_.reset(ypr.pmodel_->clone());
113 return *this;
114 }
115
116public:
117 virtual ~YpR() {}
118
119protected:
120 void updateMatrices_(double, double, double, double,
121 double, double, double, double);
122
123 virtual void updateMatrices_() override;
124
125 string getNestedPrefix() const
126 {
127 return nestedPrefix_;
128 }
129
130public:
131 // virtual std::string getName() const;
132
134
135 size_t getNumberOfStates() const override { return 36; }
136
137 virtual void setNamespace(const std::string&) override;
138
139 void fireParameterChanged(const ParameterList& parameters) override
140 {
142 pmodel_->matchParametersValues(parameters);
144 }
145
146 // Check that the model is good for YpR
147 void checkModel(const SubstitutionModelInterface& model) const;
148};
149}
150
151
152// //////////////////////////////////////
153// //////// YpR_symetrical
154
155namespace bpp
156{
169class YpR_Sym :
170 public YpR
171{
172public:
179 YpR_Sym(
180 std::shared_ptr<const RNY> alph,
181 std::unique_ptr<NucleotideSubstitutionModelInterface> pm,
182 double CgT = 0., double TgC = 0.,
183 double CaT = 0., double TaC = 0.);
184
185 YpR_Sym(const YpR_Sym&);
186
187 virtual ~YpR_Sym() {}
188
189 YpR_Sym* clone() const override { return new YpR_Sym(*this); }
190
191 std::string getName() const override;
192
193protected:
194 void updateMatrices_() override;
195};
196
197// //////////////////////////////////////
198// //////// YpR_general
199
210class YpR_Gen :
211 public YpR
212{
213public:
221 YpR_Gen(
222 std::shared_ptr<const RNY> alph,
223 std::unique_ptr<NucleotideSubstitutionModelInterface> pm,
224 double CgT = 0., double cGA = 0.,
225 double TgC = 0., double tGA = 0.,
226 double CaT = 0., double cAG = 0.,
227 double TaC = 0., double tAG = 0.);
228
229 YpR_Gen(const YpR_Gen&);
230
231 virtual ~YpR_Gen() {}
232
233 YpR_Gen* clone() const override { return new YpR_Gen(*this); }
234
235 std::string getName() const override;
236
237protected:
238 void updateMatrices_() override;
239};
240}
241#endif // BPP_PHYL_MODEL_NUCLEOTIDE_YPR_H
AbstractParameterAliasable & operator=(const AbstractParameterAliasable &ap)
AbstractSubstitutionModel & operator=(const AbstractSubstitutionModel &model)
virtual void fireParameterChanged(const ParameterList &parameters) override
Tells the model that a parameter value has changed.
Specialisation interface for nucleotide substitution model.
Interface for all substitution models.
General YpR model.
Definition: YpR.h:212
void updateMatrices_() override
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
Definition: YpR.cpp:412
YpR_Gen * clone() const override
Definition: YpR.h:233
std::string getName() const override
Get the name of the model.
Definition: YpR.cpp:435
virtual ~YpR_Gen()
Definition: YpR.h:231
YpR_Gen(std::shared_ptr< const RNY > alph, std::unique_ptr< NucleotideSubstitutionModelInterface > pm, double CgT=0., double cGA=0., double TgC=0., double tGA=0., double CaT=0., double cAG=0., double TaC=0., double tAG=0.)
Build a new YpR_Gen substitution model.
Definition: YpR.cpp:390
symmetrical YpR model.
Definition: YpR.h:171
std::string getName() const override
Get the name of the model.
Definition: YpR.cpp:379
virtual ~YpR_Sym()
Definition: YpR.h:187
YpR_Sym(std::shared_ptr< const RNY > alph, std::unique_ptr< NucleotideSubstitutionModelInterface > pm, double CgT=0., double TgC=0., double CaT=0., double TaC=0.)
Build a new YpR_Sym substitution model.
Definition: YpR.cpp:346
YpR_Sym * clone() const override
Definition: YpR.h:189
void updateMatrices_() override
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
Definition: YpR.cpp:362
YpR model.
Definition: YpR.h:88
std::string nestedPrefix_
Definition: YpR.h:93
void checkModel(const SubstitutionModelInterface &model) const
Definition: YpR.cpp:318
virtual void updateMatrices_() override
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
Definition: YpR.cpp:46
size_t getNumberOfStates() const override
Get the number of states.
Definition: YpR.h:135
virtual ~YpR()
Definition: YpR.h:117
void fireParameterChanged(const ParameterList &parameters) override
Tells the model that a parameter value has changed.
Definition: YpR.h:139
YpR(std::shared_ptr< const RNY >, std::unique_ptr< NucleotideSubstitutionModelInterface > const, const std::string &prefix)
Build a new YpR substitution model, with no dependency parameters.
Definition: YpR.cpp:22
std::unique_ptr< NucleotideSubstitutionModelInterface > pmodel_
Definition: YpR.h:90
YpR & operator=(const YpR &ypr)
Definition: YpR.h:107
string getNestedPrefix() const
Definition: YpR.h:125
virtual void setNamespace(const std::string &) override
Definition: YpR.cpp:332
const NucleotideSubstitutionModelInterface & nestedModel() const
Definition: YpR.h:133
Defines the basic types of data flow nodes.