bpp-phyl  2.2.0
HKY85.h
Go to the documentation of this file.
1 //
2 // File: HKY85.h
3 // Created by: Julien Dutheil
4 // Created on: Thu Jan 22 16:17:39 2004
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 _HKY85_H_
41 #define _HKY85_H_
42 
44 #include "../AbstractSubstitutionModel.h"
45 
46 #include <Bpp/Numeric/Constraints.h>
47 
48 // From SeqLib:
49 #include <Bpp/Seq/Alphabet/NucleicAlphabet.h>
50 
51 namespace bpp
52 {
53 
179 class HKY85:
180  public virtual NucleotideSubstitutionModel,
182 {
183  private:
185  mutable double exp1_, exp21_, exp22_, l_;
186  mutable RowMatrix<double> p_;
187 
188  public:
189  HKY85(
190  const NucleicAlphabet * alpha,
191  double kappa = 1.,
192  double piA = 0.25,
193  double piC = 0.25,
194  double piG = 0.25,
195  double piT = 0.25);
196 
197  virtual ~HKY85() {}
198 
199 #ifndef NO_VIRTUAL_COV
200  HKY85*
201 #else
202  Clonable*
203 #endif
204  clone() const { return new HKY85(*this); }
205 
206  public:
207  double Pij_t (size_t i, size_t j, double d) const;
208  double dPij_dt (size_t i, size_t j, double d) const;
209  double d2Pij_dt2(size_t i, size_t j, double d) const;
210  const Matrix<double> & getPij_t (double d) const;
211  const Matrix<double> & getdPij_dt (double d) const;
212  const Matrix<double> & getd2Pij_dt2(double d) const;
213 
214  std::string getName() const { return "HKY85"; }
215 
219  void setFreq(std::map<int, double>& freqs);
220 
221  void updateMatrices();
222 };
223 
224 } //end of namespace bpp.
225 
226 #endif //_HKY85_H_
227 
double k1_
Definition: HKY85.h:184
double exp22_
Definition: HKY85.h:185
double kappa_
Definition: HKY85.h:184
void updateMatrices()
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
Definition: HKY85.cpp:80
double dPij_dt(size_t i, size_t j, double d) const
Definition: HKY85.cpp:245
double r_
Definition: HKY85.h:184
double exp1_
Definition: HKY85.h:185
void setFreq(std::map< int, double > &freqs)
This method is redefined to actualize the corresponding parameters piA, piT, piG and piC too...
Definition: HKY85.cpp:457
HKY85 * clone() const
Definition: HKY85.h:204
virtual ~HKY85()
Definition: HKY85.h:197
const Matrix< double > & getdPij_dt(double d) const
Definition: HKY85.cpp:384
double theta2_
Definition: HKY85.h:184
double theta_
Definition: HKY85.h:184
double exp21_
Definition: HKY85.h:185
double theta1_
Definition: HKY85.h:184
double d2Pij_dt2(size_t i, size_t j, double d) const
Definition: HKY85.cpp:296
HKY85(const NucleicAlphabet *alpha, double kappa=1., double piA=0.25, double piC=0.25, double piG=0.25, double piT=0.25)
Definition: HKY85.cpp:57
Partial implementation of the ReversibleSubstitutionModel interface.
double l_
Definition: HKY85.h:185
double piC_
Definition: HKY85.h:184
std::string getName() const
Get the name of the model.
Definition: HKY85.h:214
The Hasegawa M, Kishino H and Yano T (1985) substitution model for nucleotides.
Definition: HKY85.h:179
double piG_
Definition: HKY85.h:184
double piY_
Definition: HKY85.h:184
const Matrix< double > & getPij_t(double d) const
Definition: HKY85.cpp:350
Specialisation interface for nucleotide substitution model.
RowMatrix< double > p_
Definition: HKY85.h:186
double k2_
Definition: HKY85.h:184
const Matrix< double > & getd2Pij_dt2(double d) const
Definition: HKY85.cpp:418
double piT_
Definition: HKY85.h:184
double piA_
Definition: HKY85.h:184
double Pij_t(size_t i, size_t j, double d) const
Definition: HKY85.cpp:194
double piR_
Definition: HKY85.h:184