bpp-phyl3
3.0.0
|
Provide methods to compute reward mappings. More...
#include <Bpp/Phyl/Legacy/Mapping/RewardMappingTools.h>
Public Member Functions | |
LegacyRewardMappingTools () | |
virtual | ~LegacyRewardMappingTools () |
Static Public Member Functions | |
static std::unique_ptr< LegacyProbabilisticRewardMapping > | computeRewardVectors (std::shared_ptr< const DRTreeLikelihoodInterface > drtl, const std::vector< int > &nodeIds, std::shared_ptr< Reward > reward, bool verbose=true) |
Compute the reward vectors for a particular dataset using the double-recursive likelihood computation. More... | |
static void | writeToStream (const LegacyProbabilisticRewardMapping &rewards, const SiteContainerInterface &sites, std::ostream &out) |
Write the reward vectors to a stream. More... | |
static void | readFromStream (std::istream &in, LegacyProbabilisticRewardMapping &rewards) |
Read the reward vectors from a stream. More... | |
static double | computeSumForBranch (const LegacyRewardMappingInterface &smap, size_t branchIndex) |
Sum all rewards of a given branch (specified by its index). More... | |
static double | computeSumForSite (const LegacyRewardMappingInterface &smap, size_t siteIndex) |
Sum all substitutions for each type of 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 27 of file RewardMappingTools.h.
|
inline |
Definition at line 30 of file RewardMappingTools.h.
|
inlinevirtual |
Definition at line 31 of file RewardMappingTools.h.
|
static |
Compute the reward vectors for a particular dataset using the double-recursive likelihood computation.
drtl | A DRTreeLikelihood object. |
nodeIds | The Ids of the nodes the reward vectors are computed on. |
reward | The Reward to use. |
verbose | Print info to screen. |
Exception | If the likelihood object is not initialized. |
Definition at line 23 of file RewardMappingTools.cpp.
References bpp::VectorTools::contains(), bpp::ApplicationTools::displayGauge(), bpp::ApplicationTools::displayTask(), bpp::ApplicationTools::displayTaskDone(), bpp::Node::getDistanceToFather(), bpp::Node::getFather(), bpp::Node::getId(), bpp::TreeTemplate< N >::getNodes(), bpp::Node::getNumberOfSons(), bpp::TreeTemplate< N >::getRootId(), bpp::Node::getSon(), bpp::Node::hasFather(), and bpp::ApplicationTools::message.
Referenced by bpp::LegacySubstitutionMappingTools::computeCountsPerSitePerBranchPerType(), bpp::LegacySubstitutionMappingTools::computeCountsPerSitePerType(), and bpp::LegacySubstitutionMappingTools::getNormalizationsPerBranch().
|
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 382 of file RewardMappingTools.cpp.
References bpp::LegacyMappingInterface::getNumberOfSites().
|
static |
Sum all substitutions for each type of 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 395 of file RewardMappingTools.cpp.
References bpp::LegacyMappingInterface::getNumberOfBranches().
|
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 341 of file RewardMappingTools.cpp.
References bpp::LegacyAbstractMapping::getNodeIndex(), bpp::DataTable::read(), bpp::LegacyProbabilisticRewardMapping::setNumberOfSites(), bpp::LegacyAbstractMapping::setSitePosition(), bpp::TextTools::toDouble(), bpp::TextTools::toInt(), 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 313 of file RewardMappingTools.cpp.
References bpp::Site::getCoordinate(), bpp::Node::getDistanceToFather(), bpp::Node::getId(), bpp::LegacyAbstractMapping::getNode(), bpp::LegacyAbstractMapping::getNumberOfBranches(), bpp::LegacyAbstractMapping::getNumberOfSites(), and TemplateSiteContainerInterface< Site, Sequence, std::string >::site().