bpp-phyl3  3.0.0
YN98.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/K80.h"
9 #include "YN98.h"
10 
11 using namespace bpp;
12 using namespace std;
13 
14 /******************************************************************************/
15 
17  std::shared_ptr<const GeneticCode> gc,
18  std::unique_ptr<CodonFrequencySetInterface> codonFreqs) :
20  AbstractWrappedModel("YN98."),
27  pmodel_(new CodonDistanceFrequenciesSubstitutionModel(gc, make_unique<K80>(gc->codonAlphabet().getNucleicAlphabet()), std::move(codonFreqs)))
28 {
29  computeFrequencies(false);
30 
31  addParameter_(new Parameter("YN98.kappa", 1, Parameter::R_PLUS_STAR));
32  addParameter_(new Parameter("YN98.omega", 1, make_shared<IntervalConstraint>(0.001, 999, true, true)));
33 
34  pmodel_->setNamespace("YN98.");
35  addParameters_(pmodel_->codonFrequencySet().getParameters());
36 
37  lParPmodel_.addParameters(pmodel_->getParameters());
38 
39  vector<std::string> v = pmodel_->codonFrequencySet().getParameters().getParameterNames();
40 
41  for (auto& vi : v)
42  {
44  }
45  mapParNamesFromPmodel_["YN98.123_K80.kappa"] = "kappa";
46  mapParNamesFromPmodel_["YN98.beta"] = "omega";
47 
49 }
50 
51 
52 YN98::YN98(const YN98& yn98) :
61  pmodel_(yn98.pmodel_->clone())
62 {}
63 
64 YN98& YN98::operator=(const YN98& yn98)
65 {
67  pmodel_.reset(yn98.pmodel_->clone());
68  return *this;
69 }
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)
void addParameter_(Parameter *parameter)
Abstract class of Wrapping model class, where all methods are redirected from model().
Class for asynonymous substitution models on codons with parameterized equilibrium frequencies and nu...
The Kimura 2-rates substitution model for nucleotides.
Definition: K80.h:116
virtual void addParameters(const ParameterList &params)
static const std::shared_ptr< IntervalConstraint > R_PLUS_STAR
virtual std::string getParameterNameWithoutNamespace(const std::string &name) const=0
The Yang and Nielsen (1998) substitution model for codons.
Definition: YN98.h:57
YN98 & operator=(const YN98 &)
Definition: YN98.cpp:64
std::unique_ptr< CodonDistanceFrequenciesSubstitutionModel > pmodel_
Definition: YN98.h:59
YN98(std::shared_ptr< const GeneticCode > gc, std::unique_ptr< CodonFrequencySetInterface > codonFreqs)
Definition: YN98.cpp:16
Defines the basic types of data flow nodes.