bpp-phyl3  3.0.0
AbstractAutonomousSubstitutionProcess.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 using namespace bpp;
8 using namespace std;
9 
11  std::shared_ptr<const PhyloTree> tree,
12  std::shared_ptr<FrequencySetInterface> rootFrequencies,
13  const string& prefix) :
15  pTree_(0),
16  rootFrequencies_(rootFrequencies),
17  modelScenario_(0)
18 {
19  if (tree)
20  setPhyloTree(*tree);
21  if (rootFrequencies_)
22  addParameters_(rootFrequencies_->getParameters());
23 }
24 
26  std::shared_ptr<ParametrizablePhyloTree> tree,
27  std::shared_ptr<FrequencySetInterface> rootFrequencies, const string& prefix) :
29  pTree_(tree),
30  rootFrequencies_(rootFrequencies),
31  modelScenario_(0)
32 {
33  if (tree)
34  addParameters_(tree->getParameters()); // Branch lengths
35  if (rootFrequencies_)
36  addParameters_(rootFrequencies_->getParameters());
37 }
38 
41  pTree_(asp.pTree_ ? asp.pTree_->clone() : 0),
42  rootFrequencies_(asp.rootFrequencies_ ? asp.rootFrequencies_->clone() : 0),
43  modelScenario_(asp.modelScenario_) // this has to be specified by inheriting class to follow model links
44 {}
45 
47 {
49 
50  pTree_.reset(asp.pTree_ ? asp.pTree_->clone() : 0);
51  rootFrequencies_.reset(asp.rootFrequencies_ ? asp.rootFrequencies_->clone() : 0);
52  modelScenario_ = asp.modelScenario_; // this has to be specified by inheriting class to follow model links
53  return *this;
54 }
55 
57 {
59  gAP.addParameters(pl);
60 
61  if (pTree_)
62  pTree_->matchParametersValues(gAP);
63  if (rootFrequencies_)
64  rootFrequencies_->matchParametersValues(gAP);
65 }
66 
68 {
69  if (pTree_)
70  getParameters_().deleteParameters(pTree_->getParameters().getParameterNames(), false);
71 
72  pTree_.reset(new ParametrizablePhyloTree(phyloTree));
73  addParameters_(pTree_->getParameters());
74 }
A partial implementation of the SubstitutionProcess interface.
AbstractAutonomousSubstitutionProcess(std::shared_ptr< const PhyloTree > tree=0, std::shared_ptr< FrequencySetInterface > rootFrequencies=0, const std::string &prefix="")
Builds using an optional pointer towards a PhyloTree.
void fireParameterChanged(const ParameterList &pl)
AbsractParametrizable interface.
void setPhyloTree(const PhyloTree &phyloTree)
sets the ParametrizablePhyloTree.
std::shared_ptr< FrequencySetInterface > rootFrequencies_
Root frequencies.
AbstractAutonomousSubstitutionProcess & operator=(const AbstractAutonomousSubstitutionProcess &asp)
void addParameters_(const ParameterList &parameters)
AbstractParameterAliasable & operator=(const AbstractParameterAliasable &ap)
ParameterList getAliasedParameters(const ParameterList &pl) const
ParameterList & getParameters_() override
virtual void addParameters(const ParameterList &params)
virtual void deleteParameters(const std::vector< std::string > &names, bool mustExist=true)
PhyloTree with Parametrizable Phylo Branches. They SHARE their branch length parameters.
Defines the basic types of data flow nodes.