bpp-phyl3 3.0.0
AbstractCodonAARateSubstitutionModel.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_ABSTRACTCODONAARATESUBSTITUTIONMODEL_H
6#define BPP_PHYL_MODEL_CODON_ABSTRACTCODONAARATESUBSTITUTIONMODEL_H
7
8
9#include "../Protein/ProteinSubstitutionModel.h"
11
12// From bpp-seq:
15
16namespace bpp
17{
38 public virtual AbstractParameterAliasable
39{
40private:
41 std::shared_ptr<ProteinSubstitutionModelInterface> pAAmodel_;
42
43 std::shared_ptr<const GeneticCode> pgencode_;
44
45 double beta_;
46
47 double gamma_;
48
49 std::shared_ptr<const StateMapInterface> stateMap_;
50
51public:
63 std::shared_ptr<ProteinSubstitutionModelInterface> pmodel,
64 std::shared_ptr<const GeneticCode> pgencode,
65 const std::string& prefix,
66 bool paramSynRate = false);
67
68
71 pAAmodel_(model.pAAmodel_),
72 pgencode_(model.pgencode_),
73 beta_(model.beta_),
74 gamma_(model.gamma_),
75 stateMap_(model.stateMap_)
76 {}
77
80 {
82 pAAmodel_ = model.pAAmodel_;
83 pgencode_ = model.pgencode_;
84 beta_ = model.beta_;
85 gamma_ = model.gamma_;
86 stateMap_ = model.stateMap_;
87
88 return *this;
89 }
90
92 {
94 }
95
97
98public:
99 void fireParameterChanged(const ParameterList& parameters) override;
100
101 double getCodonsMulRate(size_t i, size_t j) const override;
102
103 void setNamespace(const std::string& prefix) override
104 {
106 pAAmodel_->setNamespace(prefix + pAAmodel_->getNamespace());
107 }
108
109 /*
110 * @brief links to a new AA model
111 *
112 */
113 void setAAModel(std::shared_ptr<ProteinSubstitutionModelInterface> model)
114 {
115 pAAmodel_ = model;
116 }
117
119 {
120 return *pAAmodel_;
121 }
122
123 const std::shared_ptr<ProteinSubstitutionModelInterface> getAAModel() const
124 {
125 return pAAmodel_;
126 }
127
129 {
130 throw NullPointerException("AbstractCodonAARateSubstitutionModel::frequencySet. No associated FrequencySet.");
131 }
132
133 bool hasCodonFrequencySet() const override
134 {
135 return false;
136 }
137
138 void setFreq(std::map<int, double>& frequencies) override {}
139};
140} // end of namespace bpp.
141#endif // BPP_PHYL_MODEL_CODON_ABSTRACTCODONAARATESUBSTITUTIONMODEL_H
Abstract class for modelling of non-synonymous and synonymous substitution rates in codon models,...
AbstractCodonAARateSubstitutionModel * clone() const override
AbstractCodonAARateSubstitutionModel(std::shared_ptr< ProteinSubstitutionModelInterface > pmodel, std::shared_ptr< const GeneticCode > pgencode, const std::string &prefix, bool paramSynRate=false)
Build a new AbstractCodonAARateSubstitutionModel object from a pointer to NucleotideSubstitutionModel...
AbstractCodonAARateSubstitutionModel & operator=(const AbstractCodonAARateSubstitutionModel &model)
void fireParameterChanged(const ParameterList &parameters) override
void setAAModel(std::shared_ptr< ProteinSubstitutionModelInterface > model)
std::shared_ptr< ProteinSubstitutionModelInterface > pAAmodel_
void setFreq(std::map< int, double > &frequencies) 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...
const ProteinSubstitutionModelInterface & aaModel() const
std::shared_ptr< const StateMapInterface > stateMap_
const CodonFrequencySetInterface & codonFrequencySet() const override
AbstractCodonAARateSubstitutionModel(const AbstractCodonAARateSubstitutionModel &model)
void setNamespace(const std::string &prefix) override
const std::shared_ptr< ProteinSubstitutionModelInterface > getAAModel() const
AbstractParameterAliasable & operator=(const AbstractParameterAliasable &ap)
void setNamespace(const std::string &prefix)
Parametrize a set of state frequencies for codons.
Specialized interface for protein substitution model.
Defines the basic types of data flow nodes.