bpp-phyl3  3.0.0
bpp::RewardMappingTools Class Reference

Provide methods to compute reward mappings. More...

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

Public Member Functions

 RewardMappingTools ()
 
virtual ~RewardMappingTools ()
 

Static Public Member Functions

static std::unique_ptr< ProbabilisticRewardMappingcomputeRewardVectors (LikelihoodCalculationSingleProcess &rltc, const std::vector< uint > &edgeIds, Reward &reward, short unresolvedOption=SubstitutionMappingTools::UNRESOLVED_ZERO, bool verbose=true)
 Compute the reward vectors for a particular dataset using the double-recursive likelihood computation. More...
 
static void writeToStream (const ProbabilisticRewardMapping &rewards, const AlignmentDataInterface &sites, std::ostream &out)
 Write the reward vectors to a stream. More...
 
static void readFromStream (std::istream &in, ProbabilisticRewardMapping &rewards)
 Read the reward vectors from a stream. More...
 
static double computeSumForBranch (const ProbabilisticRewardMapping &smap, size_t branchIndex)
 Sum all rewards of a given branch (specified by its index). More...
 
static double computeSumForSite (const ProbabilisticRewardMapping &smap, size_t siteIndex)
 Sum all rewards on a given site (specified by its index). More...
 

Detailed Description

Provide methods to compute reward mappings.

For now, 4 methods are implemented, and provide reward mappings.

See: Minin, V.N. and Suchard, M.A., Fast, accurate and simulation-free stochastic mapping Philosophical Transactions of the Royal Society B 2008 363:3985-95.

Author
Laurent Guéguen

Definition at line 28 of file RewardMappingTools.h.

Constructor & Destructor Documentation

◆ RewardMappingTools()

bpp::RewardMappingTools::RewardMappingTools ( )
inline

Definition at line 31 of file RewardMappingTools.h.

◆ ~RewardMappingTools()

virtual bpp::RewardMappingTools::~RewardMappingTools ( )
inlinevirtual

Definition at line 32 of file RewardMappingTools.h.

Member Function Documentation

◆ computeRewardVectors()

unique_ptr< ProbabilisticRewardMapping > RewardMappingTools::computeRewardVectors ( LikelihoodCalculationSingleProcess rltc,
const std::vector< uint > &  edgeIds,
Reward reward,
short  unresolvedOption = SubstitutionMappingTools::UNRESOLVED_ZERO,
bool  verbose = true 
)
static

Compute the reward vectors for a particular dataset using the double-recursive likelihood computation.

Parameters
rltcA LikelihoodCalculationSingleProcess object.
edgeIdsThe Ids of the nodes the reward vectors are computed on.
rewardThe Reward to use.
unresolvedOptionDescribes how unresolved are managed (see above).
verbosePrint info to screen.
Returns
A vector of reward vectors (one for each site).
Exceptions
ExceptionIf the likelihood object is not initialized.

Definition at line 25 of file RewardMappingTools.cpp.

References bpp::Reward::clone(), bpp::VectorTools::contains(), bpp::numeric::convert(), bpp::numeric::cwise(), bpp::ApplicationTools::displayGauge(), bpp::ApplicationTools::displayTask(), bpp::ApplicationTools::displayTaskDone(), bpp::LikelihoodCalculationSingleProcess::getBackwardLikelihoodsAtEdgeForClass(), bpp::LikelihoodCalculationSingleProcess::getEdgesIds(), bpp::LikelihoodCalculationSingleProcess::getForwardLikelihoodsAtNodeForClass(), bpp::LikelihoodCalculationSingleProcess::getForwardLikelihoodTree(), bpp::LikelihoodCalculationSingleProcess::getLikelihoodsAtNodeForClass(), bpp::SubstitutionProcessInterface::getNumberOfClasses(), bpp::LikelihoodCalculationSingleProcess::getNumberOfDistinctSites(), bpp::SubstitutionProcessInterface::getParametrizablePhyloTree(), bpp::ProbabilityDAG::getProbaAtNode(), bpp::SubstitutionProcessInterface::getProbabilityForModel(), bpp::LikelihoodCalculationSingleProcess::getRootArrayPositions(), bpp::LikelihoodCalculationSingleProcess::getTreeNode(), bpp::LikelihoodCalculation::isInitialized(), bpp::ApplicationTools::message, bpp::SubstitutionProcessInterface::parametrizablePhyloTree(), bpp::LikelihoodCalculationSingleProcess::substitutionProcess(), bpp::TextTools::toString(), bpp::SubstitutionMappingTools::UNRESOLVED_AVERAGE, bpp::SubstitutionMappingTools::UNRESOLVED_ZERO, and bpp::ExtendedFloatEigen< R, C, EigenType >::Zero().

◆ computeSumForBranch()

double RewardMappingTools::computeSumForBranch ( const ProbabilisticRewardMapping smap,
size_t  branchIndex 
)
static

Sum all rewards of a given branch (specified by its index).

Parameters
smapThe reward map to use.
branchIndexThe index of the reward vector for which the counts should be computed.
Returns
A vector will all rewards summed.

Definition at line 324 of file RewardMappingTools.cpp.

References bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdge(), bpp::AbstractMapping::getNumberOfSites(), and bpp::ProbabilisticRewardMapping::getSiteIndex().

◆ computeSumForSite()

double RewardMappingTools::computeSumForSite ( const ProbabilisticRewardMapping smap,
size_t  siteIndex 
)
static

Sum all rewards on a given site (specified by its index).

Parameters
smapThe substitution map to use.
siteIndexThe index of the substitution vector for which the counts should be computed.
Returns
A vector will all counts summed for each types of substitutions.

Definition at line 339 of file RewardMappingTools.cpp.

References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), and bpp::ProbabilisticRewardMapping::getSiteIndex().

◆ readFromStream()

void RewardMappingTools::readFromStream ( std::istream &  in,
ProbabilisticRewardMapping rewards 
)
static

◆ writeToStream()

void RewardMappingTools::writeToStream ( const ProbabilisticRewardMapping rewards,
const AlignmentDataInterface sites,
std::ostream &  out 
)
static

Write the reward vectors to a stream.

Parameters
rewardsThe reward vectors to write.
sitesThe dataset associated to the vectors (needed to know the position of each site in the dataset).
outThe output stream where to write the vectors.
Exceptions
IOExceptionIf an output error happens.

Definition at line 245 of file RewardMappingTools.cpp.

References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), bpp::CoreSiteInterface::getCoordinate(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdgeIndex(), bpp::AbstractMapping::getNumberOfSites(), bpp::ProbabilisticRewardMapping::getSiteIndex(), and bpp::TemplateAlignmentDataInterface< class >::site().


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