bpp-phyl3 3.0.0
KCM.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: The Bio++ Development Group
2//
3// SPDX-License-Identifier: CECILL-2.1
4
6
7#include "../FrequencySet/CodonFrequencySet.h"
8#include "../Nucleotide/GTR.h"
9#include "KCM.h"
10
11using namespace bpp;
12
13using namespace std;
14
15/******************************************************************************/
16
17KCM::KCM(
18 std::shared_ptr<const GeneticCode> gc,
19 bool oneModel) :
20 AbstractParameterAliasable("KCM" + string(oneModel ? "7" : "19") + "."),
21 AbstractWrappedModel("KCM" + string(oneModel ? "7" : "19") + "."),
22 AbstractWrappedTransitionModel("KCM" + string(oneModel ? "7" : "19") + "."),
23 AbstractTotallyWrappedTransitionModel("KCM" + string(oneModel ? "7" : "19") + "."),
24 AbstractBiblioTransitionModel("KCM" + string(oneModel ? "7" : "19") + "."),
25 AbstractWrappedSubstitutionModel("KCM" + string(oneModel ? "7" : "19") + "."),
26 AbstractTotallyWrappedSubstitutionModel("KCM" + string(oneModel ? "7" : "19") + "."),
27 AbstractBiblioSubstitutionModel("KCM" + string(oneModel ? "7" : "19") + "."),
28 pmodel_(),
29 oneModel_(oneModel)
30{
31 shared_ptr<const NucleicAlphabet> nalph = gc->codonAlphabet().getNucleicAlphabet();
32
33 if (oneModel)
35 gc,
36 make_unique<GTR>(nalph)));
37 else
39 gc,
40 make_unique<GTR>(nalph),
41 make_unique<GTR>(nalph),
42 make_unique<GTR>(nalph)));
43
44 string name = "KCM" + string(oneModel ? "7" : "19") + ".";
45
46 pmodel_->setNamespace(name);
47
48 addParameters_(pmodel_->getParameters());
49
50 getParameter_("beta").setName(name + "omega"),
51
52 lParPmodel_.addParameters(pmodel_->getParameters());
53
54 vector<std::string> v = lParPmodel_.getParameterNames();
55
56 for (auto& vi : v)
57 {
59 }
60
61 mapParNamesFromPmodel_[name + "beta"] = "omega";
62
64}
65
66
67KCM::KCM(const KCM& kcm) :
76 pmodel_(new KroneckerCodonDistanceSubstitutionModel(*kcm.pmodel_)),
77 oneModel_(kcm.oneModel_)
78{}
79
81{
83
84 oneModel_ = kcm.oneModel_;
86 return *this;
87}
AbstractBiblioSubstitutionModel & operator=(const AbstractBiblioSubstitutionModel &model)
Partial implementation of the SubstitutionModel interface for models that are set for matching the bi...
std::map< std::string, std::string > mapParNamesFromPmodel_
Tools to make the link between the Parameters of the object and those of pmixmodel_.
void addParameters_(const ParameterList &parameters)
Parameter & getParameter_(const std::string &name)
Abstract class of Wrapping model class, where all methods are redirected from model().
The general multiple substitution model for codons, from Zaheri & al, 2014.
Definition: KCM.h:44
std::unique_ptr< KroneckerCodonDistanceSubstitutionModel > pmodel_
Definition: KCM.h:46
KCM & operator=(const KCM &)
Definition: KCM.cpp:80
KCM(std::shared_ptr< const GeneticCode > gc, bool oneModel)
constructor.
Definition: KCM.cpp:17
bool oneModel_
Definition: KCM.h:47
Class for non-synonymous substitution models on codons with parameterized nucleotidic models,...
virtual void addParameters(const ParameterList &params)
virtual std::vector< std::string > getParameterNames() const
virtual void setName(const std::string &name)
virtual std::string getParameterNameWithoutNamespace(const std::string &name) const=0
Defines the basic types of data flow nodes.