bpp-phyl3
3.0.0
|
discrete Rate Across Sites, (simple) Recursive likelihood data structure. More...
#include <Bpp/Phyl/Legacy/Likelihood/DRASRTreeLikelihoodData.h>
Public Member Functions | |
DRASRTreeLikelihoodData (std::shared_ptr< const TreeTemplate< Node >> tree, size_t nbClasses, bool usePatterns=true) | |
DRASRTreeLikelihoodData (const DRASRTreeLikelihoodData &data) | |
DRASRTreeLikelihoodData & | operator= (const DRASRTreeLikelihoodData &data) |
virtual | ~DRASRTreeLikelihoodData () |
DRASRTreeLikelihoodData * | clone () const |
void | setTree (std::shared_ptr< const TreeTemplate< Node >> tree) |
Set the tree associated to the data. More... | |
DRASRTreeLikelihoodNodeData & | getNodeData (int nodeId) |
const DRASRTreeLikelihoodNodeData & | getNodeData (int nodeId) const |
size_t | getArrayPosition (int parentId, int sonId, size_t currentPosition) const |
size_t | getRootArrayPosition (size_t currentPosition) const |
const std::vector< size_t > & | getArrayPositions (int parentId, int sonId) const |
std::vector< size_t > & | getArrayPositions (int parentId, int sonId) |
size_t | getArrayPosition (int parentId, int sonId, size_t currentPosition) |
VVVdouble & | getLikelihoodArray (int nodeId) |
VVVdouble & | getDLikelihoodArray (int nodeId) |
VVVdouble & | getD2LikelihoodArray (int nodeId) |
size_t | getNumberOfDistinctSites () const |
size_t | getNumberOfSites () const |
size_t | getNumberOfStates () const |
size_t | getNumberOfClasses () const |
void | initLikelihoods (const AlignmentDataInterface &sites, const TransitionModelInterface &model) |
std::vector< size_t > & | getRootArrayPositions () |
const std::vector< size_t > & | getRootArrayPositions () const |
unsigned int | getWeight (size_t pos) const |
const std::vector< unsigned int > & | getWeights () const |
std::shared_ptr< const Alphabet > | getAlphabet () const |
std::shared_ptr< const TreeTemplate< Node > > | getTree () const |
Protected Member Functions | |
virtual void | initLikelihoods (const Node *node, const AlignmentDataInterface &sequences, const TransitionModelInterface &model) |
This method initializes the leaves according to a sequence file. likelihood is set to 1 for the state corresponding to the sequence site, otherwise it is set to 0. More... | |
virtual std::unique_ptr< SitePatterns > | initLikelihoodsWithPatterns (const Node *node, const AlignmentDataInterface &sequences, const TransitionModelInterface &model) |
This method initializes the leaves according to a sequence file. More... | |
Protected Attributes | |
std::vector< size_t > | rootPatternLinks_ |
Links between sites and patterns. More... | |
std::vector< unsigned int > | rootWeights_ |
The frequency of each site. More... | |
std::shared_ptr< const TreeTemplate< Node > > | tree_ |
std::shared_ptr< const Alphabet > | alphabet_ |
Private Attributes | |
std::map< int, DRASRTreeLikelihoodNodeData > | nodeData_ |
This contains all likelihood values used for computation. More... | |
std::map< int, std::map< int, std::vector< size_t > > > | patternLinks_ |
This map defines the pattern network. More... | |
std::shared_ptr< AlignmentDataInterface > | shrunkData_ |
size_t | nbSites_ |
size_t | nbStates_ |
size_t | nbClasses_ |
size_t | nbDistinctSites_ |
bool | usePatterns_ |
discrete Rate Across Sites, (simple) Recursive likelihood data structure.
Definition at line 86 of file DRASRTreeLikelihoodData.h.
|
inline |
Definition at line 116 of file DRASRTreeLikelihoodData.h.
Referenced by clone().
|
inline |
Definition at line 122 of file DRASRTreeLikelihoodData.h.
References shrunkData_.
|
inlinevirtual |
Definition at line 152 of file DRASRTreeLikelihoodData.h.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 154 of file DRASRTreeLikelihoodData.h.
References DRASRTreeLikelihoodData().
Referenced by bpp::RHomogeneousTreeLikelihood::operator=(), and bpp::RHomogeneousTreeLikelihood::RHomogeneousTreeLikelihood().
|
inlinevirtualinherited |
Implements bpp::TreeLikelihoodData.
Definition at line 100 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::alphabet_.
|
inline |
Definition at line 200 of file DRASRTreeLikelihoodData.h.
References patternLinks_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 184 of file DRASRTreeLikelihoodData.h.
References patternLinks_.
|
inline |
Definition at line 196 of file DRASRTreeLikelihoodData.h.
References patternLinks_.
|
inline |
Definition at line 192 of file DRASRTreeLikelihoodData.h.
References patternLinks_.
Referenced by bpp::RHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::RHomogeneousTreeLikelihood::computeSubtreeLikelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeD2Likelihood(), and bpp::RHomogeneousTreeLikelihood::computeTreeDLikelihood().
|
inline |
Definition at line 215 of file DRASRTreeLikelihoodData.h.
References nodeData_.
Referenced by bpp::RHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeD2Likelihood(), and bpp::RHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass().
|
inline |
Definition at line 210 of file DRASRTreeLikelihoodData.h.
References nodeData_.
Referenced by bpp::RHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeDLikelihood(), and bpp::RHomogeneousTreeLikelihood::getDLikelihoodForASiteForARateClass().
|
inline |
Definition at line 205 of file DRASRTreeLikelihoodData.h.
References nodeData_.
Referenced by bpp::RHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::RHomogeneousTreeLikelihood::computeSubtreeLikelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeDLikelihood(), bpp::RHomogeneousTreeLikelihood::displayLikelihood(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClassForAState(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClass(), and bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState().
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 176 of file DRASRTreeLikelihoodData.h.
References nodeData_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 180 of file DRASRTreeLikelihoodData.h.
References nodeData_.
|
inline |
Definition at line 223 of file DRASRTreeLikelihoodData.h.
References nbClasses_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 220 of file DRASRTreeLikelihoodData.h.
References nbDistinctSites_.
Referenced by bpp::RHomogeneousTreeLikelihood::setData().
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 221 of file DRASRTreeLikelihoodData.h.
References nbSites_.
Referenced by bpp::RHomogeneousTreeLikelihood::setData().
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 222 of file DRASRTreeLikelihoodData.h.
References nbStates_.
Referenced by bpp::RHomogeneousTreeLikelihood::setData().
|
inlinevirtual |
Reimplemented from bpp::AbstractTreeLikelihoodData.
Definition at line 188 of file DRASRTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootPatternLinks_.
Referenced by bpp::RHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getDLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClassForAState(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState(), and bpp::RHomogeneousTreeLikelihood::getSiteIndex().
|
inlineinherited |
Definition at line 85 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootPatternLinks_.
|
inlineinherited |
Definition at line 86 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootPatternLinks_.
|
inlinevirtualinherited |
Implements bpp::TreeLikelihoodData.
Definition at line 102 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::tree_.
|
inlinevirtualinherited |
Implements bpp::TreeLikelihoodData.
Definition at line 91 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootWeights_.
Referenced by bpp::DRTreeLikelihoodTools::getPosteriorStateFrequencies().
|
inlinevirtualinherited |
Implements bpp::TreeLikelihoodData.
Definition at line 95 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootWeights_.
void DRASRTreeLikelihoodData::initLikelihoods | ( | const AlignmentDataInterface & | sites, |
const TransitionModelInterface & | model | ||
) |
Definition at line 19 of file DRASRTreeLikelihoodData.cpp.
References bpp::BranchModelInterface::getAlphabet(), bpp::TemplateAlignmentDataInterface< class >::getAlphabet(), bpp::TemplateAlignmentDataInterface< class >::getNumberOfSequences(), bpp::TemplateAlignmentDataInterface< class >::getNumberOfSites(), and bpp::BranchModelInterface::getNumberOfStates().
Referenced by bpp::RHomogeneousTreeLikelihood::setData().
|
protectedvirtual |
This method initializes the leaves according to a sequence file. likelihood is set to 1 for the state corresponding to the sequence site, otherwise it is set to 0.
All likelihood arrays at each nodes are initialized according to alphabet size and sequences length, and filled with 1.
NB: This method is recursive.
node | The node defining the subtree to analyse. |
sequences | The data to be used for initialization. |
model | The model to use. |
Definition at line 60 of file DRASRTreeLikelihoodData.cpp.
References bpp::BranchModelInterface::getAlphabetStateAsInt(), bpp::DRASRTreeLikelihoodNodeData::getD2LikelihoodArray(), bpp::DRASRTreeLikelihoodNodeData::getDLikelihoodArray(), bpp::Node::getId(), bpp::DRASRTreeLikelihoodNodeData::getLikelihoodArray(), bpp::Node::getName(), bpp::Node::getNumberOfSons(), bpp::TemplateAlignmentDataInterface< class >::getSequencePosition(), bpp::TemplateAlignmentDataInterface< class >::getStateValueAt(), bpp::Node::isLeaf(), and bpp::DRASRTreeLikelihoodNodeData::setNode().
|
protectedvirtual |
This method initializes the leaves according to a sequence file.
likelihood is set to 1 for the state corresponding to the sequence site, otherwise it is set to 0.
All likelihood arrays at each nodes are initialized according to alphabet size and sequences length, and filled with 1.
NB: This method is recursive.
node | The node defining the subtree to analyse. |
sequences | The data to be used for initialization. |
model | The model to use. |
Definition at line 159 of file DRASRTreeLikelihoodData.cpp.
References bpp::BranchModelInterface::getAlphabetStateAsInt(), bpp::DRASRTreeLikelihoodNodeData::getD2LikelihoodArray(), bpp::DRASRTreeLikelihoodNodeData::getDLikelihoodArray(), bpp::Node::getId(), bpp::TreeTemplateTools::getLeaves(), bpp::DRASRTreeLikelihoodNodeData::getLikelihoodArray(), bpp::Node::getName(), bpp::Node::getNumberOfSons(), bpp::PatternTools::getSequenceSubset(), bpp::Node::isLeaf(), and bpp::DRASRTreeLikelihoodNodeData::setNode().
|
inline |
Definition at line 135 of file DRASRTreeLikelihoodData.h.
References nbClasses_, nbDistinctSites_, nbSites_, nbStates_, nodeData_, bpp::AbstractTreeLikelihoodData::operator=(), patternLinks_, shrunkData_, and usePatterns_.
|
inline |
Set the tree associated to the data.
All node data will be actualized accordingly by calling the setNode() method on the corresponding nodes.
tree | The tree to be associated to this data. |
Definition at line 166 of file DRASRTreeLikelihoodData.h.
References nodeData_, and bpp::AbstractTreeLikelihoodData::tree_.
Referenced by bpp::RHomogeneousTreeLikelihood::operator=(), and bpp::RHomogeneousTreeLikelihood::RHomogeneousTreeLikelihood().
|
protectedinherited |
Definition at line 59 of file AbstractTreeLikelihoodData.h.
Referenced by bpp::AbstractTreeLikelihoodData::getAlphabet(), and bpp::AbstractTreeLikelihoodData::operator=().
|
private |
Definition at line 111 of file DRASRTreeLikelihoodData.h.
Referenced by getNumberOfClasses(), and operator=().
|
private |
Definition at line 112 of file DRASRTreeLikelihoodData.h.
Referenced by getNumberOfDistinctSites(), and operator=().
|
private |
Definition at line 109 of file DRASRTreeLikelihoodData.h.
Referenced by getNumberOfSites(), and operator=().
|
private |
Definition at line 110 of file DRASRTreeLikelihoodData.h.
Referenced by getNumberOfStates(), and operator=().
|
mutableprivate |
This contains all likelihood values used for computation.
Definition at line 93 of file DRASRTreeLikelihoodData.h.
Referenced by getD2LikelihoodArray(), getDLikelihoodArray(), getLikelihoodArray(), getNodeData(), operator=(), and setTree().
|
mutableprivate |
This map defines the pattern network.
Let n1 be the id of a node in the tree, and n11 and n12 the ids of its sons. Providing the likelihood array is known for nodes n11 and n12, the likelihood array for node n1 and site i (likelihood[n1][i]) must be computed using arrays patternLinks[n1][n11][i] and patternLinks_[n1][n12][i]. This network is initialized once for all in the constructor of this class.
The double map contains the position of the site to use (second dimension) of the likelihoods array.
Definition at line 107 of file DRASRTreeLikelihoodData.h.
Referenced by getArrayPosition(), getArrayPositions(), and operator=().
|
protectedinherited |
Links between sites and patterns.
The size of this vector is equal to the number of sites in the container, each element corresponds to a site in the container and points to the corresponding column in the likelihood array of the root node. If the container contains no repeated site, there will be a strict equivalence between each site and the likelihood array of the root node. However, if this is not the case, some pointers may point toward the same element in the likelihood array.
Definition at line 50 of file AbstractTreeLikelihoodData.h.
Referenced by bpp::AbstractTreeLikelihoodData::getRootArrayPosition(), getRootArrayPosition(), bpp::AbstractTreeLikelihoodData::getRootArrayPositions(), and bpp::AbstractTreeLikelihoodData::operator=().
|
protectedinherited |
The frequency of each site.
Definition at line 55 of file AbstractTreeLikelihoodData.h.
Referenced by bpp::AbstractTreeLikelihoodData::getWeight(), bpp::AbstractTreeLikelihoodData::getWeights(), and bpp::AbstractTreeLikelihoodData::operator=().
|
private |
Definition at line 108 of file DRASRTreeLikelihoodData.h.
Referenced by DRASRTreeLikelihoodData(), and operator=().
|
protectedinherited |
Definition at line 57 of file AbstractTreeLikelihoodData.h.
Referenced by bpp::AbstractTreeLikelihoodData::getTree(), bpp::AbstractTreeLikelihoodData::operator=(), bpp::DRASDRTreeLikelihoodData::setTree(), and setTree().
|
private |
Definition at line 113 of file DRASRTreeLikelihoodData.h.
Referenced by operator=().