bpp-phyl3  3.0.0
CodonDistanceFrequenciesSubstitutionModel.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 
9 using namespace std;
10 
11 /******************************************************************************/
12 
14  std::shared_ptr<const GeneticCode> gCode,
15  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod,
16  std::unique_ptr<CodonFrequencySetInterface> pfreq,
17  std::shared_ptr<const AlphabetIndex2> pdist,
18  bool paramSynRate) :
19  AbstractParameterAliasable("CodonDistFreq."),
20  AbstractCodonSubstitutionModel(gCode, std::move(pmod), "CodonDistFreq."),
21  AbstractCodonDistanceSubstitutionModel(pdist, gCode, "CodonDistFreq.", paramSynRate),
22  AbstractCodonFrequenciesSubstitutionModel(std::move(pfreq), "CodonDistFreq.")
23 {
24  computeFrequencies(true); // for initialization
26  computeFrequencies(false);
27 }
28 
30  std::shared_ptr<const GeneticCode> gCode,
31  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod1,
32  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod2,
33  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod3,
34  std::unique_ptr<CodonFrequencySetInterface> pfreq,
35  std::shared_ptr<const AlphabetIndex2> pdist,
36  bool paramSynRate) :
37  AbstractParameterAliasable("CodonDistFreq."),
38  AbstractCodonSubstitutionModel(gCode, std::move(pmod1), std::move(pmod2), std::move(pmod3), "CodonDistFreq."),
39  AbstractCodonDistanceSubstitutionModel(pdist, gCode, "CodonDistFreq.", paramSynRate),
40  AbstractCodonFrequenciesSubstitutionModel(std::move(pfreq), "CodonDistFreq.")
41 {
42  computeFrequencies(true); // for initialization
44  computeFrequencies(false);
45 }
46 
48 {
49  return "CodonDistFreq";
50 }
51 
53 {
57 
58  // Beware: must be call at the end
60 }
61 
63 {
66 }
67 
69 {
74 }
75 
76 void CodonDistanceFrequenciesSubstitutionModel::setFreq(map<int, double>& frequencies)
77 {
80 }
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 parametrized by frequencies.
const CodonFrequencySetInterface & codonFrequencySet() const override
void setFreq(std::map< int, double > &frequencies) override
void fireParameterChanged(const ParameterList &parameters) override
double getCodonsMulRate(size_t, size_t) const override
Returns the multiplicative rate specific to two codons specified by their number. The respective gene...
Abstract class for substitution models on codons.
void updateMatrices_() override
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
void setNamespace(const std::string &prefix) override
void setNamespace(const std::string &prefix)
virtual void fireParameterChanged(const ParameterList &parameters) override
Tells the model that a parameter value has changed.
void fireParameterChanged(const ParameterList &parameterlist) override
void setFreq(std::map< int, double > &frequencies) override
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.
CodonDistanceFrequenciesSubstitutionModel(std::shared_ptr< const GeneticCode > gCode, std::unique_ptr< NucleotideSubstitutionModelInterface > pmod, std::unique_ptr< CodonFrequencySetInterface > pfreq, std::shared_ptr< const AlphabetIndex2 > pdist=nullptr, bool paramSynRate=false)
Build a new CodonDistanceFrequenciesSubstitutionModel object from three pointers to AbstractSubstitut...
virtual const Vdouble & getFrequencies() const =0
Defines the basic types of data flow nodes.