bpp-phyl  2.2.0
T92.h
Go to the documentation of this file.
1 //
2 // File: T92.h
3 // Created by: Julien Dutheil
4 // Created on: Mon May 26 14:41:24 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 _T92_H_
41 #define _T92_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 #include <Bpp/Seq/Container/SequenceContainer.h>
51 
52 namespace bpp
53 {
159 class T92 :
160  public virtual NucleotideSubstitutionModel,
162 {
163 private:
164  double kappa_, theta_, k_, r_, piA_, piC_, piG_, piT_;
165  mutable double exp1_, exp2_, l_;
166  mutable RowMatrix<double> p_;
167 
168 public:
169  T92(const NucleicAlphabet* alpha, double kappa = 1., double theta = 0.5);
170 
171  virtual ~T92() {}
172 
173 #ifndef NOVIRTUAL_COV_
174  T92*
175 #else
176  Clonable*
177 #endif
178  clone() const { return new T92(*this); }
179 
180 public:
181  double Pij_t (size_t i, size_t j, double d) const;
182  double dPij_dt (size_t i, size_t j, double d) const;
183  double d2Pij_dt2(size_t i, size_t j, double d) const;
184  const Matrix<double>& getPij_t(double d) const;
185  const Matrix<double>& getdPij_dt(double d) const;
186  const Matrix<double>& getd2Pij_dt2(double d) const;
187 
188  std::string getName() const { return "T92"; }
189 
190 
194  void setFreq(std::map<int, double>& freqs);
195 
196 protected:
197  void updateMatrices();
198 };
199 } // end of namespace bpp.
200 
201 #endif // _T92_H_
202 
double r_
Definition: T92.h:164
const Matrix< double > & getd2Pij_dt2(double d) const
Definition: T92.cpp:420
virtual ~T92()
Definition: T92.h:171
const Matrix< double > & getPij_t(double d) const
Definition: T92.cpp:354
The Tamura (1992) substitution model for nucleotides.
Definition: T92.h:159
double theta_
Definition: T92.h:164
double d2Pij_dt2(size_t i, size_t j, double d) const
Definition: T92.cpp:298
double k_
Definition: T92.h:164
double piG_
Definition: T92.h:164
Partial implementation of the ReversibleSubstitutionModel interface.
void updateMatrices()
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
Definition: T92.cpp:81
double exp2_
Definition: T92.h:165
std::string getName() const
Get the name of the model.
Definition: T92.h:188
double piC_
Definition: T92.h:164
double piT_
Definition: T92.h:164
double l_
Definition: T92.h:165
double Pij_t(size_t i, size_t j, double d) const
Definition: T92.cpp:190
const Matrix< double > & getdPij_dt(double d) const
Definition: T92.cpp:387
double kappa_
Definition: T92.h:164
Specialisation interface for nucleotide substitution model.
double exp1_
Definition: T92.h:165
T92 * clone() const
Definition: T92.h:178
double piA_
Definition: T92.h:164
double dPij_dt(size_t i, size_t j, double d) const
Definition: T92.cpp:244
RowMatrix< double > p_
Definition: T92.h:166
void setFreq(std::map< int, double > &freqs)
This method is over-defined to actualize the &#39;theta&#39; parameter too.
Definition: T92.cpp:457
T92(const NucleicAlphabet *alpha, double kappa=1., double theta=0.5)
Definition: T92.cpp:57