bpp-phyl3  3.0.0
AbstractCodonSubstitutionModel.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_ABSTRACTCODONSUBSTITUTIONMODEL_H
6 #define BPP_PHYL_MODEL_CODON_ABSTRACTCODONSUBSTITUTIONMODEL_H
7 
8 
9 #include "../AbstractWordSubstitutionModel.h"
10 #include "../Nucleotide/NucleotideSubstitutionModel.h"
11 #include "CodonSubstitutionModel.h"
12 
13 // From bpp-seq:
15 
16 // From the STL:
17 #include <memory>
18 
19 namespace bpp
20 {
39  public virtual CodonSubstitutionModelInterface,
41 {
42 private:
48  std::shared_ptr<const GeneticCode> gCode_;
49 
50 public:
63  std::shared_ptr<const GeneticCode> gCode,
64  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod,
65  const std::string& st,
66  bool paramRates = false);
67 
83  std::shared_ptr<const GeneticCode> gCode,
84  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod1,
85  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod2,
86  std::unique_ptr<NucleotideSubstitutionModelInterface> pmod3,
87  const std::string& st,
88  bool paramRates = false);
89 
91 
95  gCode_(model.gCode_)
96  {}
97 
99  {
102  gCode_ = model.gCode_;
103  return *this;
104  }
105 
106  AbstractCodonSubstitutionModel* clone() const override = 0;
107 
108  void setNamespace(const std::string& prefix) override
109  {
111  }
112 
113 protected:
120  void completeMatrices_() override;
121 
122  void updateMatrices_() override;
123 
124 public:
125  std::shared_ptr<const GeneticCode> getGeneticCode() const override { return gCode_; }
126 };
127 } // end of namespace bpp.
128 #endif // BPP_PHYL_MODEL_CODON_ABSTRACTCODONSUBSTITUTIONMODEL_H
Abstract class for substitution models on codons.
std::shared_ptr< const GeneticCode > getGeneticCode() const override
AbstractCodonSubstitutionModel(std::shared_ptr< const GeneticCode > gCode, std::unique_ptr< NucleotideSubstitutionModelInterface > pmod, const std::string &st, bool paramRates=false)
Build a new AbstractCodonSubstitutionModel object from a pointer to a NucleotideSubstitutionModel.
std::shared_ptr< const GeneticCode > gCode_
AbstractCodonSubstitutionModel & operator=(const AbstractCodonSubstitutionModel &model)
void completeMatrices_() override
Method inherited from AbstractWordSubstitutionModel.
AbstractCodonSubstitutionModel * clone() const override=0
void updateMatrices_() override
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
bool hasParametrizedRates_
boolean for the parametrization of the position relative rates. Default : false.
void setNamespace(const std::string &prefix) override
AbstractCodonSubstitutionModel(const AbstractCodonSubstitutionModel &model)
Abstract Basal class for words of substitution models.
AbstractWordSubstitutionModel & operator=(const AbstractWordSubstitutionModel &)
Defines the basic types of data flow nodes.