bpp-phyl3
3.0.0
|
Organization of submodels in mixed substitution models as paths. More...
#include <Bpp/Phyl/Likelihood/ModelScenario.h>
Public Member Functions | |
ModelScenario () | |
virtual | ~ModelScenario () |
ModelScenario (std::vector< std::shared_ptr< ModelPath >> vModelPaths) | |
ModelScenario (const ModelScenario &set) | |
ModelScenario & | operator= (const ModelScenario &set) |
void | clear () |
Resets the list of the ModelPaths. More... | |
void | addModelPath (std::shared_ptr< ModelPath > hn) |
void | changeModel (std::shared_ptr< MixedTransitionModelInterface > m1, std::shared_ptr< MixedTransitionModelInterface > m2) |
bool | complete () |
size_t | getNumberOfModelPaths () const |
std::shared_ptr< ModelPath > | getModelPath (size_t i) |
std::shared_ptr< const ModelPath > | getModelPath (size_t i) const |
std::vector< std::shared_ptr< MixedTransitionModelInterface > > | getModels () const |
return models found in several paths More... | |
bool | hasExclusivePaths () const |
Checks if all the path (ie hypernodes) are exclusive. More... | |
void | computeModelPathsProbabilities () |
compute the probabilities in all the ModelPaths More... | |
std::string | toString () const |
string description More... | |
Private Attributes | |
std::vector< std::shared_ptr< ModelPath > > | vModelPaths_ |
Organization of submodels in mixed substitution models as paths.
These sets are defined through an hypergraph, denoted as a scenario, ie a list of hypernodes. HyperNodes are defined in class ModelPath.
For example, suppose there are 3 mixed models (M1,M2 and M3), with 2, 3, 4 submodels (S1, S2, ...) each.
If the sites are allowed to follow any combination of submodels (12 combinations) the corresponding scenario has only one model path: (<1,2>,<1,2,3>,<1,2,3,4>).
The scenario with model paths ((<1>,<1,2>,<1,2>),(<2>,<3>,<3,4>)) means that a site either follows 6 combinations:
M1:S1 and ( M2:S1 or M2:S2 ) and ( M3:S1 or M3:S2 ).
or
M1:S2 and M2:S3 and (M3:S3 or M3:S4).
If a mixed model is not represented in any model path, it is considered as non-mixed, which means that his transition probabilities are the mixture of the transition probabilities of its submodels.
Dependency of the submodels entails constraints in the probabilities of the submodels, and definition of the model paths must be taken with care for the whole modelling to be possible.
In this implementation, for sake of simplification (and for reason of time), each submodel must belong to exactly one given model path, but in theory more complex dependencies are possible.
Inside each path model, for each set of submodels, the probabilities of the submodels are conditional probabilities, which means that they sum 1 and their ratio are unchanged.
For instance, for scenario ((<1>,<1,2>,<1,2>),(<2>,<3>,<3,4>)), the probabilities of model paths are the probabilities of M1:S1 and M1:S2. In the first model path, the probabilities of M2:S1 and M2:S2 are P(M2:S1)/(P(M2:S1)+P(M2:S2)) and P(M2:S2)/(P(M2:S1)+P(M2:S2)).
We do not certify that the probability parameters of the mixed models are all useful, and then identifiability problems may be encountered.
There is a method ("complete") that creates an additional model path to ensure that all submodels belong to at least an model path.
To do (perhaps) : compute the probabilities of the hypernodes from a specific mixed model
Definition at line 80 of file ModelScenario.h.
|
inline |
Definition at line 86 of file ModelScenario.h.
|
inlinevirtual |
Definition at line 89 of file ModelScenario.h.
|
inline |
Definition at line 91 of file ModelScenario.h.
|
inline |
Definition at line 95 of file ModelScenario.h.
|
inline |
Definition at line 119 of file ModelScenario.h.
References vModelPaths_.
void ModelScenario::changeModel | ( | std::shared_ptr< MixedTransitionModelInterface > | m1, |
std::shared_ptr< MixedTransitionModelInterface > | m2 | ||
) |
Definition at line 40 of file ModelScenario.cpp.
|
inline |
Resets the list of the ModelPaths.
Definition at line 110 of file ModelScenario.h.
References vModelPaths_.
bool ModelScenario::complete | ( | ) |
Definition at line 12 of file ModelScenario.cpp.
References bpp::ModelPath::getModels().
void ModelScenario::computeModelPathsProbabilities | ( | ) |
compute the probabilities in all the ModelPaths
The probabilities of the hypernodes are computed from the lead mixed model of the FIRST ModelPath (and not of the others).
Definition at line 74 of file ModelScenario.cpp.
References bpp::ModelPath::getPathNode(), bpp::ModelPath::getProbability(), bpp::ModelPath::hasModel(), bpp::ModelPath::setProbability(), and bpp::TextTools::toString().
|
inline |
Definition at line 159 of file ModelScenario.h.
References vModelPaths_.
Referenced by bpp::ProcessComputationTree::buildFollowingScenario_().
|
inline |
Definition at line 161 of file ModelScenario.h.
References vModelPaths_.
vector< shared_ptr< MixedTransitionModelInterface > > ModelScenario::getModels | ( | ) | const |
return models found in several paths
Definition at line 170 of file ModelScenario.cpp.
|
inline |
Definition at line 157 of file ModelScenario.h.
References vModelPaths_.
Referenced by bpp::ProcessComputationTree::buildFollowingScenario_().
bool ModelScenario::hasExclusivePaths | ( | ) | const |
Checks if all the path (ie hypernodes) are exclusive.
Definition at line 49 of file ModelScenario.cpp.
References bpp::ModelPath::intersects().
|
inline |
Definition at line 99 of file ModelScenario.h.
References vModelPaths_.
string ModelScenario::toString | ( | ) | const |
string description
Definition at line 158 of file ModelScenario.cpp.
|
private |
Definition at line 83 of file ModelScenario.h.
Referenced by addModelPath(), clear(), getModelPath(), getNumberOfModelPaths(), and operator=().