bpp-phyl3 3.0.0
AbstractCodonFitnessSubstitutionModel.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_ABSTRACTCODONFITNESSSUBSTITUTIONMODEL_H
6#define BPP_PHYL_MODEL_CODON_ABSTRACTCODONFITNESSSUBSTITUTIONMODEL_H
7
8
9# ifndef _ABSTRACTCODONFITNESSSUBSTITUTIONMODEL_H_
10# define _ABSTRACTCODONFITNESSSUBSTITUTIONMODEL_H_
11
13#include "../FrequencySet/CodonFrequencySet.h"
14namespace bpp
15{
35 public virtual AbstractParameterAliasable
36{
37private:
38 std::unique_ptr<FrequencySetInterface> pfitset_;
39
40 std::shared_ptr<const GeneticCode> pgencode_;
41
42 std::string fitName_;
43
44public:
46 std::unique_ptr<FrequencySetInterface> pfitset,
47 std::shared_ptr<const GeneticCode> pgencode,
48 const std::string& prefix);
49
52 pfitset_(model.pfitset_->clone()),
53 pgencode_(model.pgencode_),
54 fitName_(model.fitName_)
55 {}
56
58 {
60 pfitset_.reset(model.pfitset_->clone());
61 pgencode_ = model.pgencode_;
62 fitName_ = model.fitName_;
63 return *this;
64 }
65
67 {
69 }
70
72
73public:
74 void fireParameterChanged (const ParameterList& parameters) override;
75
76 void setFreq(std::map<int, double>& frequencies) override;
77
78 // const FrequencySet& getFreq() const { return *pfitset_; }
79
80 void setNamespace (const std::string& prefix) override
81 {
83 pfitset_->setNamespace(prefix + fitName_);
84 }
85
86 double getCodonsMulRate(size_t i, size_t j) const override;
87
88 const FrequencySetInterface& fitness() const { return *pfitset_; }
89
91 {
92 throw NullPointerException("AbstractCodonFitnessSubstitutionModel::frequencySet. No associated FrequencySet.");
93 }
94
95 bool hasCodonFrequencySet() const override
96 {
97 return false;
98 }
99};
100} // end of namespace bpp
101# endif
102#endif // BPP_PHYL_MODEL_CODON_ABSTRACTCODONFITNESSSUBSTITUTIONMODEL_H
Abstract class for modelling of ratios of substitution rates between codons, whatever they are synony...
AbstractCodonFitnessSubstitutionModel(const AbstractCodonFitnessSubstitutionModel &model)
void setFreq(std::map< int, double > &frequencies) override
AbstractCodonFitnessSubstitutionModel & operator=(const AbstractCodonFitnessSubstitutionModel &model)
void fireParameterChanged(const ParameterList &parameters) override
const CodonFrequencySetInterface & codonFrequencySet() const 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...
AbstractCodonFitnessSubstitutionModel * clone() const override
AbstractCodonFitnessSubstitutionModel(std::unique_ptr< FrequencySetInterface > pfitset, std::shared_ptr< const GeneticCode > pgencode, const std::string &prefix)
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.