bpp-phyl3 3.0.0
KCM.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: The Bio++ Development Group
2//
3// SPDX-License-Identifier: CECILL-2.1
4
5#ifndef BPP_PHYL_MODEL_CODON_KCM_H
6#define BPP_PHYL_MODEL_CODON_KCM_H
7
8
9#include "../AbstractBiblioSubstitutionModel.h"
11
12namespace bpp
13{
41class KCM :
44{
45private:
46 std::unique_ptr<KroneckerCodonDistanceSubstitutionModel> pmodel_;
48
49public:
56 KCM(std::shared_ptr<const GeneticCode> gc, bool oneModel);
57
58 KCM(const KCM& kcm);
59
60 KCM& operator=(const KCM&);
61
62 virtual ~KCM() {}
63
64 KCM* clone() const override { return new KCM(*this); }
65
66public:
67 std::string getName() const override { return "KCM" + std::string(oneModel_ ? "7" : "19") + ".";}
68
69 const SubstitutionModelInterface& substitutionModel() const override { return *pmodel_; }
70
71 std::shared_ptr<const GeneticCode> getGeneticCode() const override { return pmodel_->getGeneticCode(); }
72
73 double getCodonsMulRate(size_t i, size_t j) const override { return pmodel_->getCodonsMulRate(i, j); }
74
75protected:
77
79 {
80 throw NullPointerException("KCM::codonFrequencySet. No FrequencySet available for this model.");
81 }
82
83 bool hasCodonFrequencySet() const override
84 {
85 return false;
86 }
87
88 void setFreq(std::map<int, double>& frequencies) override
89 {
91 }
92};
93} // end of namespace bpp.
94#endif // BPP_PHYL_MODEL_CODON_KCM_H
void setFreq(std::map< int, double > &frequ) override
Set equilibrium frequencies.
Parametrize a set of state frequencies for codons.
Interface for reversible codon models.
The general multiple substitution model for codons, from Zaheri & al, 2014.
Definition: KCM.h:44
KCM * clone() const override
Definition: KCM.h:64
std::unique_ptr< KroneckerCodonDistanceSubstitutionModel > pmodel_
Definition: KCM.h:46
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...
Definition: KCM.h:73
void setFreq(std::map< int, double > &frequencies) override
Set equilibrium frequencies.
Definition: KCM.h:88
KCM & operator=(const KCM &)
Definition: KCM.cpp:80
SubstitutionModelInterface & substitutionModel_() override
Definition: KCM.h:76
std::string getName() const override
Get the name of the model.
Definition: KCM.h:67
KCM(std::shared_ptr< const GeneticCode > gc, bool oneModel)
constructor.
Definition: KCM.cpp:17
const CodonFrequencySetInterface & codonFrequencySet() const override
Definition: KCM.h:78
virtual ~KCM()
Definition: KCM.h:62
const SubstitutionModelInterface & substitutionModel() const override
Definition: KCM.h:69
bool oneModel_
Definition: KCM.h:47
bool hasCodonFrequencySet() const override
Definition: KCM.h:83
std::shared_ptr< const GeneticCode > getGeneticCode() const override
Definition: KCM.h:71
Interface for all substitution models.
Defines the basic types of data flow nodes.