bpp-phyl3  3.0.0
KroneckerCodonDistanceSubstitutionModel.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
6 
7 using namespace bpp;
8 using namespace std;
9 
10 /******************************************************************************/
11 
13  std::shared_ptr<const GeneticCode> gCode,
14  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod,
15  std::shared_ptr<const AlphabetIndex2> pdist) :
16  AbstractParameterAliasable("KronCodonDist."),
18  gCode->getSourceAlphabet(),
19  shared_ptr<const StateMapInterface>(new CanonicalStateMap(gCode->getSourceAlphabet(), false)),
20  "KronCodonDist."),
21  AbstractKroneckerCodonSubstitutionModel(gCode, std::move(pmod), "KronCodonDist."),
22  AbstractCodonDistanceSubstitutionModel(pdist, gCode, "KronCodonDist.")
23 {
24  computeFrequencies(true);
26 }
27 
29  std::shared_ptr<const GeneticCode> gCode,
30  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod1,
31  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod2,
32  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod3,
33  std::shared_ptr<const AlphabetIndex2> pdist) :
34  AbstractParameterAliasable("KronCodonDist."),
36  gCode->getSourceAlphabet(),
37  shared_ptr<const StateMapInterface>(new CanonicalStateMap(gCode->getSourceAlphabet(), false)),
38  "KronCodonDist."),
39  AbstractKroneckerCodonSubstitutionModel(gCode, std::move(pmod1), std::move(pmod2), std::move(pmod3), "KronCodonDist."),
40  AbstractCodonDistanceSubstitutionModel(pdist, gCode, "KronCodonDist.")
41 {
42  computeFrequencies(true);
44 }
45 
47  std::shared_ptr<const GeneticCode> gCode,
48  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod,
49  const vector<std::set< size_t>>& vPos,
50  std::shared_ptr<const AlphabetIndex2> pdist) :
51  AbstractParameterAliasable("KronCodonDist."),
53  gCode->getSourceAlphabet(),
54  shared_ptr<const StateMapInterface>(new CanonicalStateMap(gCode->getSourceAlphabet(), false)),
55  "KronCodonDist."),
56  AbstractKroneckerCodonSubstitutionModel(gCode, std::move(pmod), vPos, "KronCodonDist."),
57  AbstractCodonDistanceSubstitutionModel(pdist, gCode, "KronCodonDist.")
58 {
59  computeFrequencies(true);
61 }
62 
64  std::shared_ptr<const GeneticCode> gCode,
65  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod1,
66  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod2,
67  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod3,
68  const vector<std::set<size_t>>& vPos,
69  std::shared_ptr<const AlphabetIndex2> pdist) :
70  AbstractParameterAliasable("KronCodonDist."),
72  gCode->getSourceAlphabet(),
73  shared_ptr<const StateMapInterface>(new CanonicalStateMap(gCode->getSourceAlphabet(), false)),
74  "KronCodonDist."),
75  AbstractKroneckerCodonSubstitutionModel(gCode, std::move(pmod1), std::move(pmod2), std::move(pmod3), vPos, "KronCodonDist."),
76  AbstractCodonDistanceSubstitutionModel(pdist, gCode, "KronCodonDist.")
77 {
78  computeFrequencies(true);
80 }
81 
83 {
84  return "KronCodonDist";
85 }
86 
88 {
90 
91  // Beware: must be call at the end
93 }
94 
96 {
99 }
100 
102 {
106 }
Abstract class for modelling of non-synonymous and synonymous substitution rates in codon models.
double getCodonsMulRate(size_t i, size_t j) const override
Returns the multiplicative rate specific to two codons specified by their number. The respective gene...
void fireParameterChanged(const ParameterList &parameters) override
Abstract class for substitution models on codons allowing multiple substitutions.
virtual double getCodonsMulRate(size_t i, size_t j) const override
Method inherited from CodonSubstitutionModel.
void setNamespace(const std::string &prefix)
virtual void fireParameterChanged(const ParameterList &parameters) override
Tells the model that a parameter value has changed.
void updateMatrices_()
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
This class implements a state map where all resolved states are modeled.
Definition: StateMap.h:168
double getCodonsMulRate(size_t i, size_t j) const override
Returns the multiplicative rate specific to two codons specified by their number. The respective gene...
std::string getName() const override
Get the name of the model.
void fireParameterChanged(const ParameterList &parameterlist) override
KroneckerCodonDistanceSubstitutionModel(std::shared_ptr< const GeneticCode > gCode, std::unique_ptr< NucleotideSubstitutionModelInterface > pmod, std::shared_ptr< const AlphabetIndex2 > pdist=nullptr)
Build a new KroneckerCodonDistanceSubstitutionModel object from three pointers to AbstractSubstitutio...
Map the states of a given alphabet which have a model state.
Definition: StateMap.h:25
Defines the basic types of data flow nodes.