5 #ifndef BPP_PHYL_MAPPING_STOCHASTICMAPPING_H
6 #define BPP_PHYL_MAPPING_STOCHASTICMAPPING_H
9 #include "../Likelihood/DataFlow/DataFlowCWise.h"
10 #include "../Likelihood/DataFlow/LikelihoodCalculationSingleProcess.h"
11 #include "../Simulation/MutationProcess.h"
12 #include "../Simulation/SubstitutionProcessSequenceSimulator.h"
49 std::shared_ptr<LikelihoodCalculationSingleProcess>
likelihood_;
51 std::shared_ptr<PhyloTree>
tree_;
77 explicit StochasticMapping(std::shared_ptr<LikelihoodCalculationSingleProcess> drl,
size_t numOfMappings = 10000);
82 likelihood_(sm.likelihood_),
85 fractionalProbabilities_(sm.fractionalProbabilities_),
86 ConditionalProbabilities_(sm.ConditionalProbabilities_),
87 nodesCounter_(0), numOfMappings_(sm.numOfMappings_)
107 void generateStochasticMapping(std::vector<std::shared_ptr<PhyloTree>>& mappings);
126 std::shared_ptr<PhyloTree> generateExpectedMapping(std::vector<std::shared_ptr<PhyloTree>>& mappings,
size_t divMethod = 0);
138 std::shared_ptr<PhyloTree> generateAnalyticExpectedMapping(
size_t divMethod = 0);
145 int getNodeState(
const PhyloNode* node)
const;
151 void giveNamesToInternalNodes(
PhyloTree& tree);
157 void setNodeState(
PhyloNode* node,
size_t state);
162 void setLeafsStates(std::shared_ptr<PhyloTree> mapping);
167 void computeFractionals();
172 void ComputeConditionals();
178 void computeStatesFrequencies(
VVDouble& ancestralStatesFreuquencies, vector<shared_ptr<PhyloTree>>& mappings);
183 size_t sampleState(
const VDouble& distibution);
188 void sampleAncestrals(shared_ptr<PhyloTree> mapping);
194 void setExpectedAncestrals(shared_ptr<PhyloTree> expectedMapping,
VVDouble& posteriorProbabilities);
199 void sampleMutationsGivenAncestrals(shared_ptr<PhyloTree> mapping);
211 void sampleMutationsGivenAncestralsPerBranch(
PhyloNode* son,
size_t maxIterNum = 10000);
220 void updateBranchByDwellingTimes(
PhyloNode* node,
VDouble& dwellingTimes,
VVDouble& posteriorProbabilities,
size_t divMethod = 0);
vector< vector< vector< double > > > VVVDouble
vector< vector< double > > VVDouble
This class is used by MutationProcess to store detailed results of simulations.
std::shared_ptr< LikelihoodCalculationSingleProcess > likelihood_
VVDouble fractionalProbabilities_
VVVDouble ConditionalProbabilities_
StochasticMapping(const StochasticMapping &sm)
StochasticMapping * clone() const
cloning function used by the copy constructor of ./Likelihood/JointLikelihoodFunction/h
std::shared_ptr< PhyloTree > tree_
Defines the basic types of data flow nodes.