bpp-phyl3
3.0.0
|
Likelihood ancestral states reconstruction: marginal method. More...
#include <Bpp/Phyl/Likelihood/MarginalAncestralReconstruction.h>
Public Member Functions | |
MarginalAncestralReconstruction (std::shared_ptr< LikelihoodCalculationSingleProcess > drl) | |
MarginalAncestralReconstruction (const MarginalAncestralReconstruction &masr) | |
MarginalAncestralReconstruction & | operator= (const MarginalAncestralReconstruction &masr) |
MarginalAncestralReconstruction * | clone () const |
virtual | ~MarginalAncestralReconstruction () |
std::shared_ptr< const Alphabet > | getAlphabet () const |
std::vector< size_t > | getAncestralStatesForNode (uint nodeId, VVdouble &probs, bool sample) const |
Get ancestral states for a given node as a vector of int. More... | |
std::vector< size_t > | getAncestralStatesForNode (uint nodeId) const override |
Get ancestral states for a given node as a vector of int. More... | |
std::map< uint, std::vector< size_t > > | getAllAncestralStates () const override |
Get all ancestral states for all nodes. More... | |
std::unique_ptr< Sequence > | getAncestralSequenceForNode (uint nodeId, VVdouble *probs, bool sample) const |
Get an ancestral sequence for a given node. More... | |
std::unique_ptr< Sequence > | getAncestralSequenceForNode (uint nodeId) const override |
Get the ancestral sequence for a given node. More... | |
std::unique_ptr< AlignedSequenceContainer > | getAncestralSequences () const override |
Get all the ancestral sequences for all nodes. More... | |
std::unique_ptr< AlignedSequenceContainer > | getAncestralSequences (bool sample) const |
Private Member Functions | |
void | recursiveMarginalAncestralStates (const std::shared_ptr< PhyloNode > node, std::map< uint, std::vector< size_t >> &ancestors, AlignmentDataInterface &data) const |
Private Attributes | |
std::shared_ptr< LikelihoodCalculationSingleProcess > | likelihood_ |
std::shared_ptr< const ParametrizablePhyloTree > | tree_ |
std::shared_ptr< const Alphabet > | alphabet_ |
size_t | nbSites_ |
size_t | nbDistinctSites_ |
size_t | nbStates_ |
PatternType | rootPatternLinks_ |
Likelihood ancestral states reconstruction: marginal method.
Reference: Z Yang, S Kumar and M Nei (1995), Genetics 141(4) 1641-50.
Definition at line 29 of file MarginalAncestralReconstruction.h.
|
inline |
Definition at line 43 of file MarginalAncestralReconstruction.h.
References tree_.
Referenced by clone().
|
inline |
Definition at line 56 of file MarginalAncestralReconstruction.h.
|
inlinevirtual |
Definition at line 81 of file MarginalAncestralReconstruction.h.
|
inline |
Definition at line 79 of file MarginalAncestralReconstruction.h.
References MarginalAncestralReconstruction().
|
overridevirtual |
Get all ancestral states for all nodes.
Call the getAncestralSequenceForNode() method on each node in the tree.
Implements bpp::AncestralStateReconstruction.
Definition at line 55 of file MarginalAncestralReconstruction.cpp.
|
inline |
Definition at line 84 of file MarginalAncestralReconstruction.h.
References alphabet_.
|
inlineoverridevirtual |
Get the ancestral sequence for a given node.
nodeId | The id of the node at which the sequence must be reconstructed. |
Implements bpp::AncestralStateReconstruction.
Definition at line 138 of file MarginalAncestralReconstruction.h.
References getAncestralSequenceForNode().
unique_ptr< Sequence > MarginalAncestralReconstruction::getAncestralSequenceForNode | ( | uint | nodeId, |
VVdouble * | probs, | ||
bool | sample | ||
) | const |
Get an ancestral sequence for a given node.
The name of the sequence will be the name of the node if there is one, its id otherwise. A new sequence object is created, whose destruction is up to the user.
nodeId | The id of the node at which the sequence must be reconstructed. |
probs | A pointer toward a vector to be filled with the probability for each state at each site (set to NULL if you don't want these probabilities). |
sample | Tell if the sequence should be sample from the posterior distribution instead of taking the one with maximum probability. |
Definition at line 64 of file MarginalAncestralReconstruction.cpp.
References bpp::TextTools::toString().
Referenced by getAncestralSequenceForNode().
|
inlineoverridevirtual |
Get all the ancestral sequences for all nodes.
Implements bpp::AncestralStateReconstruction.
Definition at line 143 of file MarginalAncestralReconstruction.h.
unique_ptr< AlignedSequenceContainer > MarginalAncestralReconstruction::getAncestralSequences | ( | bool | sample | ) | const |
Definition at line 132 of file MarginalAncestralReconstruction.cpp.
|
inlineoverridevirtual |
Get ancestral states for a given node as a vector of int.
The size of the vector depends on the implementation. This method is mainly for efficient internal use in other classes. Consider using the getAncestralSequenceForNode() method for a more general output.
nodeId | the id of the node at which the states must be reconstructed. |
Implements bpp::AncestralStateReconstruction.
Definition at line 111 of file MarginalAncestralReconstruction.h.
References getAncestralStatesForNode(), and nbSites_.
vector< size_t > MarginalAncestralReconstruction::getAncestralStatesForNode | ( | uint | nodeId, |
VVdouble & | probs, | ||
bool | sample | ||
) | const |
Get ancestral states for a given node as a vector of int.
The size of the vector is the total number of sites in the container associated to the likelihood object. This method is mainly for efficient internal use in other classes. Consider using the getAncestralSequenceForNode() method for a more general output.
nodeId | The id of the node at which the states must be reconstructed [in]. |
probs | A vector to be filled with the probability for each state at each position (will be the same size as the returned vector for states) [out]. |
sample | Tell if the sequence should be sampled from the posterior distribution instead of taking the one with maximum probability. |
Definition at line 13 of file MarginalAncestralReconstruction.cpp.
References bpp::copyEigenToBpp(), and bpp::RandomTools::giveRandomNumberBetweenZeroAndEntry().
Referenced by getAncestralStatesForNode().
|
inline |
Definition at line 66 of file MarginalAncestralReconstruction.h.
References alphabet_, likelihood_, nbDistinctSites_, nbSites_, nbStates_, rootPatternLinks_, and tree_.
|
private |
Definition at line 93 of file MarginalAncestralReconstruction.cpp.
References bpp::Sequence::size().
|
mutableprivate |
Definition at line 35 of file MarginalAncestralReconstruction.h.
Referenced by getAlphabet(), and operator=().
|
private |
Definition at line 33 of file MarginalAncestralReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 37 of file MarginalAncestralReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 36 of file MarginalAncestralReconstruction.h.
Referenced by getAncestralStatesForNode(), and operator=().
|
private |
Definition at line 39 of file MarginalAncestralReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 40 of file MarginalAncestralReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 34 of file MarginalAncestralReconstruction.h.
Referenced by MarginalAncestralReconstruction(), and operator=().