3
// Created by: Laurent Guéguen
4
// Created on: samedi 12 mars 2011, à 06h 49
8
Copyright or © or Copr. CNRS, (November 16, 2004)
10
This software is a computer program whose purpose is to provide classes
11
for phylogenetic data analysis.
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".
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
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.
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.
43
#include "NucleotideSubstitutionModel.h"
44
#include "AbstractSubstitutionModel.h"
46
#include <Bpp/Numeric/Constraints.h>
49
#include <Bpp/Seq/Alphabet/NucleicAlphabet.h>
55
* @brief Intersection of models RN95 and L95.
57
* The two hypotheses are that the transversion rates are only
58
* dependent of the target nucleotide, and strand symmetry.
60
* After normalization this model has 3 parameters:
64
* . & \gamma & \alpha & \delta \\
65
* \delta & . & \gamma & \beta \\
66
* \beta & \gamma & . & \delta \\
67
* \delta & \alpha & \gamma & .\\
70
* so in the parametrization process we set: \f[\gamma+\delta=\frac 12\f]
72
* The stationnary distribution
74
* \pi = \left(\pi_A, \pi_C, \pi_G, \pi_T\right)
76
* is such as \f[\pi_A=\pi_T\f] and \f[\pi_C=\pi_G\f]. It can be computed analytically.
78
* We use as parameters:
83
* \gamma \in ]0;1/2[\\
88
* where \f[\alpha'=\frac{2\alpha\pi_A+min(0.5-\pi_A,\gamma)}{0.5-\pi_A}\f].
90
* The generator is then computed as:
94
* \delta=\frac 12-\gamma\\
95
* \alpha=\frac{\alpha'(0.5-\pi_A)-min(0.5-\pi_A,\gamma)}{2\pi_A}\\
96
* \beta=\frac{\delta-2*\pi_A*(\alpha+\frac 12)}{2*\pi_A-1}\\
100
* and \f[P\f] is set for normalization.
102
* The parameters are named \c "piA", \c "gamma", \c "alphaP".
105
* - Rhetsky A. \& Ney M. (1995) MBE 12(1) 131-151.
106
* - Lobry J R (1995), Journal_ Of Molecular Evolution_ 40 326-330.
107
* - Schadt, Sinsheimer \& Lange (1998) Genome Research 8 222-233.
111
public virtual NucleotideSubstitutionModel,
112
public AbstractSubstitutionModel
115
double alpha_, beta_, gamma_, delta_;
118
* For calculation purposes as in Schadt & al. (with c1_=1)
120
double c3_, c4_, c8_;
121
mutable RowMatrix<double> p_;
122
mutable double exp1_,exp3_,l_;
126
const NucleicAlphabet* alphabet,
134
#ifndef NO_VIRTUAL_COV
139
clone() const { return new RN95s(*this); }
143
double Pij_t (int i, int j, double d) const;
144
double dPij_dt (int i, int j, double d) const;
145
double d2Pij_dt2(int i, int j, double d) const;
146
const Matrix<double>& getPij_t (double d) const;
147
const Matrix<double>& getdPij_dt (double d) const;
148
const Matrix<double>& getd2Pij_dt2(double d) const;
150
std::string getName() const { return "RN95s"; }
152
void updateMatrices();
155
* @brief This method takes the average value between observed \f[\pi_A\f] and \f[\pi_T\f].
158
void setFreq(std::map<int, double>&);
161
} //end of namespace bpp.