bpp-phyl3  3.0.0
AbstractCodonFrequenciesSubstitutionModel.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_ABSTRACTCODONFREQUENCIESSUBSTITUTIONMODEL_H
6 #define BPP_PHYL_MODEL_CODON_ABSTRACTCODONFREQUENCIESSUBSTITUTIONMODEL_H
7 
8 
9 #include "../FrequencySet/CodonFrequencySet.h"
10 #include "CodonSubstitutionModel.h"
11 
12 namespace bpp
13 {
31  public virtual AbstractParameterAliasable
32 {
33 private:
34  std::unique_ptr<CodonFrequencySetInterface> pfreqset_;
35  std::string freqName_;
36 
37 public:
46  std::unique_ptr<CodonFrequencySetInterface> pfreq,
47  const std::string& prefix);
48 
51  pfreqset_(model.pfreqset_->clone()),
52  freqName_(model.freqName_)
53  {}
54 
56  {
58  pfreqset_ = std::unique_ptr<CodonFrequencySetInterface>(model.pfreqset_->clone());
59  freqName_ = model.freqName_;
60  return *this;
61  }
62 
64  {
66  }
67 
69 
70  void fireParameterChanged(const ParameterList& parameters) override;
71 
72  void setFreq(std::map<int, double>& frequencies) override;
73 
74  void setNamespace(const std::string& prefix) override
75  {
77  pfreqset_->setNamespace(prefix + freqName_);
78  }
79 
80  double getCodonsMulRate(size_t, size_t) const override;
81 
83  {
84  return *pfreqset_;
85  }
86 
88  {
89  return *pfreqset_;
90  }
91 
92  bool hasCodonFrequencySet() const override
93  {
94  return pfreqset_ != nullptr;
95  }
96 };
97 } // end of namespace bpp.
98 #endif // BPP_PHYL_MODEL_CODON_ABSTRACTCODONFREQUENCIESSUBSTITUTIONMODEL_H
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
AbstractCodonFrequenciesSubstitutionModel & operator=(const AbstractCodonFrequenciesSubstitutionModel &model)
double getCodonsMulRate(size_t, size_t) const override
Returns the multiplicative rate specific to two codons specified by their number. The respective gene...
AbstractCodonFrequenciesSubstitutionModel(std::unique_ptr< CodonFrequencySetInterface > pfreq, const std::string &prefix)
Build a AbstractCodonFrequenciesSubstitutionModel instance.
AbstractCodonFrequenciesSubstitutionModel * clone() const override
AbstractCodonFrequenciesSubstitutionModel(const AbstractCodonFrequenciesSubstitutionModel &model)
AbstractParameterAliasable & operator=(const AbstractParameterAliasable &ap)
void setNamespace(const std::string &prefix)
Parametrize a set of state frequencies for codons.
Parametrize a set of state frequencies.
Definition: FrequencySet.h:29
Defines the basic types of data flow nodes.