bpp-phyl3  3.0.0
AbstractAutonomousSubstitutionProcess.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_LIKELIHOOD_ABSTRACT_AUTONOMOUS_SUBSTITUTIONPROCESS_H
6 #define BPP_PHYL_LIKELIHOOD_ABSTRACT_AUTONOMOUS_SUBSTITUTIONPROCESS_H
7 
10 
11 // From the STL:
12 #include <memory>
13 
14 namespace bpp
15 {
25  public virtual AbstractSubstitutionProcess
26 {
27 protected:
28  std::shared_ptr<ParametrizablePhyloTree> pTree_;
29 
33  std::shared_ptr<FrequencySetInterface> rootFrequencies_;
34 
35  std::shared_ptr<ModelScenario> modelScenario_;
36 
37 protected:
47  std::shared_ptr<const PhyloTree> tree = 0,
48  std::shared_ptr<FrequencySetInterface> rootFrequencies = 0,
49  const std::string& prefix = "");
50 
57  std::shared_ptr<ParametrizablePhyloTree> tree,
58  std::shared_ptr<FrequencySetInterface> rootFrequencies = 0,
59  const std::string& prefix = "");
60 
62 
64 
65 public:
71  void setPhyloTree(const PhyloTree& phyloTree);
72 
74  {
75  return *pTree_;
76  }
77 
78  std::shared_ptr<const ParametrizablePhyloTree> getParametrizablePhyloTree() const
79  {
80  return pTree_;
81  }
82 
86  bool hasRootFrequencySet() const
87  {
88  return rootFrequencies_ != 0;
89  }
90 
92  {
93  return *rootFrequencies_;
94  }
95 
96  std::shared_ptr<const FrequencySetInterface> getRootFrequencySet() const
97  {
98  return rootFrequencies_;
99  }
100 
102  {
103  return *rootFrequencies_;
104  }
105 
106  std::shared_ptr<FrequencySetInterface> getRootFrequencySet()
107  {
108  return rootFrequencies_;
109  }
110 
116  void setRootFrequencySet(std::shared_ptr<FrequencySetInterface> rootfrequency)
117  {
118  if (rootFrequencies_)
119  getParameters_().deleteParameters(rootFrequencies_->getParameters().getParameterNames(), false);
120  rootFrequencies_ = rootfrequency;
121  if (rootFrequencies_)
122  addParameters_(rootFrequencies_->getParameters());
123  }
124 
131  {
132  if (!hasRootFrequencySet())
133  return ParameterList();
134  else
135  return rootFrequencies_->getParameters();
136  }
137 
138 
144  void fireParameterChanged(const ParameterList& pl);
145 
150  std::shared_ptr<const ModelScenario> getModelScenario() const
151  {
152  return modelScenario_;
153  }
154 
160  virtual void setModelScenario(std::shared_ptr<ModelScenario> modelScenario) = 0;
161 };
162 } // end namespace bpp
163 
164 #endif // BPP_PHYL_LIKELIHOOD_ABSTRACT_AUTONOMOUS_SUBSTITUTIONPROCESS
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.
std::shared_ptr< FrequencySetInterface > getRootFrequencySet()
ParameterList getRootFrequenciesParameters(bool independent) const
Get the parameters corresponding to the root frequencies.
void fireParameterChanged(const ParameterList &pl)
AbsractParametrizable interface.
virtual void setModelScenario(std::shared_ptr< ModelScenario > modelScenario)=0
set the ModelScenario.
void setRootFrequencySet(std::shared_ptr< FrequencySetInterface > rootfrequency)
set the RootFrequency.
std::shared_ptr< const FrequencySetInterface > getRootFrequencySet() const
const ParametrizablePhyloTree & parametrizablePhyloTree() const
std::shared_ptr< const ParametrizablePhyloTree > getParametrizablePhyloTree() const
void setPhyloTree(const PhyloTree &phyloTree)
sets the ParametrizablePhyloTree.
std::shared_ptr< const ModelScenario > getModelScenario() const
get the ModelScenario.
std::shared_ptr< FrequencySetInterface > rootFrequencies_
Root frequencies.
AbstractAutonomousSubstitutionProcess & operator=(const AbstractAutonomousSubstitutionProcess &asp)
void addParameters_(const ParameterList &parameters)
ParameterList & getParameters_() override
A partial implementation of the SubstitutionProcess interface.
Interface for SubstitutionProcess objects that own their own ParametrizablePhyloTree & Scenario.
Parametrize a set of state frequencies.
Definition: FrequencySet.h:29
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.