2
// File: CodonNeutralReversibleSubstitutionModel.h
3
// Created by: Laurent Gueguen
4
// Created on: Tue Dec 24 11:03:53 2003
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.
40
#ifndef _CODONNEUTRALREVERSIBLESUBSTITUTIONMODEL_H_
41
#define _CODONNEUTRALREVERSIBLESUBSTITUTIONMODEL_H_
43
#include "AbstractCodonReversibleSubstitutionModel.h"
44
#include "NucleotideSubstitutionModel.h"
47
#include <Bpp/Seq/Alphabet/CodonAlphabet.h>
52
* @brief Class for reversible substitution models on non stop codons.
54
* Objects of this class are built from three reversible substitution
55
* models of NucleicAlphabets. No model is directly accessible. </p>
57
* Only substitutions with one letter changed are accepted. </p>
59
* There is one substitution per word per unit of time
60
* on the equilibrium frequency, and each position has its specific rate.
62
* The generator is constructed in two steps:
63
* First, if @f$\rho_i@f$ is the rate of model i (@f$\sum_{i=1}^{3} \rho_i = 1@f$):
65
* Q_{abc \rightarrow abd} = \rho_3 Q^{(2)}_{c \rightarrow d}
66
* Q_{abc \rightarrow aed} = 0
67
* Q_{abc \rightarrow abc} = \rho_1 Q^{(0)}_{a \rightarrow a} + \rho_2 Q^{(1)}_{b \rightarrow b} + \rho_3 Q^{(2)}_{c \rightarrow c})
70
* Second, the substitution between STOP codons and non-STOP codons are
71
* nullified, and the lines of Q are normalized in accordance.
73
* The parameters of this word model are the same as the ones of the
74
* models used. Their names have a new suffix, "_phi" where i stands
75
* for the position (i.e. the phase) in the word.
77
* The rates are defined by relative rates parameters @f$r_i@f$
78
* (called "relrate_i") with:
80
* 1 <= i < n, \rho_i = (1-r_1).(1-r_2)...(1-r_{i-1}).r_{i}
81
* \rho_n = (1-r_1).(1-r_2)...(1-r_{n-1})
85
* \forall 1 <= i < n, r_i = \frac{\rho_i}{1-(\rho_0+...\rho_{i-1})}
88
* The parameters of this codon model are the same as the ones of the
89
* models used. Their names have a new suffix, "_phi" where i stands
90
* for the position (i.e. the phase) in the word.
93
class CodonNeutralReversibleSubstitutionModel :
94
public AbstractCodonReversibleSubstitutionModel
98
*@brief Build a new CodonNeutralReversibleSubstitutionModel object from
99
*a pointer to NucleotideSubstitutionModels.
100
* @author Laurent Guéguen
102
*@param palph pointer to a CodonAlphabet
103
*@param pmod1 pointer to the NucleotideSubstitutionModel to use in the
104
* three positions. It is owned by the instabce.
107
CodonNeutralReversibleSubstitutionModel(const CodonAlphabet* palph,
108
NucleotideSubstitutionModel* pmod1);
111
*@brief Build a new CodonNeutralReversibleSubstitutionModel object
112
*from three pointers to NucleotideSubstitutionModels.
114
*@param palph pointer to a CodonAlphabet
115
*@param pmod1, pmod2, pmod3 pointers to the
116
* NucleotideSubstitutionModel to use in the three positions.
117
* All the models must be different objects to avoid parameters
118
* redondancy, otherwise only the first model is used. The used models
119
* are owned by the instance.
122
CodonNeutralReversibleSubstitutionModel(const CodonAlphabet* palph,
123
NucleotideSubstitutionModel* pmod1,
124
NucleotideSubstitutionModel* pmod2,
125
NucleotideSubstitutionModel* pmod3);
127
~CodonNeutralReversibleSubstitutionModel(){}
129
#ifndef NO_VIRTUAL_COV
130
CodonNeutralReversibleSubstitutionModel*
134
clone() const { return new CodonNeutralReversibleSubstitutionModel(*this); }
137
void completeMatrices();
138
void updateMatrices();
139
std::string getName() const;
141
} // end of namespace bpp.