bpp-phyl3
3.0.0
|
Provide methods to compute substitution mappings. More...
#include <Bpp/Phyl/Mapping/SubstitutionMappingTools.h>
Public Member Functions | |
SubstitutionMappingTools () | |
virtual | ~SubstitutionMappingTools () |
Static Public Member Functions | |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeCounts (LikelihoodCalculationSingleProcess &rltc, SubstitutionCountInterface &substitutionCount, short unresolvedOption=UNRESOLVED_ZERO, double threshold=-1, bool verbose=true) |
Methods to compute mapping Trees. More... | |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeCounts (LikelihoodCalculationSingleProcess &rltc, std::shared_ptr< const SubstitutionRegisterInterface > reg, std::shared_ptr< const AlphabetIndex2 > weights=0, std::shared_ptr< const AlphabetIndex2 > distances=0, short unresolvedOption=UNRESOLVED_ZERO, double threshold=-1, bool verbose=true) |
Compute the substitutions tree for a particular dataset. More... | |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeCounts (LikelihoodCalculationSingleProcess &rltc, const std::vector< uint > &speciesIds, SubstitutionCountInterface &substitutionCount, short unresolvedOption=UNRESOLVED_ZERO, double threshold=-1, bool verbose=true) |
Compute the substitutions tree for a particular dataset. More... | |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeCounts (LikelihoodCalculationSingleProcess &rltc, const std::vector< uint > &edgeIds, std::shared_ptr< const SubstitutionRegisterInterface > reg, std::shared_ptr< const AlphabetIndex2 > weights=0, std::shared_ptr< const AlphabetIndex2 > distances=0, short unresolvedOption=UNRESOLVED_ZERO, double threshold=-1, bool verbose=true) |
Compute the substitutions tree for a particular dataset. More... | |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeNormalizations (LikelihoodCalculationSingleProcess &rltc, const std::vector< uint > &edgeIds, std::shared_ptr< const BranchedModelSet > nullModels, std::shared_ptr< const SubstitutionRegisterInterface > reg, std::shared_ptr< const AlphabetIndex2 > distances=0, short unresolvedOption=UNRESOLVED_ZERO, bool verbose=true) |
Compute the normalizations tree due to the models of "null" process on each branch, for each register. More... | |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeNormalizations (LikelihoodCalculationSingleProcess &rltc, std::shared_ptr< const BranchedModelSet > nullModels, std::shared_ptr< const SubstitutionRegisterInterface > reg, std::shared_ptr< const AlphabetIndex2 > distances=0, short unresolvedOption=UNRESOLVED_ZERO, bool verbose=true) |
Compute the normalizations tree due to the models of "null" process on each branch, for each register. More... | |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeNormalizedCounts (LikelihoodCalculationSingleProcess &rltc, const std::vector< uint > &edgeIds, std::shared_ptr< const BranchedModelSet > nullModels, std::shared_ptr< const SubstitutionRegisterInterface > reg, std::shared_ptr< const AlphabetIndex2 > weights=0, std::shared_ptr< const AlphabetIndex2 > distances=0, bool perTimeUnit=false, uint siteSize=1, short unresolvedOption=SubstitutionMappingTools::UNRESOLVED_ZERO, double threshold=-1, bool verbose=true) |
Compute the substitution counts tree, normalized by the models of "null" process on each branch, for each register. More... | |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeNormalizedCounts (const ProbabilisticSubstitutionMapping &counts, const ProbabilisticSubstitutionMapping &factors, const std::vector< uint > &edgeIds, bool perTimeUnit=false, uint siteSize=1) |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeNormalizedCounts (LikelihoodCalculationSingleProcess &rltc, std::shared_ptr< const BranchedModelSet > nullModels, std::shared_ptr< const SubstitutionRegisterInterface > reg, std::shared_ptr< const AlphabetIndex2 > weights=0, std::shared_ptr< const AlphabetIndex2 > distances=0, bool perTimeUnit=false, uint siteSize=1, short unresolvedOption=SubstitutionMappingTools::UNRESOLVED_ZERO, double threshold=-1, bool verbose=true) |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeNormalizedCounts (const ProbabilisticSubstitutionMapping &counts, const ProbabilisticSubstitutionMapping &factors, bool perTimeUnit, uint siteSize=1) |
static std::unique_ptr< ProbabilisticSubstitutionMapping > | computeOneJumpCounts (LikelihoodCalculationSingleProcess &rltc, bool verbose=true) |
This method computes for each site and for each branch the probability that at least one jump occurred. More... | |
static std::unique_ptr< PhyloTree > | getTreeForType (const ProbabilisticSubstitutionMapping &counts, size_t type) |
Methods to get trees of counts. These methods can use raw or normalized counting trees (ie computed with computeCounts and computeNormalizedCounts methods). More... | |
static std::unique_ptr< PhyloTree > | getTreeForType (const ProbabilisticSubstitutionMapping &counts, const ProbabilisticSubstitutionMapping &factors, size_t type) |
Sum all sites substitutions a given type. More... | |
static VVVdouble | getCountsPerSitePerBranchPerType (const ProbabilisticSubstitutionMapping &counts, const std::vector< uint > &ids=Vuint(0)) |
Methods to get std::vectors of counts. More... | |
static Vdouble | getCountsForSitePerBranch (const ProbabilisticSubstitutionMapping &counts, size_t site) |
Sum all type of substitutions for each branch of a given position. More... | |
static Vdouble | getCountsForSitePerBranch (const ProbabilisticSubstitutionMapping &counts, const ProbabilisticSubstitutionMapping &factors, size_t site) |
static VVdouble | getCountsPerSitePerBranch (const ProbabilisticSubstitutionMapping &counts, const std::vector< uint > &ids=Vuint(0)) |
Sum all type of substitutions for each site for each branch. More... | |
static VVdouble | getCountsPerSitePerBranch (const ProbabilisticSubstitutionMapping &counts, const ProbabilisticSubstitutionMapping &factors, const std::vector< uint > &ids=Vuint(0)) |
static Vdouble | getCountsForBranchPerType (const ProbabilisticSubstitutionMapping &counts, uint branchId) |
Sum all sites substitutions for each type of a given branch. More... | |
static VVdouble | getCountsPerBranchPerType (const ProbabilisticSubstitutionMapping &counts, const std::vector< uint > &ids=Vuint(0)) |
Sum all sites substitutions for each branch for each type. More... | |
static VVdouble | getCountsPerTypePerBranch (const ProbabilisticSubstitutionMapping &counts, const std::vector< uint > &ids=Vuint(0)) |
static VVdouble | computeCountsPerTypePerBranch (LikelihoodCalculationSingleProcess &rltc, const std::vector< uint > &ids, std::shared_ptr< const SubstitutionRegisterInterface > reg, std::shared_ptr< const AlphabetIndex2 > weights=0, std::shared_ptr< const AlphabetIndex2 > distances=0, short unresolvedOption=UNRESOLVED_ZERO, double threshold=-1, bool verbose=true) |
Compute the sum over all branches of the counts per type per branch. More... | |
static Vdouble | getCountsForSitePerType (const ProbabilisticSubstitutionMapping &counts, size_t site, const std::vector< uint > &ids=Vuint(0)) |
Methods that sum on branches need raw mapping trees, or raw mapping trees and normalization trees (ie computed with computeCounts and computeNormalizations). More... | |
static Vdouble | getCountsForSitePerType (const ProbabilisticSubstitutionMapping &counts, const ProbabilisticSubstitutionMapping &factors, size_t site, bool perTimeUnit, uint siteSize=1) |
Sum and normalize all type of substitutions for each type of a given position on all nodes. More... | |
static Vdouble | getCountsForSitePerType (const ProbabilisticSubstitutionMapping &counts, const ProbabilisticSubstitutionMapping &factors, size_t site, const std::vector< uint > &ids, bool perTimeUnit, uint siteSize=1) |
Sum and normalize all type of substitutions for each type of a given position on a set of nodes. More... | |
static VVdouble | getCountsPerSitePerType (const ProbabilisticSubstitutionMapping &counts, const std::vector< uint > &ids=Vuint(0)) |
Sum all type of substitutions for each site for each type. More... | |
static VVdouble | getCountsPerSitePerType (const ProbabilisticSubstitutionMapping &counts, const ProbabilisticSubstitutionMapping &factors, bool perTimeUnit, uint siteSize=1) |
Sum and normalize all type of substitutions for each site for each type on all nodes. More... | |
static VVdouble | getCountsPerSitePerType (const ProbabilisticSubstitutionMapping &counts, const ProbabilisticSubstitutionMapping &factors, const std::vector< uint > &ids, bool perTimeUnit, uint siteSize=1) |
Sum and normalize all type of substitutions for each site for each type on a set of nodes. More... | |
static double | getNormForSite (const ProbabilisticSubstitutionMapping &counts, size_t site) |
Compute the norm of a substitution std::vector for a given position. More... | |
static void | outputPerSitePerBranch (const std::string &filename, const std::vector< uint > &ids, const AlignmentDataInterface &sites, const VVdouble &counts) |
Outputs of counts. More... | |
static void | outputPerSitePerType (const std::string &filename, const SubstitutionRegisterInterface ®, const AlignmentDataInterface &sites, const VVdouble &counts) |
Output Per Site Per Type in SGED format. More... | |
static void | outputPerType (const std::string &filename, const SubstitutionRegisterInterface ®, const AlignmentDataInterface &sites, const VVdouble &counts) |
Output Per Type. More... | |
static void | outputPerSitePerBranchPerType (const std::string &filenamePrefix, const std::vector< uint > &ids, const SubstitutionRegisterInterface ®, const AlignmentDataInterface &sites, const VVVdouble &counts) |
Output Per Site Per Branch Per Type, one SGED file per type. More... | |
static void | writeToStream (const ProbabilisticSubstitutionMapping &substitutions, const AlignmentDataInterface &sites, size_t type, std::ostream &out) |
Write the substitutions std::vectors to a stream. More... | |
static void | readFromStream (std::istream &in, ProbabilisticSubstitutionMapping &substitutions, size_t type) |
Read the substitutions std::vectors from a stream. More... | |
Static Public Attributes | |
static const short | UNRESOLVED_ZERO = 0 |
Constants describing how unresolved characters are counted: More... | |
static const short | UNRESOLVED_AVERAGE = 2 |
static const short | UNRESOLVED_ONE = 1 |
Provide methods to compute substitution mappings.
For now, only 4 methods are implemented, and provide probabilistic substitution mappings.
See: Dutheil J, Pupko T, Jean-Marie A, Galtier N. A model-based approach for detecting coevolving positions in a molecule. Mol Biol Evol. 2005 Sep;22(9):1919-28. Epub 2005 Jun 8.
Definition at line 32 of file SubstitutionMappingTools.h.
|
inline |
Definition at line 52 of file SubstitutionMappingTools.h.
|
inlinevirtual |
Definition at line 54 of file SubstitutionMappingTools.h.
|
static |
Compute the substitutions tree for a particular dataset.
rltc | A LikelihoodCalculationSingleProcess object. |
edgeIds | The Ids of the nodes the substitutions are counted on. If empty, count substitutions on all nodes. |
reg | The SubstitutionRegister to use. |
weights | Pointer to AlphabetIndex2 for weights for all substitutions (default: null means no weight), |
distances | Pointer to AlphabetIndex2 for distances for all substitutions (default: null means each distance = 1), |
unresolvedOption | Describes how unresolved are managed (see above). |
threshold | value above which counts are considered saturated (default: -1 means no threshold). |
verbose | Print info to screen. |
Definition at line 28 of file SubstitutionMappingTools.cpp.
References bpp::LikelihoodCalculationSingleProcess::getNumberOfDistinctSites(), bpp::LikelihoodCalculationSingleProcess::getRootArrayPositions(), bpp::LikelihoodCalculation::isInitialized(), and bpp::LikelihoodCalculationSingleProcess::substitutionProcess().
|
static |
Compute the substitutions tree for a particular dataset.
rltc | A LikelihoodCalculationSingleProcess object. |
speciesIds | The Species Ids of the edges the substitutions are counted on. |
substitutionCount | The SubstitutionCount to use. |
unresolvedOption | Describes how unresolved are managed (see above). |
threshold | value above which counts are considered saturated (default: -1 means no threshold). |
verbose | Print info to screen. |
Definition at line 57 of file SubstitutionMappingTools.cpp.
References bpp::SubstitutionCountInterface::clone(), bpp::VectorTools::contains(), bpp::numeric::convert(), bpp::numeric::cwise(), bpp::ApplicationTools::displayGauge(), bpp::ApplicationTools::displayTask(), bpp::ApplicationTools::displayTaskDone(), bpp::ApplicationTools::displayWarning(), bpp::LikelihoodCalculationSingleProcess::getBackwardLikelihoodsAtEdgeForClass(), bpp::LikelihoodCalculationSingleProcess::getEdgesIds(), bpp::LikelihoodCalculationSingleProcess::getForwardLikelihoodsAtNodeForClass(), bpp::LikelihoodCalculationSingleProcess::getForwardLikelihoodTree(), bpp::LikelihoodCalculationSingleProcess::getLikelihoodsAtNodeForClass(), bpp::LikelihoodCalculationSingleProcess::getNumberOfDistinctSites(), bpp::SubstitutionCountInterface::getNumberOfSubstitutionTypes(), bpp::ProbabilityDAG::getProbaAtNode(), bpp::LikelihoodCalculationSingleProcess::getRootArrayPositions(), bpp::LikelihoodCalculationSingleProcess::getTreeNode(), bpp::numeric::isinf(), bpp::LikelihoodCalculation::isInitialized(), bpp::ApplicationTools::message, bpp::LikelihoodCalculationSingleProcess::substitutionProcess(), bpp::TextTools::toString(), UNRESOLVED_AVERAGE, UNRESOLVED_ZERO, and bpp::ExtendedFloatEigen< R, C, EigenType >::Zero().
|
inlinestatic |
Compute the substitutions tree for a particular dataset.
rltc | A LikelihoodCalculationSingleProcess object. |
reg | The SubstitutionRegister to use. |
weights | Pointer to AlphabetIndex2 for weights for all substitutions (default: null means no weight), |
distances | Pointer to AlphabetIndex2 for distances for all substitutions (default: null means each distance = 1), |
unresolvedOption | Describes how unresolved are managed (see above). |
threshold | value above which counts are considered saturated (default: -1 means no threshold). |
verbose | Print info to screen. |
Definition at line 103 of file SubstitutionMappingTools.h.
References computeCounts(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), bpp::SubstitutionProcessInterface::parametrizablePhyloTree(), and bpp::LikelihoodCalculationSingleProcess::substitutionProcess().
|
inlinestatic |
Methods to compute mapping Trees.
Compute the substitutions tree for a particular dataset
rltc | A LikelihoodCalculationSingleProcess object. |
substitutionCount | The SubstitutionCount to use. |
unresolvedOption | Describes how unresolved are managed (see above). |
threshold | value above which counts are considered saturated (default: -1 means no threshold). |
verbose | Print info to screen. |
Definition at line 74 of file SubstitutionMappingTools.h.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), bpp::SubstitutionProcessInterface::parametrizablePhyloTree(), and bpp::LikelihoodCalculationSingleProcess::substitutionProcess().
Referenced by computeCounts(), bpp::SingleProcessSubstitutionMapping::computeCounts(), bpp::OneProcessSequenceSubstitutionMapping::computeCounts(), and computeOneJumpCounts().
|
static |
Compute the sum over all branches of the counts per type per branch.
rltc | A LikelihoodCalculationSingleProcess object. |
ids | The vector of numbers of the nodes of the tree |
reg | the Substitution Register If the SubstitutionRegister is a non-stationary CategorySubstitutionRegister, a correction is made. |
weights | Pointer to AlphabetIndex2 for weights for all substitutions (default: null means no weight), |
distances | Pointer to AlphabetIndex2 for distances for all substitutions (default: null means each distance = 1), |
unresolvedOption | Describes how unresolved are managed (see above). |
threshold | value above which counts are considered saturated (default: -1 means no threshold). |
verbose | Display progress messages. |
Definition at line 975 of file SubstitutionMappingTools.cpp.
References bpp::VectorTools::sum().
|
static |
Compute the normalizations tree due to the models of "null" process on each branch, for each register.
rltc | A LikelihoodCalculationSingleProcess object. |
edgeIds | The Ids of the nodes the substitutions are counted on. If empty, count substitutions on all nodes. |
nullModels | The "null" models used for normalization |
reg | the Substitution Register |
distances | Pointer to AlphabetIndex2 for distances for all substitutions (default: null means each distance = 1), |
unresolvedOption | Describes how unresolved are managed (see above). |
verbose | Display progress messages. |
Definition at line 320 of file SubstitutionMappingTools.cpp.
References 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::LikelihoodCalculationSingleProcess::getNumberOfDistinctSites(), bpp::ProbabilityDAG::getProbaAtNode(), bpp::LikelihoodCalculationSingleProcess::getRootArrayPositions(), bpp::LikelihoodCalculationSingleProcess::getTreeNode(), bpp::LikelihoodCalculation::isInitialized(), bpp::ApplicationTools::message, bpp::LikelihoodCalculationSingleProcess::substitutionProcess(), bpp::TextTools::toString(), UNRESOLVED_AVERAGE, UNRESOLVED_ZERO, and bpp::ExtendedFloatEigen< R, C, EigenType >::Zero().
Referenced by bpp::SingleProcessSubstitutionMapping::computeNormalizations(), bpp::OneProcessSequenceSubstitutionMapping::computeNormalizations(), and computeNormalizations().
|
inlinestatic |
Compute the normalizations tree due to the models of "null" process on each branch, for each register.
rltc | A LikelihoodCalculationSingleProcess object. |
nullModels | The "null" models used for normalization |
reg | the Substitution Register |
distances | Pointer to AlphabetIndex2 for distances for all substitutions (default: null means each distance = 1), |
unresolvedOption | Describes how unresolved are managed (see above). |
verbose | Display progress messages. |
Definition at line 211 of file SubstitutionMappingTools.h.
References computeNormalizations(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), bpp::SubstitutionProcessInterface::parametrizablePhyloTree(), and bpp::LikelihoodCalculationSingleProcess::substitutionProcess().
|
inlinestatic |
Definition at line 290 of file SubstitutionMappingTools.h.
References computeNormalizedCounts(), and bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes().
|
static |
Definition at line 650 of file SubstitutionMappingTools.cpp.
References bpp::ProbabilisticSubstitutionMapping::clone(), bpp::VectorTools::contains(), bpp::VectorTools::fill(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdge(), bpp::ProbabilisticSubstitutionMapping::getNumberOfDistinctSites(), and bpp::AbstractSubstitutionMapping::getNumberOfSubstitutionTypes().
|
static |
Compute the substitution counts tree, normalized by the models of "null" process on each branch, for each register.
rltc | A LikelihoodCalculationSingleProcess object. |
edgeIds | The Ids of the nodes the substitutions are counted on. If empty, count substitutions on all nodes. |
nullModels | The "null" models used for normalization |
reg | the Substitution Register |
weights | Pointer to AlphabetIndex2 for weights for all substitutions (default: null means no weight), |
distances | Pointer to AlphabetIndex2 for distances for all substitutions (default: null means each distance = 1), |
perTimeUnit | If true, normalized counts are per unit of time (otherwise they are multiplied by the length of the branches) (default: false). |
siteSize | The length of a site, as considered as a counting unit (default = 1) |
unresolvedOption | Describes how unresolved are managed (see above). |
threshold | value above which non-normalized counts are considered saturated (default: -1 means no threshold). |
verbose | Display progress messages. |
Definition at line 630 of file SubstitutionMappingTools.cpp.
Referenced by computeNormalizedCounts().
|
inlinestatic |
Definition at line 274 of file SubstitutionMappingTools.h.
References computeNormalizedCounts(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), bpp::SubstitutionProcessInterface::parametrizablePhyloTree(), and bpp::LikelihoodCalculationSingleProcess::substitutionProcess().
|
inlinestatic |
This method computes for each site and for each branch the probability that at least one jump occurred.
Here 'jump' refer to a change in the model state. Depending on the model, this might not be the same as a substitution (an alphabet state change).
Definition at line 309 of file SubstitutionMappingTools.h.
References computeCounts(), and bpp::LikelihoodCalculationSingleProcess::getStateMap().
|
static |
Sum all sites substitutions for each type of a given branch.
counts | The substitution map to use. |
branchId | The id of the branch of the substitution tree for which the counts should be computed. |
Definition at line 908 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdge(), bpp::AbstractMapping::getNumberOfSites(), bpp::AbstractSubstitutionMapping::getNumberOfSubstitutionTypes(), and bpp::ProbabilisticSubstitutionMapping::getSiteIndex().
Referenced by getCountsPerBranchPerType(), and getCountsPerTypePerBranch().
|
static |
Definition at line 830 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdge(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdgeIndex(), bpp::ProbabilisticSubstitutionMapping::getNumberOfBranches(), bpp::ProbabilisticSubstitutionMapping::getSiteIndex(), and bpp::VectorTools::sum().
|
static |
Sum all type of substitutions for each branch of a given position.
counts | The substitution map to use. |
site | The site for which the counts should be computed. |
Definition at line 814 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdgeIndex(), bpp::ProbabilisticSubstitutionMapping::getNumberOfBranches(), bpp::ProbabilisticSubstitutionMapping::getSiteIndex(), and bpp::VectorTools::sum().
Referenced by getCountsPerSitePerBranch().
|
static |
Sum and normalize all type of substitutions for each type of a given position on all nodes.
counts | The substitution map to use. |
factors | The substitution normalization to use. |
site | The site for which the counts should be computed. |
perTimeUnit | If true, normalized counts are per unit of time (otherwise they are multiplied by the length of the branches). |
siteSize | The length of a site, as considered as a counting unit (default = 1) |
Definition at line 1050 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), bpp::AbstractSubstitutionMapping::getNumberOfSubstitutionTypes(), and bpp::ProbabilisticSubstitutionMapping::getSiteIndex().
|
static |
Sum and normalize all type of substitutions for each type of a given position on a set of nodes.
counts | The substitution map to use. |
factors | The substitution normalization to use. |
site | The site for which the counts should be computed. |
ids | The ids of the branches where the the substitutions are counted (default : all ids) |
perTimeUnit | If true, normalized counts are per unit of time (otherwise they are multiplied by the length of the branches). |
siteSize | The length of a site, as considered as a counting unit (default = 1) |
Definition at line 1096 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdge(), bpp::AbstractSubstitutionMapping::getNumberOfSubstitutionTypes(), and bpp::ProbabilisticSubstitutionMapping::getSiteIndex().
|
static |
Methods that sum on branches need raw mapping trees, or raw mapping trees and normalization trees (ie computed with computeCounts and computeNormalizations).
Sum all type of substitutions for each type of a given position.
counts | The substitution map to use. |
site | The site for which the counts should be computed. |
ids | The ids of the branches where the the substitutions are counted (default : all ids) |
Definition at line 1027 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdge(), bpp::AbstractSubstitutionMapping::getNumberOfSubstitutionTypes(), and bpp::ProbabilisticSubstitutionMapping::getSiteIndex().
Referenced by getCountsPerSitePerType().
|
static |
Sum all sites substitutions for each branch for each type.
counts | The substitution map to use. |
ids | The ids of the branches where the the substitutions are counted (default : all ids) |
Definition at line 930 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), and getCountsForBranchPerType().
|
static |
Definition at line 880 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), getCountsForSitePerBranch(), bpp::AbstractMapping::getNumberOfSites(), and bpp::VectorTools::resize2().
|
static |
Sum all type of substitutions for each site for each branch.
counts | The substitution map to use. |
ids | The ids of the branches where the the substitutions are counted (default : all ids) |
Definition at line 855 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), getCountsForSitePerBranch(), bpp::AbstractMapping::getNumberOfSites(), and bpp::VectorTools::resize2().
|
static |
Methods to get std::vectors of counts.
PER BRANCH methods can use raw or normalized counting trees (ie computed with computeCounts and computeNormalizedCounts methods).
Sum all type of substitutions for each site for each branch for each type.
counts | The substitution map to use. |
ids | The ids of the branches where the the substitutions are counted (default : all ids) |
Definition at line 778 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), bpp::AbstractMapping::getNumberOfSites(), bpp::AbstractSubstitutionMapping::getNumberOfSubstitutionTypes(), bpp::ProbabilisticSubstitutionMapping::getSiteIndex(), and bpp::VectorTools::resize3().
|
static |
Sum and normalize all type of substitutions for each site for each type on all nodes.
counts | The substitution map to use. |
factors | The substitution normalization to use. |
perTimeUnit | If true, normalized counts are per unit of time (otherwise they are multiplied by the length of the branches). |
siteSize | The length of a site, as considered as a counting unit (default = 1) |
Definition at line 1145 of file SubstitutionMappingTools.cpp.
References getCountsForSitePerType(), bpp::AbstractMapping::getNumberOfSites(), bpp::AbstractSubstitutionMapping::getNumberOfSubstitutionTypes(), and bpp::VectorTools::resize2().
|
static |
Sum and normalize all type of substitutions for each site for each type on a set of nodes.
counts | The substitution map to use. |
factors | The substitution normalization to use. |
ids | The ids of the branches where the the substitutions are counted (default: all ids) |
perTimeUnit | If true, normalized counts are per unit of time (otherwise they are multiplied by the length of the branches). |
siteSize | The length of a site, as considered as a counting unit (default = 1) |
Definition at line 1185 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), getCountsForSitePerType(), bpp::AbstractMapping::getNumberOfSites(), bpp::AbstractSubstitutionMapping::getNumberOfSubstitutionTypes(), and bpp::VectorTools::resize2().
|
static |
Sum all type of substitutions for each site for each type.
counts | The substitution map to use. |
ids | The ids of the branches where the the substitutions are counted (default: all ids) |
Definition at line 1166 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdgesIndexes(), getCountsForSitePerType(), bpp::AbstractMapping::getNumberOfSites(), bpp::AbstractSubstitutionMapping::getNumberOfSubstitutionTypes(), and bpp::VectorTools::resize2().
|
static |
|
static |
Compute the norm of a substitution std::vector for a given position.
The norm is computed as: , where is the number of substitutions of type t on site i on branch l, obtained using the () operator for the SubstitutionMapping object.
counts | The substitution map to use. |
site | The position for which the norm should be computed. |
Definition at line 1209 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), bpp::AbstractSubstitutionMapping::getNumberOfSubstitutionTypes(), and bpp::ProbabilisticSubstitutionMapping::getSiteIndex().
|
static |
Sum all sites substitutions a given type.
counts | The substitution map to use. |
factors | The substitution normalization to use. |
type | The number of the type |
Definition at line 744 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdge(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdgeIndex(), bpp::AbstractMapping::getNumberOfSites(), and bpp::ProbabilisticSubstitutionMapping::getSiteIndex().
|
static |
Methods to get trees of counts. These methods can use raw or normalized counting trees (ie computed with computeCounts and computeNormalizedCounts methods).
Sum all sites substitutions a given type.
counts | The substitution map to use. |
type | The number of the type |
Definition at line 717 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdgeIndex(), bpp::AbstractMapping::getNumberOfSites(), and bpp::ProbabilisticSubstitutionMapping::getSiteIndex().
|
static |
Outputs of counts.
Output Per Site Per Branch in SGED format.
Definition at line 1235 of file SubstitutionMappingTools.cpp.
References bpp::CoreSiteInterface::getCoordinate(), and bpp::TemplateAlignmentDataInterface< class >::site().
|
static |
Output Per Site Per Branch Per Type, one SGED file per type.
Definition at line 1342 of file SubstitutionMappingTools.cpp.
References bpp::ApplicationTools::displayResult(), bpp::CoreSiteInterface::getCoordinate(), bpp::SubstitutionRegisterInterface::getTypeName(), bpp::TemplateAlignmentDataInterface< class >::site(), and bpp::TextTools::toString().
|
static |
Output Per Site Per Type in SGED format.
Definition at line 1273 of file SubstitutionMappingTools.cpp.
References bpp::CoreSiteInterface::getCoordinate(), bpp::SubstitutionRegisterInterface::getTypeName(), and bpp::TemplateAlignmentDataInterface< class >::site().
|
static |
Output Per Type.
Definition at line 1310 of file SubstitutionMappingTools.cpp.
References bpp::SubstitutionRegisterInterface::getTypeName().
|
static |
Read the substitutions std::vectors from a stream.
in | The input stream where to read the std::vectors. |
substitutions | The mapping object to fill. |
type | The type of substitutions that are read. Should be in supported by the substitution count object associated to the mapping, if any. |
IOException | If an input error happens. |
Definition at line 1432 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdgeIndex(), bpp::DataTable::read(), bpp::ProbabilisticSubstitutionMapping::setNumberOfSites(), bpp::AbstractMapping::setSitePosition(), bpp::TextTools::toDouble(), and bpp::Exception::what().
|
static |
Write the substitutions std::vectors to a stream.
substitutions | The substitutions std::vectors to write. |
sites | The dataset associated to the std::vectors (needed to know the position of each site in the dataset). |
type | The type of substitutions to be output. See SubstitutionCount class. Only one type of substitution can be output at a time. |
out | The output stream where to write the std::vectors. |
IOException | If an output error happens. |
Definition at line 1397 of file SubstitutionMappingTools.cpp.
References bpp::AssociationTreeGraphImplObserver< class, class, class >::allEdgesIterator(), bpp::CoreSiteInterface::getCoordinate(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdgeIndex(), bpp::AbstractMapping::getNumberOfSites(), bpp::ProbabilisticSubstitutionMapping::getSiteIndex(), and bpp::TemplateAlignmentDataInterface< class >::site().
|
static |
Definition at line 48 of file SubstitutionMappingTools.h.
Referenced by computeCounts(), computeNormalizations(), and bpp::RewardMappingTools::computeRewardVectors().
|
static |
Definition at line 49 of file SubstitutionMappingTools.h.
|
static |
Constants describing how unresolved characters are counted:
UNRESOLVED_ZERO: Considered as gaps, so no counted (default). UNRESOLVED_AVERAGE: Considered as unresolved, so all matching states share a uniform probability in conditioned likelihood vector. UNRESOLVED_ONE: Considered as whateverunresolved, so all matching states have probability 1 in conditioned likelihood vector.
Definition at line 47 of file SubstitutionMappingTools.h.
Referenced by computeCounts(), computeNormalizations(), and bpp::RewardMappingTools::computeRewardVectors().