bpp-phyl  2.2.0
YpR.h
Go to the documentation of this file.
1 //
2 // File: YpR.h
3 // Created by: Laurent Gueguen
4 // Created on: Wed Aug 3 2007
5 //
6 
7 /*
8  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
9 
10  This software is a computer program whose purpose is to provide classes
11  for phylogenetic data analysis.
12 
13  This software is governed by the CeCILL license under French law and
14  abiding by the rules of distribution of free software. You can use,
15  modify and/ or redistribute the software under the terms of the CeCILL
16  license as circulated by CEA, CNRS and INRIA at the following URL
17  "http://www.cecill.info".
18 
19  As a counterpart to the access to the source code and rights to copy,
20  modify and redistribute granted by the license, users are provided only
21  with a limited warranty and the software's author, the holder of the
22  economic rights, and the successive licensors have only limited
23  liability.
24 
25  In this respect, the user's attention is drawn to the risks associated
26  with loading, using, modifying and/or developing or reproducing the
27  software by the user in light of its specific status of free software,
28  that may mean that it is complicated to manipulate, and that also
29  therefore means that it is reserved for developers and experienced
30  professionals having in-depth computer knowledge. Users are therefore
31  encouraged to load and test the software's suitability as regards their
32  requirements in conditions enabling the security of their systems and/or
33  data to be ensured and, more generally, to use and operate it in the
34  same conditions as regards security.
35 
36  The fact that you are presently reading this means that you have had
37  knowledge of the CeCILL license and that you accept its terms.
38  */
39 
40 #ifndef _YpR_H_
41 #define _YpR_H_
42 
43 #include "../AbstractSubstitutionModel.h"
44 
45 #include <Bpp/Seq/Alphabet/RNY.h>
46 
47 
48 // From Utils:
49 #include <Bpp/Exceptions.h>
50 
51 using namespace std;
52 
53 namespace bpp
54 {
123 class YpR :
125 {
126 protected:
128 
129  // Check that the model is good for YpR
130  void check_model(SubstitutionModel* const) const
131  throw (Exception);
132 
133  std::string _nestedPrefix;
134 
135 protected:
141  YpR(const RNY*, SubstitutionModel* const, const std::string& prefix);
142 
143  YpR(const YpR&, const std::string& prefix);
144 
145  YpR(const YpR& ypr);
146 
147  YpR& operator=(const YpR& ypr)
148  {
149  AbstractParameterAliasable::operator=(ypr);
150  AbstractSubstitutionModel::operator=(ypr);
151  _nestedPrefix = ypr._nestedPrefix;
152  pmodel_ = ypr.pmodel_->clone();
153  return *this;
154  }
155 
156 public:
157  virtual ~YpR()
158  {
159  if (pmodel_)
160  delete pmodel_;
161  pmodel_ = 0;
162  }
163 
164 protected:
165  void updateMatrices(double, double, double, double,
166  double, double, double, double);
167 
168  string getNestedPrefix() const
169  {
170  return _nestedPrefix;
171  }
172 
173 public:
174  // virtual std::string getName() const;
175 
176  const SubstitutionModel* getNestedModel() const {return pmodel_;}
177 
178  size_t getNumberOfStates() const { return 36; }
179 
180  virtual void updateMatrices();
181 
182  virtual void setNamespace(const std::string&);
183 
184  void fireParameterChanged(const ParameterList& parameters)
185  {
186  AbstractSubstitutionModel::fireParameterChanged(parameters);
187  pmodel_->matchParametersValues(parameters);
188  updateMatrices();
189  }
190 };
191 }
192 
193 
194 // //////////////////////////////////////
195 // //////// YpR_symetrical
196 
197 namespace bpp
198 {
211 class YpR_Sym :
212  public YpR
213 {
214 public:
222  YpR_Sym(const RNY* alph,
223  SubstitutionModel* pm,
224  double CgT = 0., double TgC = 0.,
225  double CaT = 0., double TaC = 0.);
226 
227  YpR_Sym(const YpR_Sym&);
228 
229  virtual ~YpR_Sym() {}
230 
231  YpR_Sym* clone() const { return new YpR_Sym(*this); }
232 
233  std::string getName() const;
234 
235  void updateMatrices();
236 };
237 }
238 
239 // //////////////////////////////////////
240 // //////// YpR_general
241 
242 namespace bpp
243 {
256 class YpR_Gen :
257  public YpR
258 {
259 public:
268  YpR_Gen(const RNY* alph,
269  SubstitutionModel* pm,
270  double CgT = 0., double cGA = 0.,
271  double TgC = 0., double tGA = 0.,
272  double CaT = 0., double cAG = 0.,
273  double TaC = 0., double tAG = 0.);
274 
275  YpR_Gen(const YpR_Gen&);
276 
277  virtual ~YpR_Gen() {}
278 
279  YpR_Gen* clone() const { return new YpR_Gen(*this); }
280 
281  std::string getName() const;
282 
283  void updateMatrices();
284 };
285 }
286 
287 
288 #endif // _YpR_H_
289 
290 
Interface for all substitution models.
std::string _nestedPrefix
Definition: YpR.h:133
size_t getNumberOfStates() const
Get the number of states.
Definition: YpR.h:178
YpR model.
Definition: YpR.h:123
STL namespace.
virtual ~YpR_Sym()
Definition: YpR.h:229
virtual ~YpR_Gen()
Definition: YpR.h:277
Partial implementation of the SubstitutionModel interface.
symetrical YpR model.
Definition: YpR.h:211
void fireParameterChanged(const ParameterList &parameters)
Tells the model that a parameter value has changed.
Definition: YpR.h:184
YpR_Gen * clone() const
Definition: YpR.h:279
virtual ~YpR()
Definition: YpR.h:157
SubstitutionModel * pmodel_
Definition: YpR.h:127
YpR & operator=(const YpR &ypr)
Definition: YpR.h:147
YpR_Sym * clone() const
Definition: YpR.h:231
General YpR model.
Definition: YpR.h:256
const SubstitutionModel * getNestedModel() const
Definition: YpR.h:176
SubstitutionModel * clone() const =0
string getNestedPrefix() const
Definition: YpR.h:168