bpp-phyl
2.2.0
|
Likelihood ancestral states reconstruction: marginal method. More...
#include <Bpp/Phyl/Likelihood/MarginalAncestralStateReconstruction.h>
Public Member Functions | |
MarginalAncestralStateReconstruction (const DRTreeLikelihood *drl) | |
MarginalAncestralStateReconstruction (const MarginalAncestralStateReconstruction &masr) | |
MarginalAncestralStateReconstruction & | operator= (const MarginalAncestralStateReconstruction &masr) |
MarginalAncestralStateReconstruction * | clone () const |
virtual | ~MarginalAncestralStateReconstruction () |
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 |
Get ancestral states for a given node as a vector of int. More... | |
std::map< int, std::vector< size_t > > | getAllAncestralStates () const |
Get all ancestral states for all nodes. More... | |
Sequence * | getAncestralSequenceForNode (int nodeId, VVdouble *probs, bool sample) const |
Get the ancestral sequence for a given node. More... | |
Sequence * | getAncestralSequenceForNode (int nodeId) const |
Get the ancestral sequence for a given node. More... | |
AlignedSequenceContainer * | getAncestralSequences () const |
Get all the ancestral sequences for all nodes. More... | |
AlignedSequenceContainer * | 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 | |
const DRTreeLikelihood * | likelihood_ |
TreeTemplate< Node > | tree_ |
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 63 of file MarginalAncestralStateReconstruction.h.
|
inline |
Definition at line 79 of file MarginalAncestralStateReconstruction.h.
Referenced by clone().
|
inline |
Definition at line 92 of file MarginalAncestralStateReconstruction.h.
|
inlinevirtual |
Definition at line 128 of file MarginalAncestralStateReconstruction.h.
|
inline |
Definition at line 126 of file MarginalAncestralStateReconstruction.h.
References MarginalAncestralStateReconstruction().
|
virtual |
Get all ancestral states for all nodes.
Call the getAncestralSequenceForNode() method on each node in the tree.
Implements bpp::AncestralStateReconstruction.
Definition at line 104 of file MarginalAncestralStateReconstruction.cpp.
Referenced by bpp::SubstitutionMappingTools::computeSubstitutionVectorsNoAveragingMarginal().
Sequence * MarginalAncestralStateReconstruction::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 114 of file MarginalAncestralStateReconstruction.cpp.
References bpp::SubstitutionModel::getAlphabetStateAsInt().
Referenced by getAncestralSequenceForNode().
|
inlinevirtual |
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 170 of file MarginalAncestralStateReconstruction.h.
References getAncestralSequenceForNode().
|
inlinevirtual |
Get all the ancestral sequences for all nodes.
Implements bpp::AncestralStateReconstruction.
Definition at line 175 of file MarginalAncestralStateReconstruction.h.
AlignedSequenceContainer * MarginalAncestralStateReconstruction::getAncestralSequences | ( | bool | sample | ) | const |
Definition at line 172 of file MarginalAncestralStateReconstruction.cpp.
vector< size_t > MarginalAncestralStateReconstruction::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 47 of file MarginalAncestralStateReconstruction.cpp.
Referenced by getAncestralStatesForNode().
|
inlinevirtual |
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 149 of file MarginalAncestralStateReconstruction.h.
References getAncestralStatesForNode(), and nbSites_.
|
inline |
Definition at line 105 of file MarginalAncestralStateReconstruction.h.
References alphabet_, l_, likelihood_, nbClasses_, nbDistinctSites_, nbSites_, nbStates_, r_, rootPatternLinks_, and tree_.
|
private |
Definition at line 143 of file MarginalAncestralStateReconstruction.cpp.
References bpp::Node::getId(), bpp::SubstitutionModel::getModelStates(), bpp::Node::getName(), bpp::Node::getNumberOfSons(), bpp::Node::getSon(), and bpp::Node::isLeaf().
|
private |
Definition at line 69 of file MarginalAncestralStateReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 76 of file MarginalAncestralStateReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 67 of file MarginalAncestralStateReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 72 of file MarginalAncestralStateReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 71 of file MarginalAncestralStateReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 70 of file MarginalAncestralStateReconstruction.h.
Referenced by getAncestralStatesForNode(), and operator=().
|
private |
Definition at line 73 of file MarginalAncestralStateReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 75 of file MarginalAncestralStateReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 74 of file MarginalAncestralStateReconstruction.h.
Referenced by operator=().
|
private |
Definition at line 68 of file MarginalAncestralStateReconstruction.h.
Referenced by operator=().