bpp-phyl
2.2.0
|
discrete Rate Across Sites, (simple) Recursive likelihood data structure. More...
#include <Bpp/Phyl/Likelihood/DRASRTreeLikelihoodData.h>
Public Member Functions | |
DRASRTreeLikelihoodData (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 (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 SiteContainer &sites, const SubstitutionModel &model) throw (Exception) |
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 |
const Alphabet * | getAlphabet () const |
const TreeTemplate< Node > * | getTree () const |
Protected Member Functions | |
virtual void | initLikelihoods (const Node *node, const SiteContainer &sequences, const SubstitutionModel &model) throw (Exception) |
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 SitePatterns * | initLikelihoodsWithPatterns (const Node *node, const SiteContainer &sequences, const SubstitutionModel &model) throw (Exception) |
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... | |
const TreeTemplate< Node > * | tree_ |
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... | |
SiteContainer * | 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 128 of file DRASRTreeLikelihoodData.h.
|
inline |
Definition at line 159 of file DRASRTreeLikelihoodData.h.
Referenced by clone().
|
inline |
Definition at line 165 of file DRASRTreeLikelihoodData.h.
References shrunkData_.
|
inlinevirtual |
Definition at line 196 of file DRASRTreeLikelihoodData.h.
References shrunkData_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 198 of file DRASRTreeLikelihoodData.h.
References DRASRTreeLikelihoodData().
Referenced by bpp::RHomogeneousTreeLikelihood::operator=(), bpp::RNonHomogeneousTreeLikelihood::operator=(), bpp::RHomogeneousTreeLikelihood::RHomogeneousTreeLikelihood(), and bpp::RNonHomogeneousTreeLikelihood::RNonHomogeneousTreeLikelihood().
|
inlinevirtualinherited |
Implements bpp::TreeLikelihoodData.
Definition at line 136 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::alphabet_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 228 of file DRASRTreeLikelihoodData.h.
References patternLinks_.
|
inline |
Definition at line 244 of file DRASRTreeLikelihoodData.h.
References patternLinks_.
|
inline |
Definition at line 236 of file DRASRTreeLikelihoodData.h.
References patternLinks_.
Referenced by bpp::RHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeSubtreeLikelihood(), bpp::RHomogeneousTreeLikelihood::computeSubtreeLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeDLikelihood(), and bpp::RHomogeneousTreeLikelihood::computeTreeDLikelihood().
|
inline |
Definition at line 240 of file DRASRTreeLikelihoodData.h.
References patternLinks_.
|
inline |
Definition at line 259 of file DRASRTreeLikelihoodData.h.
References nodeData_.
Referenced by bpp::RHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass(), and bpp::RHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass().
|
inline |
Definition at line 254 of file DRASRTreeLikelihoodData.h.
References nodeData_.
Referenced by bpp::RHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeDLikelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeDLikelihood(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTreeDLikelihood(), bpp::RNonHomogeneousTreeLikelihood::getDLikelihoodForASiteForARateClass(), and bpp::RHomogeneousTreeLikelihood::getDLikelihoodForASiteForARateClass().
|
inline |
Definition at line 249 of file DRASRTreeLikelihoodData.h.
References nodeData_.
Referenced by bpp::RHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::RHomogeneousTreeLikelihood::computeSubtreeLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeSubtreeLikelihood(), bpp::RNonHomogeneousMixedTreeLikelihood::computeSubtreeLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeDLikelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeDLikelihood(), bpp::RHomogeneousTreeLikelihood::displayLikelihood(), bpp::RNonHomogeneousTreeLikelihood::displayLikelihood(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClassForAState(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClassForAState(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState(), and bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState().
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 220 of file DRASRTreeLikelihoodData.h.
References nodeData_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 224 of file DRASRTreeLikelihoodData.h.
References nodeData_.
|
inline |
Definition at line 267 of file DRASRTreeLikelihoodData.h.
References nbClasses_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 264 of file DRASRTreeLikelihoodData.h.
References nbDistinctSites_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 265 of file DRASRTreeLikelihoodData.h.
References nbSites_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 266 of file DRASRTreeLikelihoodData.h.
References nbStates_.
|
inlinevirtual |
Reimplemented from bpp::AbstractTreeLikelihoodData.
Definition at line 232 of file DRASRTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootPatternLinks_.
Referenced by bpp::RHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getDLikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getDLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClassForAState(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClassForAState(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState(), bpp::RNonHomogeneousTreeLikelihood::getSiteIndex(), and bpp::RHomogeneousTreeLikelihood::getSiteIndex().
|
inlineinherited |
Definition at line 121 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootPatternLinks_.
|
inlineinherited |
Definition at line 122 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootPatternLinks_.
|
inlinevirtualinherited |
Implements bpp::TreeLikelihoodData.
Definition at line 138 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::tree_.
|
inlinevirtualinherited |
Implements bpp::TreeLikelihoodData.
Definition at line 127 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootWeights_.
Referenced by bpp::DRTreeLikelihoodTools::getPosteriorStateFrequencies().
|
inlinevirtualinherited |
Implements bpp::TreeLikelihoodData.
Definition at line 131 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootWeights_.
Referenced by bpp::DRHomogeneousMixedTreeLikelihood::getLikelihood(), bpp::DRHomogeneousTreeLikelihood::getLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::getLikelihood(), bpp::DRHomogeneousMixedTreeLikelihood::getLogLikelihood(), bpp::DRHomogeneousTreeLikelihood::getLogLikelihood(), and bpp::DRNonHomogeneousTreeLikelihood::getLogLikelihood().
void DRASRTreeLikelihoodData::initLikelihoods | ( | const SiteContainer & | sites, |
const SubstitutionModel & | model | ||
) | |||
throw | ( | Exception | |
) |
Definition at line 54 of file DRASRTreeLikelihoodData.cpp.
References bpp::SitePatterns::getIndices(), bpp::SitePatterns::getSites(), and bpp::SitePatterns::getWeights().
|
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 94 of file DRASRTreeLikelihoodData.cpp.
References bpp::DRASRTreeLikelihoodNodeData::getD2LikelihoodArray(), bpp::DRASRTreeLikelihoodNodeData::getDLikelihoodArray(), bpp::Node::getId(), bpp::DRASRTreeLikelihoodNodeData::getLikelihoodArray(), 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 191 of file DRASRTreeLikelihoodData.cpp.
References bpp::DRASRTreeLikelihoodNodeData::getD2LikelihoodArray(), bpp::DRASRTreeLikelihoodNodeData::getDLikelihoodArray(), bpp::Node::getId(), bpp::SitePatterns::getIndices(), bpp::DRASRTreeLikelihoodNodeData::getLikelihoodArray(), bpp::PatternTools::getSequenceSubset(), bpp::SitePatterns::getSites(), and bpp::DRASRTreeLikelihoodNodeData::setNode().
|
inline |
Definition at line 178 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 210 of file DRASRTreeLikelihoodData.h.
References bpp::TreeTemplate< N >::getNode(), nodeData_, and bpp::AbstractTreeLikelihoodData::tree_.
Referenced by bpp::RHomogeneousTreeLikelihood::operator=(), bpp::RNonHomogeneousTreeLikelihood::operator=(), bpp::RHomogeneousTreeLikelihood::RHomogeneousTreeLikelihood(), and bpp::RNonHomogeneousTreeLikelihood::RNonHomogeneousTreeLikelihood().
|
protectedinherited |
Definition at line 95 of file AbstractTreeLikelihoodData.h.
Referenced by bpp::AbstractTreeLikelihoodData::getAlphabet(), and bpp::AbstractTreeLikelihoodData::operator=().
|
private |
Definition at line 154 of file DRASRTreeLikelihoodData.h.
Referenced by getNumberOfClasses(), and operator=().
|
private |
Definition at line 155 of file DRASRTreeLikelihoodData.h.
Referenced by getNumberOfDistinctSites(), and operator=().
|
private |
Definition at line 152 of file DRASRTreeLikelihoodData.h.
Referenced by getNumberOfSites(), and operator=().
|
private |
Definition at line 153 of file DRASRTreeLikelihoodData.h.
Referenced by getNumberOfStates(), and operator=().
|
mutableprivate |
This contains all likelihood values used for computation.
Definition at line 136 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 intialized 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 150 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 86 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 91 of file AbstractTreeLikelihoodData.h.
Referenced by bpp::AbstractTreeLikelihoodData::getWeight(), bpp::AbstractTreeLikelihoodData::getWeights(), and bpp::AbstractTreeLikelihoodData::operator=().
|
private |
Definition at line 151 of file DRASRTreeLikelihoodData.h.
Referenced by DRASRTreeLikelihoodData(), operator=(), and ~DRASRTreeLikelihoodData().
|
protectedinherited |
Definition at line 93 of file AbstractTreeLikelihoodData.h.
Referenced by bpp::AbstractTreeLikelihoodData::getTree(), bpp::AbstractTreeLikelihoodData::operator=(), bpp::DRASDRTreeLikelihoodData::reInit(), setTree(), and bpp::DRASDRTreeLikelihoodData::setTree().
|
private |
Definition at line 156 of file DRASRTreeLikelihoodData.h.
Referenced by operator=().