bpp-phyl  2.2.0
TN93.h
Go to the documentation of this file.
1 //
2 // File: TN93.h
3 // Created by: Julien Dutheil
4 // Created on: Thu Jan 22 10:26:51 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 _TN93_H_
41 #define _TN93_H_
42 
44 #include "../AbstractSubstitutionModel.h"
45 
46 #include <Bpp/Numeric/Constraints.h>
47 
48 // From bpp-seq:
49 #include <Bpp/Seq/Alphabet/NucleicAlphabet.h>
50 #include <Bpp/Seq/Container/SequenceContainer.h>
51 
52 namespace bpp
53 {
54 
130 class TN93 :
131  public virtual NucleotideSubstitutionModel,
133 {
134  private:
136  mutable double exp1_, exp21_, exp22_, l_;
137  mutable RowMatrix<double> p_;
138 
139  public:
140  TN93(
141  const NucleicAlphabet * alpha,
142  double kappa1 = 1.,
143  double kappa2 = 1.,
144  double piA = 0.25,
145  double piC = 0.25,
146  double piG = 0.25,
147  double piT = 0.25);
148 
149  virtual ~TN93() {}
150 
151 #ifndef NO_VIRTUAL_COV
152  TN93*
153 #else
154  Clonable*
155 #endif
156  clone() const { return new TN93(*this); }
157 
158  public:
159 
160  double Pij_t (size_t i, size_t j, double d) const;
161  double dPij_dt (size_t i, size_t j, double d) const;
162  double d2Pij_dt2(size_t i, size_t j, double d) const;
163  const Matrix<double>& getPij_t (double d) const;
164  const Matrix<double>& getdPij_dt (double d) const;
165  const Matrix<double>& getd2Pij_dt2(double d) const;
166 
167  std::string getName() const { return "TN93"; }
168 
172  void setFreq(std::map<int, double>& freqs);
173 
174  void updateMatrices();
175 
176 };
177 
178 } //end of namespace bpp.
179 
180 #endif //_TN93_H_
181 
double k2_
Definition: TN93.h:135
double piC_
Definition: TN93.h:135
double exp22_
Definition: TN93.h:136
double piA_
Definition: TN93.h:135
double exp1_
Definition: TN93.h:136
double theta2_
Definition: TN93.h:135
double theta_
Definition: TN93.h:135
double piT_
Definition: TN93.h:135
double piY_
Definition: TN93.h:135
double piG_
Definition: TN93.h:135
double kappa2_
Definition: TN93.h:135
virtual ~TN93()
Definition: TN93.h:149
double kappa1_
Definition: TN93.h:135
Partial implementation of the ReversibleSubstitutionModel interface.
void setFreq(std::map< int, double > &freqs)
This method is over-defined to actualize the corresponding parameters piA, piT, piG and piC too...
Definition: TN93.cpp:429
std::string getName() const
Get the name of the model.
Definition: TN93.h:167
double l_
Definition: TN93.h:136
double d2Pij_dt2(size_t i, size_t j, double d) const
Definition: TN93.cpp:268
The Tamura and Nei (1993) substitution model for nucleotides.
Definition: TN93.h:130
double Pij_t(size_t i, size_t j, double d) const
Definition: TN93.cpp:166
TN93(const NucleicAlphabet *alpha, double kappa1=1., double kappa2=1., double piA=0.25, double piC=0.25, double piG=0.25, double piT=0.25)
Definition: TN93.cpp:58
double exp21_
Definition: TN93.h:136
Specialisation interface for nucleotide substitution model.
const Matrix< double > & getd2Pij_dt2(double d) const
Definition: TN93.cpp:390
double r_
Definition: TN93.h:135
TN93 * clone() const
Definition: TN93.h:156
double piR_
Definition: TN93.h:135
const Matrix< double > & getPij_t(double d) const
Definition: TN93.cpp:322
const Matrix< double > & getdPij_dt(double d) const
Definition: TN93.cpp:356
RowMatrix< double > p_
Definition: TN93.h:137
double theta1_
Definition: TN93.h:135
double dPij_dt(size_t i, size_t j, double d) const
Definition: TN93.cpp:217
double k1_
Definition: TN93.h:135
void updateMatrices()
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
Definition: TN93.cpp:85