bpp-phyl3
3.0.0
|
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< ProbabilisticRewardMapping > | computeRewardVectors (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... | |
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.
Definition at line 28 of file RewardMappingTools.h.
|
inline |
Definition at line 31 of file RewardMappingTools.h.
|
inlinevirtual |
Definition at line 32 of file RewardMappingTools.h.
|
static |
Compute the reward vectors for a particular dataset using the double-recursive likelihood computation.
rltc | A LikelihoodCalculationSingleProcess object. |
edgeIds | The Ids of the nodes the reward vectors are computed on. |
reward | The Reward to use. |
unresolvedOption | Describes how unresolved are managed (see above). |
verbose | Print info to screen. |
Exception | If 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().
|
static |
Sum all rewards of a given branch (specified by its index).
smap | The reward map to use. |
branchIndex | The index of the reward vector for which the counts should be computed. |
Definition at line 324 of file RewardMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdge(), bpp::AbstractMapping::getNumberOfSites(), and bpp::ProbabilisticRewardMapping::getSiteIndex().
|
static |
Sum all rewards on a given site (specified by its index).
smap | The substitution map to use. |
siteIndex | The index of the substitution vector for which the counts should be computed. |
Definition at line 339 of file RewardMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), and bpp::ProbabilisticRewardMapping::getSiteIndex().
|
static |
Read the reward vectors from a stream.
in | The input stream where to read the vectors. |
rewards | The mapping object to fill. |
IOException | If an input error happens. |
Definition at line 279 of file RewardMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdgeIndex(), bpp::DataTable::read(), bpp::ProbabilisticRewardMapping::setNumberOfSites(), bpp::AbstractMapping::setSitePosition(), bpp::TextTools::toDouble(), and bpp::Exception::what().
|
static |
Write the reward vectors to a stream.
rewards | The reward vectors to write. |
sites | The dataset associated to the vectors (needed to know the position of each site in the dataset). |
out | The output stream where to write the vectors. |
IOException | If 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().