bpp-phyl3
3.0.0
|
Likelihood ancestral states reconstruction: marginal method. More...
#include <Bpp/Phyl/Legacy/Likelihood/MarginalAncestralStateReconstruction.h>
Public Member Functions | |
LegacyMarginalAncestralStateReconstruction (std::shared_ptr< const DRTreeLikelihoodInterface > drl) | |
LegacyMarginalAncestralStateReconstruction (const LegacyMarginalAncestralStateReconstruction &masr)=default | |
LegacyMarginalAncestralStateReconstruction & | operator= (const LegacyMarginalAncestralStateReconstruction &masr)=default |
LegacyMarginalAncestralStateReconstruction * | clone () const |
virtual | ~LegacyMarginalAncestralStateReconstruction () |
std::vector< size_t > | getAncestralStatesForNode (int nodeId, VVdouble &probs, bool sample) const |
Get ancestral states for a given node as a vector of int. More... | |
std::vector< size_t > | getAncestralStatesForNode (int nodeId) const override |
Get ancestral states for a given node as a vector of int. More... | |
std::map< int, std::vector< size_t > > | getAllAncestralStates () const override |
Get all ancestral states for all nodes. More... | |
std::unique_ptr< Sequence > | getAncestralSequenceForNode (int nodeId, VVdouble *probs, bool sample) const |
Get the ancestral sequence for a given node. More... | |
std::unique_ptr< Sequence > | getAncestralSequenceForNode (int nodeId) const override |
Get the ancestral sequence for a given node. More... | |
std::unique_ptr< SiteContainerInterface > | getAncestralSequences () const override |
Get all the ancestral sequences for all nodes. More... | |
std::unique_ptr< SiteContainerInterface > | getAncestralSequences (bool sample) const |
Private Member Functions | |
void | recursiveMarginalAncestralStates (const Node *node, std::map< int, std::vector< size_t >> &ancestors, AlignedSequenceContainer &data) const |
Private Attributes | |
std::shared_ptr< const DRTreeLikelihoodInterface > | likelihood_ |
TreeTemplate< Node > | tree_ |
std::shared_ptr< const Alphabet > | alphabet_ |
size_t | nbSites_ |
size_t | nbDistinctSites_ |
size_t | nbClasses_ |
size_t | nbStates_ |
std::vector< size_t > | rootPatternLinks_ |
std::vector< double > | r_ |
std::vector< double > | l_ |
Likelihood ancestral states reconstruction: marginal method.
Reference: Z Yang, S Kumar and M Nei (1995), Genetics 141(4) 1641-50.
Definition at line 27 of file MarginalAncestralStateReconstruction.h.
|
inline |
Definition at line 43 of file MarginalAncestralStateReconstruction.h.
Referenced by clone().
|
default |
|
inlinevirtual |
Definition at line 62 of file MarginalAncestralStateReconstruction.h.
|
inline |
Definition at line 60 of file MarginalAncestralStateReconstruction.h.
References LegacyMarginalAncestralStateReconstruction().
|
overridevirtual |
Get all ancestral states for all nodes.
Call the getAncestralSequenceForNode() method on each node in the tree.
Implements bpp::LegacyAncestralStateReconstruction.
Definition at line 69 of file MarginalAncestralStateReconstruction.cpp.
Referenced by bpp::LegacySubstitutionMappingTools::computeSubstitutionVectorsNoAveragingMarginal().
|
inlineoverridevirtual |
Get the ancestral sequence for a given node.
nodeId | The id of the node at which the sequence must be reconstructed. |
Implements bpp::LegacyAncestralStateReconstruction.
Definition at line 103 of file MarginalAncestralStateReconstruction.h.
References getAncestralSequenceForNode().
std::unique_ptr< Sequence > LegacyMarginalAncestralStateReconstruction::getAncestralSequenceForNode | ( | int | nodeId, |
VVdouble * | probs, | ||
bool | sample | ||
) | const |
Get the 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 78 of file MarginalAncestralStateReconstruction.cpp.
References bpp::TextTools::toString().
Referenced by getAncestralSequenceForNode().
|
inlineoverridevirtual |
Get all the ancestral sequences for all nodes.
Implements bpp::LegacyAncestralStateReconstruction.
Definition at line 108 of file MarginalAncestralStateReconstruction.h.
unique_ptr< SiteContainerInterface > LegacyMarginalAncestralStateReconstruction::getAncestralSequences | ( | bool | sample | ) | const |
Definition at line 137 of file MarginalAncestralStateReconstruction.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::LegacyAncestralStateReconstruction.
Definition at line 82 of file MarginalAncestralStateReconstruction.h.
References getAncestralStatesForNode(), and nbSites_.
vector< size_t > LegacyMarginalAncestralStateReconstruction::getAncestralStatesForNode | ( | int | 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 number of distinct 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. |
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). |
sample | Tell if the sequence should be sample from the posterior distribution instead of taking the one with maximum probability. |
Definition at line 12 of file MarginalAncestralStateReconstruction.cpp.
References bpp::RandomTools::giveRandomNumberBetweenZeroAndEntry(), and bpp::VectorTools::whichMax().
Referenced by getAncestralStatesForNode().
|
default |
|
private |
|
private |
Definition at line 33 of file MarginalAncestralStateReconstruction.h.
|
private |
Definition at line 40 of file MarginalAncestralStateReconstruction.h.
|
private |
Definition at line 31 of file MarginalAncestralStateReconstruction.h.
|
private |
Definition at line 36 of file MarginalAncestralStateReconstruction.h.
|
private |
Definition at line 35 of file MarginalAncestralStateReconstruction.h.
|
private |
Definition at line 34 of file MarginalAncestralStateReconstruction.h.
Referenced by getAncestralStatesForNode().
|
private |
Definition at line 37 of file MarginalAncestralStateReconstruction.h.
|
private |
Definition at line 39 of file MarginalAncestralStateReconstruction.h.
|
private |
Definition at line 38 of file MarginalAncestralStateReconstruction.h.
|
private |
Definition at line 32 of file MarginalAncestralStateReconstruction.h.