bpp-phyl3 3.0.0
ModelScenario.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_MODELSCENARIO_H
6#define BPP_PHYL_LIKELIHOOD_MODELSCENARIO_H
7
8#include <Bpp/Exceptions.h>
10
11#include "ModelPath.h"
12
13namespace bpp
14{
81{
82private:
83 std::vector< std::shared_ptr<ModelPath>> vModelPaths_;
84
85public:
87 vModelPaths_() {}
88
89 virtual ~ModelScenario(){}
90
91 ModelScenario(std::vector<std::shared_ptr<ModelPath>> vModelPaths) :
92 vModelPaths_(vModelPaths)
93 {}
94
97 {}
98
100 {
102 return *this;
103 }
104
105 // ModelScenario* clone() const { return new ModelScenario(*this); }
106
110 void clear()
111 {
112 vModelPaths_.clear();
113 }
114
115 /*
116 *@brief adds the copy of an ModelPath to the end of the
117 * ModelPaths list.
118 */
119 void addModelPath(std::shared_ptr<ModelPath> hn)
120 {
121 vModelPaths_.push_back(hn);
122 }
123
124 /*
125 *@brief change from a MixedTransitionModel to a
126 * MixedTransitionModel in all ModelPath.
127 *
128 */
129
130 void changeModel(std::shared_ptr<MixedTransitionModelInterface> m1,
131 std::shared_ptr<MixedTransitionModelInterface> m2);
132
133 /*
134 *@brief If necessary, adds a new ModelPath such that all submodels
135 * of the declared mixture models are at least in an
136 * ModelPath.
137 *
138 * Returns true iff a new path has been built.
139 *
140 */
141
142 bool complete();
143
144 /*
145 *@brief adds a submodel number to the nMth mixed model of the
146 * nHth ModelPath of the list (default nH=0). Checks if all the
147 * numbers are valid.
148 *
149 *@param nM number of the mixed model
150 *@param vnS number of the submodel
151 *@param nH number of the concerned ModelPath (default the last element of
152 * the list)
153 */
154
155 // void addToModelPath(size_t nM, const Vint& vnS, int nH = -1);
156
157 size_t getNumberOfModelPaths() const { return vModelPaths_.size(); }
158
159 std::shared_ptr<ModelPath> getModelPath(size_t i) { return vModelPaths_[i]; }
160
161 std::shared_ptr<const ModelPath> getModelPath(size_t i) const { return vModelPaths_[i]; }
162
166 std::vector<std::shared_ptr<MixedTransitionModelInterface>> getModels() const;
167
171 bool hasExclusivePaths() const;
172
181
185 std::string toString() const;
186};
187} // end of namespace bpp.
188#endif // BPP_PHYL_LIKELIHOOD_MODELSCENARIO_H
Organization of submodels in mixed substitution models as paths.
Definition: ModelScenario.h:81
void clear()
Resets the list of the ModelPaths.
std::shared_ptr< ModelPath > getModelPath(size_t i)
ModelScenario(std::vector< std::shared_ptr< ModelPath > > vModelPaths)
Definition: ModelScenario.h:91
void computeModelPathsProbabilities()
compute the probabilities in all the ModelPaths
std::vector< std::shared_ptr< MixedTransitionModelInterface > > getModels() const
return models found in several paths
virtual ~ModelScenario()
Definition: ModelScenario.h:89
void changeModel(std::shared_ptr< MixedTransitionModelInterface > m1, std::shared_ptr< MixedTransitionModelInterface > m2)
bool hasExclusivePaths() const
Checks if all the path (ie hypernodes) are exclusive.
std::string toString() const
string description
std::shared_ptr< const ModelPath > getModelPath(size_t i) const
void addModelPath(std::shared_ptr< ModelPath > hn)
std::vector< std::shared_ptr< ModelPath > > vModelPaths_
Definition: ModelScenario.h:83
size_t getNumberOfModelPaths() const
ModelScenario & operator=(const ModelScenario &set)
Definition: ModelScenario.h:99
ModelScenario(const ModelScenario &set)
Definition: ModelScenario.h:95
Defines the basic types of data flow nodes.