bpp-phyl3 3.0.0
AbstractCodonAAFitnessSubstitutionModel.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_ABSTRACTCODONAAFITNESSSUBSTITUTIONMODEL_H
6#define BPP_PHYL_MODEL_CODON_ABSTRACTCODONAAFITNESSSUBSTITUTIONMODEL_H
7
8
9# ifndef _ABSTRACTCODON_AA_FITNESSSUBSTITUTIONMODEL_H_
10# define _ABSTRACTCODON_AA_FITNESSSUBSTITUTIONMODEL_H_
11
13
14#include "../FrequencySet/ProteinFrequencySet.h"
15
16namespace bpp
17{
40 public virtual AbstractParameterAliasable
41{
42private:
43 std::shared_ptr<FrequencySetInterface> pfitset_;
44
45 std::shared_ptr<const GeneticCode> pgencode_;
46
47 std::string fitName_;
48
49 std::shared_ptr<const StateMapInterface> stateMap_;
50
51 std::shared_ptr<const StateMapInterface> protStateMap_;
52
58 double Ns_;
59
60public:
62 std::shared_ptr<FrequencySetInterface> pfitset,
63 std::shared_ptr<const GeneticCode> pgencode,
64 const std::string& prefix);
65
68 pfitset_(model.pfitset_->clone()),
69 pgencode_(model.pgencode_),
70 fitName_(model.fitName_),
71 stateMap_(model.stateMap_),
72 protStateMap_(pfitset_->getStateMap()),
73 Ns_(1)
74 {}
75
77 {
79 pfitset_.reset(model.pfitset_->clone());
80 pgencode_ = model.pgencode_;
81 fitName_ = model.fitName_;
82 stateMap_ = model.stateMap_;
83 protStateMap_ = pfitset_->getStateMap();
84 Ns_ = 1;
85
86 return *this;
87 }
88
90 {
92 }
93
95
96public:
97 void fireParameterChanged(const ParameterList& parameters) override;
98
99 void setFreq(std::map<int, double>& frequencies) override;
100
102 {
103 throw NullPointerException("AbstractCodonAAFitnessSubstitutionModel::codonFrequencySet. This model does not take codon frequencies. See aaFitness.");
104 }
105
106 bool hasCodonFrequencySet() const override
107 {
108 return false;
109 }
110
111 void setNamespace(const std::string& prefix) override
112 {
114 pfitset_->setNamespace(prefix + fitName_);
115 }
116
117 double getCodonsMulRate(size_t i, size_t j) const override;
118
119 const FrequencySetInterface& aaFitness() const { return *pfitset_; }
120
121 std::shared_ptr<const FrequencySetInterface> getAAFitness() const { return pfitset_; }
122
124 {
125 addParameter_(new Parameter(getNamespace() + "Ns", 1, std::make_shared<IntervalConstraint>(NumConstants::MILLI(), 100, true, true)));
126 }
127};
128} // end of namespace bpp
129
130# endif // _ABSTRACTCODON_AA_FITNESSSUBSTITUTIONMODEL_H_
131#endif // BPP_PHYL_MODEL_CODON_ABSTRACTCODONAAFITNESSSUBSTITUTIONMODEL_H
Abstract class for modelling of ratios of substitution rates between codons, whatever they are synony...
std::shared_ptr< const FrequencySetInterface > getAAFitness() const
const CodonFrequencySetInterface & codonFrequencySet() const override
AbstractCodonAAFitnessSubstitutionModel & operator=(const AbstractCodonAAFitnessSubstitutionModel &model)
void setFreq(std::map< int, double > &frequencies) override
AbstractCodonAAFitnessSubstitutionModel(std::shared_ptr< FrequencySetInterface > pfitset, std::shared_ptr< const GeneticCode > pgencode, const std::string &prefix)
void fireParameterChanged(const ParameterList &parameters) 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...
AbstractCodonAAFitnessSubstitutionModel * clone() const override
AbstractCodonAAFitnessSubstitutionModel(const AbstractCodonAAFitnessSubstitutionModel &model)
double Ns_
The Ns of the model (default: 1), The generator (and all its vectorial components) is independent of ...
void addParameter_(Parameter *parameter)
AbstractParameterAliasable & operator=(const AbstractParameterAliasable &ap)
void setNamespace(const std::string &prefix)
std::string getNamespace() const override
Parametrize a set of state frequencies for codons.
Parametrize a set of state frequencies.
Definition: FrequencySet.h:29
static double MILLI()
Defines the basic types of data flow nodes.