bpp-phyl  2.2.0
K80.h
Go to the documentation of this file.
1 //
2 // File: K80.h
3 // Created by: Julien Dutheil
4 // Created on: Tue May 27 15:24:30 2003
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 _K80_H_
41 #define _K80_H_
42 
43 
45 #include "../AbstractSubstitutionModel.h"
46 
47 // From bpp-seq:
48 #include <Bpp/Seq/Alphabet/NucleicAlphabet.h>
49 
50 namespace bpp
51 {
52 
150  class K80:
151  public virtual NucleotideSubstitutionModel,
153  {
154  private:
155  double kappa_, r_;
156  mutable double l_, k_, exp1_, exp2_;
157  mutable RowMatrix<double> p_;
158 
159  public:
160  K80(const NucleicAlphabet* alpha, double kappa = 1.);
161 
162  virtual ~K80() {}
163 
164 #ifndef NO_VIRTUAL_COV
165  K80*
166 #else
167  Clonable*
168 #endif
169  clone() const { return new K80(*this); }
170 
171  public:
172  double Pij_t (size_t i, size_t j, double d) const;
173  double dPij_dt (size_t i, size_t j, double d) const;
174  double d2Pij_dt2(size_t i, size_t j, double d) const;
175  const Matrix<double>& getPij_t (double d) const;
176  const Matrix<double>& getdPij_dt (double d) const;
177  const Matrix<double>& getd2Pij_dt2(double d) const;
178 
179  std::string getName() const { return "K80"; }
180 
189  void setFreqFromData(const SequenceContainer& data, double pseudoCount = 0) {}
190 
191  protected:
192  void updateMatrices();
193 
194  };
195 
196 } //end of namespace bpp.
197 
198 #endif //_K80_H_
199 
const Matrix< double > & getdPij_dt(double d) const
Definition: K80.cpp:326
double d2Pij_dt2(size_t i, size_t j, double d) const
Definition: K80.cpp:242
double dPij_dt(size_t i, size_t j, double d) const
Definition: K80.cpp:193
double kappa_
Definition: K80.h:155
double k_
Definition: K80.h:156
double exp2_
Definition: K80.h:156
double exp1_
Definition: K80.h:156
The Kimura 2-rates substitution model for nucleotides.
Definition: K80.h:150
double r_
Definition: K80.h:155
Partial implementation of the ReversibleSubstitutionModel interface.
virtual ~K80()
Definition: K80.h:162
RowMatrix< double > p_
Definition: K80.h:157
K80(const NucleicAlphabet *alpha, double kappa=1.)
Definition: K80.cpp:53
double Pij_t(size_t i, size_t j, double d) const
Definition: K80.cpp:144
Specialisation interface for nucleotide substitution model.
std::string getName() const
Get the name of the model.
Definition: K80.h:179
double l_
Definition: K80.h:156
K80 * clone() const
Definition: K80.h:169
void setFreqFromData(const SequenceContainer &data, double pseudoCount=0)
This method is disabled in this model since frequencies are not free parameters.
Definition: K80.h:189
void updateMatrices()
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
Definition: K80.cpp:64
const Matrix< double > & getPij_t(double d) const
Definition: K80.cpp:293
const Matrix< double > & getd2Pij_dt2(double d) const
Definition: K80.cpp:358