bpp-phyl3
3.0.0
|
Likelihood data structure for rate across sites models, using a double-recursive algorithm. More...
#include <Bpp/Phyl/Legacy/Likelihood/DRASDRTreeLikelihoodData.h>
Public Member Functions | |
DRASDRTreeLikelihoodData (std::shared_ptr< const TreeTemplate< Node >> tree, size_t nbClasses) | |
DRASDRTreeLikelihoodData (const DRASDRTreeLikelihoodData &data) | |
DRASDRTreeLikelihoodData & | operator= (const DRASDRTreeLikelihoodData &data) |
virtual | ~DRASDRTreeLikelihoodData () |
DRASDRTreeLikelihoodData * | clone () const |
void | setTree (std::shared_ptr< const TreeTemplate< Node >> tree) |
Set the tree associated to the data. More... | |
DRASDRTreeLikelihoodNodeData & | getNodeData (int nodeId) |
const DRASDRTreeLikelihoodNodeData & | getNodeData (int nodeId) const |
DRASDRTreeLikelihoodLeafData & | getLeafData (int nodeId) |
const DRASDRTreeLikelihoodLeafData & | getLeafData (int nodeId) const |
size_t | getArrayPosition (int parentId, int sonId, size_t currentPosition) const |
const std::map< int, VVVdouble > & | getLikelihoodArrays (int nodeId) const |
std::map< int, VVVdouble > & | getLikelihoodArrays (int nodeId) |
VVVdouble & | getLikelihoodArray (int parentId, int neighborId) |
const VVVdouble & | getLikelihoodArray (int parentId, int neighborId) const |
Vdouble & | getDLikelihoodArray (int nodeId) |
const Vdouble & | getDLikelihoodArray (int nodeId) const |
Vdouble & | getD2LikelihoodArray (int nodeId) |
const Vdouble & | getD2LikelihoodArray (int nodeId) const |
VVdouble & | getLeafLikelihoods (int nodeId) |
const VVdouble & | getLeafLikelihoods (int nodeId) const |
VVVdouble & | getRootLikelihoodArray () |
const VVVdouble & | getRootLikelihoodArray () const |
VVdouble & | getRootSiteLikelihoodArray () |
const VVdouble & | getRootSiteLikelihoodArray () const |
Vdouble & | getRootRateSiteLikelihoodArray () |
const Vdouble & | getRootRateSiteLikelihoodArray () const |
size_t | getNumberOfDistinctSites () const |
size_t | getNumberOfSites () const |
size_t | getNumberOfStates () const |
size_t | getNumberOfClasses () const |
std::shared_ptr< const AlignmentDataInterface > | getShrunkData () const |
const AlignmentDataInterface & | shrunkData () const |
void | initLikelihoods (const AlignmentDataInterface &sites, const TransitionModelInterface &model) |
Resize and initialize all likelihood arrays according to the given data set and substitution model. More... | |
void | reInit () |
Rebuild likelihood arrays at inner nodes. More... | |
void | reInit (const Node *node) |
std::vector< size_t > & | getRootArrayPositions () |
const std::vector< size_t > & | getRootArrayPositions () const |
size_t | getRootArrayPosition (const size_t site) 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 | |
void | initLikelihoods (const Node *node, const AlignmentDataInterface &sites, const TransitionModelInterface &model) |
This method initializes the leaves according to a sequence container. 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, DRASDRTreeLikelihoodNodeData > | nodeData_ |
std::map< int, DRASDRTreeLikelihoodLeafData > | leafData_ |
VVVdouble | rootLikelihoods_ |
VVdouble | rootLikelihoodsS_ |
Vdouble | rootLikelihoodsSR_ |
std::shared_ptr< AlignmentDataInterface > | shrunkData_ |
size_t | nbSites_ |
size_t | nbStates_ |
size_t | nbClasses_ |
size_t | nbDistinctSites_ |
Likelihood data structure for rate across sites models, using a double-recursive algorithm.
Definition at line 183 of file DRASDRTreeLikelihoodData.h.
|
inline |
Definition at line 200 of file DRASDRTreeLikelihoodData.h.
Referenced by clone().
|
inline |
Definition at line 206 of file DRASDRTreeLikelihoodData.h.
References shrunkData_.
|
inlinevirtual |
Definition at line 239 of file DRASDRTreeLikelihoodData.h.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 241 of file DRASDRTreeLikelihoodData.h.
References DRASDRTreeLikelihoodData().
|
inlinevirtualinherited |
Implements bpp::TreeLikelihoodData.
Definition at line 100 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::alphabet_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 288 of file DRASDRTreeLikelihoodData.h.
|
inline |
Definition at line 323 of file DRASDRTreeLikelihoodData.h.
References nodeData_.
|
inline |
Definition at line 328 of file DRASDRTreeLikelihoodData.h.
References nodeData_.
|
inline |
Definition at line 313 of file DRASDRTreeLikelihoodData.h.
References nodeData_.
|
inline |
Definition at line 318 of file DRASDRTreeLikelihoodData.h.
References nodeData_.
|
inline |
Definition at line 278 of file DRASDRTreeLikelihoodData.h.
References leafData_.
|
inline |
Definition at line 283 of file DRASDRTreeLikelihoodData.h.
References leafData_.
|
inline |
Definition at line 333 of file DRASDRTreeLikelihoodData.h.
References leafData_.
Referenced by bpp::DRTreeLikelihoodTools::getPosteriorProbabilitiesPerStatePerRate().
|
inline |
Definition at line 338 of file DRASDRTreeLikelihoodData.h.
References leafData_.
|
inline |
Definition at line 303 of file DRASDRTreeLikelihoodData.h.
References nodeData_.
|
inline |
Definition at line 308 of file DRASDRTreeLikelihoodData.h.
References nodeData_.
|
inline |
Definition at line 298 of file DRASDRTreeLikelihoodData.h.
References nodeData_.
|
inline |
Definition at line 293 of file DRASDRTreeLikelihoodData.h.
References nodeData_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 268 of file DRASDRTreeLikelihoodData.h.
References nodeData_.
Referenced by bpp::NNIHomogeneousTreeLikelihood::testNNI().
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 273 of file DRASDRTreeLikelihoodData.h.
References nodeData_.
|
inline |
Definition at line 358 of file DRASDRTreeLikelihoodData.h.
References nbClasses_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 352 of file DRASDRTreeLikelihoodData.h.
References nbDistinctSites_.
Referenced by bpp::DRTreeLikelihoodTools::getPosteriorProbabilitiesPerStatePerRate().
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 354 of file DRASDRTreeLikelihoodData.h.
References nbSites_.
|
inlinevirtual |
Implements bpp::TreeLikelihoodData.
Definition at line 356 of file DRASDRTreeLikelihoodData.h.
References nbStates_.
|
inlinevirtualinherited |
Implements bpp::TreeLikelihoodData.
Reimplemented in bpp::DRASRTreeLikelihoodData.
Definition at line 87 of file AbstractTreeLikelihoodData.h.
References bpp::AbstractTreeLikelihoodData::rootPatternLinks_.
|
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_.
|
inline |
Definition at line 343 of file DRASDRTreeLikelihoodData.h.
References rootLikelihoods_.
|
inline |
Definition at line 344 of file DRASDRTreeLikelihoodData.h.
References rootLikelihoods_.
|
inline |
Definition at line 349 of file DRASDRTreeLikelihoodData.h.
References rootLikelihoodsSR_.
|
inline |
Definition at line 350 of file DRASDRTreeLikelihoodData.h.
References rootLikelihoodsSR_.
|
inline |
Definition at line 346 of file DRASDRTreeLikelihoodData.h.
References rootLikelihoodsS_.
|
inline |
Definition at line 347 of file DRASDRTreeLikelihoodData.h.
References rootLikelihoodsS_.
|
inline |
Definition at line 360 of file DRASDRTreeLikelihoodData.h.
References shrunkData_.
|
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 DRASDRTreeLikelihoodData::initLikelihoods | ( | const AlignmentDataInterface & | sites, |
const TransitionModelInterface & | model | ||
) |
Resize and initialize all likelihood arrays according to the given data set and substitution model.
sites | The sequences to use as data. |
model | The substitution model to use. |
Exception | if an error occurs. |
Definition at line 16 of file DRASDRTreeLikelihoodData.cpp.
References bpp::BranchModelInterface::getAlphabet(), bpp::TemplateAlignmentDataInterface< class >::getAlphabet(), bpp::SitePatterns::getIndices(), bpp::TemplateAlignmentDataInterface< class >::getNumberOfSequences(), bpp::TemplateAlignmentDataInterface< class >::getNumberOfSites(), bpp::BranchModelInterface::getNumberOfStates(), bpp::SitePatterns::getSites(), and bpp::SitePatterns::getWeights().
|
protected |
This method initializes the leaves according to a sequence container.
Here the container shrunkData_ is used. 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. |
sites | The sequence container to use. |
model | The model, used for initializing leaves' likelihoods. |
Definition at line 68 of file DRASDRTreeLikelihoodData.cpp.
References bpp::BranchModelInterface::getAlphabetStateAsInt(), bpp::DRASDRTreeLikelihoodNodeData::getD2LikelihoodArray(), bpp::DRASDRTreeLikelihoodNodeData::getDLikelihoodArray(), bpp::Node::getId(), bpp::DRASDRTreeLikelihoodLeafData::getLikelihoodArray(), bpp::DRASDRTreeLikelihoodNodeData::getLikelihoodArrays(), bpp::Node::getName(), bpp::Node::getNumberOfSons(), bpp::TemplateAlignmentDataInterface< class >::getSequencePosition(), bpp::Node::getSon(), bpp::TemplateAlignmentDataInterface< class >::getStateValueAt(), bpp::Node::hasFather(), bpp::Node::isLeaf(), bpp::DRASDRTreeLikelihoodLeafData::setNode(), and bpp::DRASDRTreeLikelihoodNodeData::setNode().
|
inline |
Definition at line 220 of file DRASDRTreeLikelihoodData.h.
References leafData_, nbClasses_, nbDistinctSites_, nbSites_, nbStates_, nodeData_, bpp::AbstractTreeLikelihoodData::operator=(), rootLikelihoods_, rootLikelihoodsS_, rootLikelihoodsSR_, and shrunkData_.
void DRASDRTreeLikelihoodData::reInit | ( | ) |
Rebuild likelihood arrays at inner nodes.
This method is to be called when the topology of the tree has changed. Node arrays relationship are rebuilt according to the new topology of the tree. The leaves likelihood remain unchanged, so as for the first and second order derivatives.
Definition at line 176 of file DRASDRTreeLikelihoodData.cpp.
Referenced by bpp::NNIHomogeneousTreeLikelihood::topologyChangeTested().
void DRASDRTreeLikelihoodData::reInit | ( | const Node * | node | ) |
Definition at line 181 of file DRASDRTreeLikelihoodData.cpp.
References bpp::DRASDRTreeLikelihoodNodeData::eraseNeighborArrays(), bpp::DRASDRTreeLikelihoodNodeData::getD2LikelihoodArray(), bpp::DRASDRTreeLikelihoodNodeData::getDLikelihoodArray(), bpp::Node::getId(), bpp::DRASDRTreeLikelihoodNodeData::getLikelihoodArrayForNeighbor(), bpp::Node::getNumberOfSons(), bpp::Node::getSon(), bpp::Node::hasFather(), bpp::Node::isLeaf(), bpp::DRASDRTreeLikelihoodLeafData::setNode(), and bpp::DRASDRTreeLikelihoodNodeData::setNode().
|
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 253 of file DRASDRTreeLikelihoodData.h.
References leafData_, nodeData_, and bpp::AbstractTreeLikelihoodData::tree_.
|
inline |
Definition at line 362 of file DRASDRTreeLikelihoodData.h.
References shrunkData_.
|
protectedinherited |
Definition at line 59 of file AbstractTreeLikelihoodData.h.
Referenced by bpp::AbstractTreeLikelihoodData::getAlphabet(), and bpp::AbstractTreeLikelihoodData::operator=().
|
mutableprivate |
Definition at line 188 of file DRASDRTreeLikelihoodData.h.
Referenced by getLeafData(), getLeafLikelihoods(), operator=(), and setTree().
|
private |
Definition at line 196 of file DRASDRTreeLikelihoodData.h.
Referenced by getNumberOfClasses(), and operator=().
|
private |
Definition at line 197 of file DRASDRTreeLikelihoodData.h.
Referenced by getNumberOfDistinctSites(), and operator=().
|
private |
Definition at line 194 of file DRASDRTreeLikelihoodData.h.
Referenced by getNumberOfSites(), and operator=().
|
private |
Definition at line 195 of file DRASDRTreeLikelihoodData.h.
Referenced by getNumberOfStates(), and operator=().
|
mutableprivate |
Definition at line 187 of file DRASDRTreeLikelihoodData.h.
Referenced by getD2LikelihoodArray(), getDLikelihoodArray(), getLikelihoodArray(), getLikelihoodArrays(), getNodeData(), operator=(), and setTree().
|
mutableprivate |
Definition at line 189 of file DRASDRTreeLikelihoodData.h.
Referenced by getRootLikelihoodArray(), and operator=().
|
mutableprivate |
Definition at line 190 of file DRASDRTreeLikelihoodData.h.
Referenced by getRootSiteLikelihoodArray(), and operator=().
|
mutableprivate |
Definition at line 191 of file DRASDRTreeLikelihoodData.h.
Referenced by getRootRateSiteLikelihoodArray(), 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(), bpp::DRASRTreeLikelihoodData::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 193 of file DRASDRTreeLikelihoodData.h.
Referenced by DRASDRTreeLikelihoodData(), getShrunkData(), operator=(), and shrunkData().
|
protectedinherited |
Definition at line 57 of file AbstractTreeLikelihoodData.h.
Referenced by bpp::AbstractTreeLikelihoodData::getTree(), bpp::AbstractTreeLikelihoodData::operator=(), setTree(), and bpp::DRASRTreeLikelihoodData::setTree().