bpp-phyl3  3.0.0
bpp::StochasticMapping Class Reference

#include <Bpp/Phyl/Mapping/StochasticMapping.h>

+ Collaboration diagram for bpp::StochasticMapping:

Public Member Functions

 StochasticMapping (std::shared_ptr< LikelihoodCalculationSingleProcess > drl, size_t numOfMappings=10000)
 
 ~StochasticMapping ()
 
 StochasticMapping (const StochasticMapping &sm)
 
StochasticMappingclone () const
 cloning function used by the copy constructor of ./Likelihood/JointLikelihoodFunction/h More...
 
void generateStochasticMapping (std::vector< std::shared_ptr< PhyloTree >> &mappings)
 
std::shared_ptr< PhyloTreegenerateExpectedMapping (std::vector< std::shared_ptr< PhyloTree >> &mappings, size_t divMethod=0)
 Creates a single expected (i.e, average) history based on a given set of mappings steps. Correspond to Nielsen, Rasmus. "Mapping mutations on phylogenies." Systematic biology 51.5 (2002): 729-739.‏ More...
 
std::shared_ptr< PhyloTreegenerateAnalyticExpectedMapping (size_t divMethod=0)
 Creates a single expected (i.e, average) history based the rewards provided by the algorithm of Minin and Suchard (2008) the function assumes that there is only one site to simulate history for. More...
 
int getNodeState (const PhyloNode *node) const
 

Protected Attributes

std::shared_ptr< LikelihoodCalculationSingleProcesslikelihood_
 
std::shared_ptr< PhyloTreetree_
 
VVDouble fractionalProbabilities_
 
VVVDouble ConditionalProbabilities_
 
size_t nodesCounter_
 
size_t numOfMappings_
 

Private Member Functions

void giveNamesToInternalNodes (PhyloTree &tree)
 
void setNodeState (PhyloNode *node, size_t state)
 
void setLeafsStates (std::shared_ptr< PhyloTree > mapping)
 
void computeFractionals ()
 
void ComputeConditionals ()
 
void computeStatesFrequencies (VVDouble &ancestralStatesFreuquencies, vector< shared_ptr< PhyloTree >> &mappings)
 
size_t sampleState (const VDouble &distibution)
 
void sampleAncestrals (shared_ptr< PhyloTree > mapping)
 
void setExpectedAncestrals (shared_ptr< PhyloTree > expectedMapping, VVDouble &posteriorProbabilities)
 
void sampleMutationsGivenAncestrals (shared_ptr< PhyloTree > mapping)
 
void updateBranchMapping (PhyloNode *son, const MutationPath &branchMapping)
 
void sampleMutationsGivenAncestralsPerBranch (PhyloNode *son, size_t maxIterNum=10000)
 
void updateBranchByDwellingTimes (PhyloNode *node, VDouble &dwellingTimes, VVDouble &posteriorProbabilities, size_t divMethod=0)
 

Detailed Description

Definition at line 39 of file StochasticMapping.h.

Constructor & Destructor Documentation

◆ StochasticMapping() [1/2]

StochasticMapping::StochasticMapping ( std::shared_ptr< LikelihoodCalculationSingleProcess drl,
size_t  numOfMappings = 10000 
)
explicit

Definition at line 32 of file StochasticMapping.cpp.

References ComputeConditionals(), giveNamesToInternalNodes(), and tree_.

◆ ~StochasticMapping()

StochasticMapping::~StochasticMapping ( )

Definition at line 48 of file StochasticMapping.cpp.

◆ StochasticMapping() [2/2]

bpp::StochasticMapping::StochasticMapping ( const StochasticMapping sm)
inline

Definition at line 81 of file StochasticMapping.h.

Member Function Documentation

◆ clone()

StochasticMapping* bpp::StochasticMapping::clone ( ) const
inline

cloning function used by the copy constructor of ./Likelihood/JointLikelihoodFunction/h

Definition at line 95 of file StochasticMapping.h.

◆ ComputeConditionals()

void StochasticMapping::ComputeConditionals ( )
private

Definition at line 384 of file StochasticMapping.cpp.

Referenced by StochasticMapping().

◆ computeFractionals()

void StochasticMapping::computeFractionals ( )
private

Definition at line 332 of file StochasticMapping.cpp.

◆ computeStatesFrequencies()

void StochasticMapping::computeStatesFrequencies ( VVDouble ancestralStatesFreuquencies,
vector< shared_ptr< PhyloTree >> &  mappings 
)
private

Definition at line 451 of file StochasticMapping.cpp.

◆ generateAnalyticExpectedMapping()

shared_ptr< PhyloTree > StochasticMapping::generateAnalyticExpectedMapping ( size_t  divMethod = 0)

Creates a single expected (i.e, average) history based the rewards provided by the algorithm of Minin and Suchard (2008) the function assumes that there is only one site to simulate history for.

Parameters
divMethodThe method used in the case that the son and father share the same state (either divide the wdelling time of the staed state by 2 for two transitions (method 0) or allocate the entire dwelling time to be adjacent to the son(method 1))

Definition at line 157 of file StochasticMapping.cpp.

References tree_.

◆ generateExpectedMapping()

shared_ptr< PhyloTree > StochasticMapping::generateExpectedMapping ( std::vector< std::shared_ptr< PhyloTree >> &  mappings,
size_t  divMethod = 0 
)

Creates a single expected (i.e, average) history based on a given set of mappings steps. Correspond to Nielsen, Rasmus. "Mapping mutations on phylogenies." Systematic biology 51.5 (2002): 729-739.‏

the function assumes that there is only one site to simulate history

Parameters
mappingsA vector of stochastic mappings to average
divMethodThe method used in the case that the son and father share the same state (either divide the dwelling time of the staed state by 2 for two transitions (method 0) or allocate the entire dwelling time to be adjacent to the son(method 1))

Definition at line 93 of file StochasticMapping.cpp.

References tree_.

◆ generateStochasticMapping()

void StochasticMapping::generateStochasticMapping ( std::vector< std::shared_ptr< PhyloTree >> &  mappings)

Definition at line 53 of file StochasticMapping.cpp.

References numOfMappings_.

◆ getNodeState()

int StochasticMapping::getNodeState ( const PhyloNode node) const

Definition at line 286 of file StochasticMapping.cpp.

References bpp::PhyloNode::getProperty(), and STATE.

◆ giveNamesToInternalNodes()

◆ sampleAncestrals()

void StochasticMapping::sampleAncestrals ( shared_ptr< PhyloTree mapping)
private

Definition at line 521 of file StochasticMapping.cpp.

◆ sampleMutationsGivenAncestrals()

void StochasticMapping::sampleMutationsGivenAncestrals ( shared_ptr< PhyloTree mapping)
private

Definition at line 548 of file StochasticMapping.cpp.

◆ sampleMutationsGivenAncestralsPerBranch()

void StochasticMapping::sampleMutationsGivenAncestralsPerBranch ( PhyloNode son,
size_t  maxIterNum = 10000 
)
private

Definition at line 600 of file StochasticMapping.cpp.

◆ sampleState()

size_t StochasticMapping::sampleState ( const VDouble distibution)
private

Definition at line 502 of file StochasticMapping.cpp.

◆ setExpectedAncestrals()

void StochasticMapping::setExpectedAncestrals ( shared_ptr< PhyloTree expectedMapping,
VVDouble posteriorProbabilities 
)
private

Definition at line 76 of file StochasticMapping.cpp.

◆ setLeafsStates()

void StochasticMapping::setLeafsStates ( std::shared_ptr< PhyloTree mapping)
private

Definition at line 313 of file StochasticMapping.cpp.

◆ setNodeState()

void StochasticMapping::setNodeState ( PhyloNode node,
size_t  state 
)
private

Definition at line 293 of file StochasticMapping.cpp.

References bpp::PhyloNode::setProperty(), and STATE.

◆ updateBranchByDwellingTimes()

void StochasticMapping::updateBranchByDwellingTimes ( PhyloNode node,
VDouble dwellingTimes,
VVDouble posteriorProbabilities,
size_t  divMethod = 0 
)
private

Definition at line 656 of file StochasticMapping.cpp.

◆ updateBranchMapping()

void StochasticMapping::updateBranchMapping ( PhyloNode son,
const MutationPath branchMapping 
)
private

Definition at line 565 of file StochasticMapping.cpp.

Member Data Documentation

◆ ConditionalProbabilities_

VVVDouble bpp::StochasticMapping::ConditionalProbabilities_
protected

Definition at line 70 of file StochasticMapping.h.

◆ fractionalProbabilities_

VVDouble bpp::StochasticMapping::fractionalProbabilities_
protected

Definition at line 68 of file StochasticMapping.h.

◆ likelihood_

std::shared_ptr<LikelihoodCalculationSingleProcess> bpp::StochasticMapping::likelihood_
protected

Definition at line 49 of file StochasticMapping.h.

◆ nodesCounter_

size_t bpp::StochasticMapping::nodesCounter_
protected

Definition at line 71 of file StochasticMapping.h.

◆ numOfMappings_

size_t bpp::StochasticMapping::numOfMappings_
protected

Definition at line 72 of file StochasticMapping.h.

Referenced by generateStochasticMapping().

◆ tree_

std::shared_ptr<PhyloTree> bpp::StochasticMapping::tree_
protected

The documentation for this class was generated from the following files: