bpp-phyl3  3.0.0
AbstractCodonPhaseFrequenciesSubstitutionModel.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_ABSTRACTCODONPHASEFREQUENCIESSUBSTITUTIONMODEL_H
6 #define BPP_PHYL_MODEL_CODON_ABSTRACTCODONPHASEFREQUENCIESSUBSTITUTIONMODEL_H
7 
8 
9 #include "../FrequencySet/CodonFrequencySet.h"
10 #include "CodonSubstitutionModel.h"
11 
12 namespace bpp
13 {
36  public virtual AbstractParameterAliasable
37 {
38 private:
42  std::unique_ptr<CodonFrequencySetInterface> posFreqSet_;
43  std::string freqName_;
44 
45 public:
54  std::unique_ptr<CodonFrequencySetInterface> pfreq,
55  const std::string& prefix);
56 
59  posFreqSet_(model.posFreqSet_->clone()),
60  freqName_(model.freqName_)
61  {}
62 
64  {
66  posFreqSet_.reset(model.posFreqSet_->clone());
67  freqName_ = model.freqName_;
68 
69  return *this;
70  }
71 
73  {
75  }
76 
78 
79  void fireParameterChanged(const ParameterList& parameters) override;
80 
81  void setFreq(std::map<int, double>& frequencies) override;
82 
83  void setNamespace(const std::string& prefix) override
84  {
86  posFreqSet_->setNamespace(prefix + freqName_);
87  }
88 
89  double getCodonsMulRate(size_t, size_t) const override;
90 
92  {
93  return *posFreqSet_;
94  }
95 
97  {
98  return *posFreqSet_;
99  }
100 
101  bool hasCodonFrequencySet() const override
102  {
103  return posFreqSet_ != nullptr;
104  }
105 };
106 } // end of namespace bpp.
107 #endif // BPP_PHYL_MODEL_CODON_ABSTRACTCODONPHASEFREQUENCIESSUBSTITUTIONMODEL_H
Abstract Class for substitution models on codons parametrized by a frequency.
const CodonFrequencySetInterface & codonFrequencySet() const override
AbstractCodonPhaseFrequenciesSubstitutionModel(std::unique_ptr< CodonFrequencySetInterface > pfreq, const std::string &prefix)
Build a AbstractCodonPhaseFrequenciesSubstitutionModel instance.
AbstractCodonPhaseFrequenciesSubstitutionModel & operator=(const AbstractCodonPhaseFrequenciesSubstitutionModel &model)
double getCodonsMulRate(size_t, size_t) const override
Returns the multiplicative rate specific to two codons specified by their number. The respective gene...
AbstractCodonPhaseFrequenciesSubstitutionModel(const AbstractCodonPhaseFrequenciesSubstitutionModel &model)
std::unique_ptr< CodonFrequencySetInterface > posFreqSet_
Position dependent version of Codon Frequencies Set.
AbstractCodonPhaseFrequenciesSubstitutionModel * clone() const override
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.