bpp-phyl3  3.0.0
MultiProcessSequenceEvolution.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 std;
8 using namespace bpp;
9 
10 /******************************************************************************/
11 
12 MultiProcessSequenceEvolution::MultiProcessSequenceEvolution(
13  std::shared_ptr<SubstitutionProcessCollection> processColl,
14  vector<size_t> nProc,
15  const std::string& prefix) :
17  processColl_(processColl),
18  nProc_(nProc)
19 {
20  // initialize parameters:
21 
22  for (size_t i = 0; i < nProc_.size(); ++i)
23  {
24  includeParameters_(processColl_->getSubstitutionProcessParameters(nProc_[i], true));
25  }
26 }
27 
28 /******************************************************************************/
29 
31 {
32  processColl_->matchParametersValues(parameters);
33 }
34 
35 /******************************************************************************/
36 
38 {
39  ParameterList pl;
40 
41  for (size_t i = 0; i < nProc_.size(); ++i)
42  {
43  pl.includeParameters(processColl_->getSubstitutionProcessParameters(nProc_[i], independent));
44  }
45 
46  return pl;
47 }
48 
50 {
51  ParameterList pl;
52 
53  for (size_t i = 0; i < nProc_.size(); ++i)
54  {
55  pl.includeParameters(processColl_->substitutionProcess(nProc_[i]).getSubstitutionModelParameters(independent));
56  }
57 
58  return pl;
59 }
60 
62 {
63  ParameterList pl;
64 
65  for (size_t i = 0; i < nProc_.size(); ++i)
66  {
67  pl.includeParameters(processColl_->substitutionProcess(nProc_[i]).getRateDistributionParameters(independent));
68  }
69 
70  return pl;
71 }
72 
74 {
75  ParameterList pl;
76 
77  for (size_t i = 0; i < nProc_.size(); ++i)
78  {
79  pl.includeParameters(processColl_->substitutionProcess(nProc_[i]).getRootFrequenciesParameters(independent));
80  }
81 
82  return pl;
83 }
84 
86 {
87  ParameterList pl;
88 
89  for (size_t i = 0; i < nProc_.size(); ++i)
90  {
91  pl.includeParameters(processColl_->substitutionProcess(nProc_[i]).getBranchLengthParameters(independent));
92  }
93 
94  return pl;
95 }
96 
98 {
99  ParameterList pl;
100 
101  for (size_t i = 0; i < nProc_.size(); ++i)
102  {
103  pl.includeParameters(processColl_->substitutionProcess(nProc_[i]).getNonDerivableParameters());
104  }
105 
107 
108  return pl;
109 }
110 
111 /******************************************************************************/
112 
113 
115 {
116  setParametersValues(parameters);
117 }
118 
119 
120 /*************************************************************************/
121 
123 {
124  for (size_t i = 0; i < nProc_.size(); ++i)
125  {
126  if (!processColl_->substitutionProcess(nProc_[i]).isCompatibleWith(data))
127  return false;
128  }
129 
130  return true;
131 }
void includeParameters_(const ParameterList &parameters)
ParameterList getAliasedParameters(const ParameterList &pl) const
void setParametersValues(const ParameterList &parameters) override
virtual bool isCompatibleWith(const AlignmentDataInterface &data) const
test if data fits this model
ParameterList getRateDistributionParameters(bool independent) const
Get the parameters associated to the rate distribution(s).
void setParameters(const ParameterList &parameters)
ParameterList getRootFrequenciesParameters(bool independent) const
Get the parameters associated to the root frequencies(s).
ParameterList getBranchLengthParameters(bool independent) const
Get the branch lengths parameters.
virtual void fireParameterChanged(const ParameterList &parameters)
ParameterList getSubstitutionProcessParameters(bool independent) const
Get the parameters associated to substitution processes(s).
std::vector< size_t > nProc_
the vector of the substitution process numbers, as they are used in this order.
std::shared_ptr< SubstitutionProcessCollection > processColl_
virtual ParameterList getNonDerivableParameters() const
All non derivable parameters.
ParameterList getSubstitutionModelParameters(bool independent) const
Get the parameters associated to substitution model(s).
virtual void includeParameters(const ParameterList &params)
Defines the basic types of data flow nodes.