bpp-phyl  2.2.0
bpp::AbstractTreeLikelihoodData Class Referenceabstract

Partial implementation of the TreeLikelihoodData interface. More...

#include <Bpp/Phyl/Likelihood/AbstractTreeLikelihoodData.h>

+ Inheritance diagram for bpp::AbstractTreeLikelihoodData:
+ Collaboration diagram for bpp::AbstractTreeLikelihoodData:

Public Member Functions

 AbstractTreeLikelihoodData (const TreeTemplate< Node > *tree)
 
 AbstractTreeLikelihoodData (const AbstractTreeLikelihoodData &atd)
 
AbstractTreeLikelihoodDataoperator= (const AbstractTreeLikelihoodData &atd)
 
virtual ~AbstractTreeLikelihoodData ()
 
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
 
const Alphabet * getAlphabet () const
 
const TreeTemplate< Node > * getTree () const
 
TreeLikelihoodDataclone () const =0
 
virtual size_t getArrayPosition (int parentId, int sonId, size_t currentPosition) const =0
 
virtual TreeLikelihoodNodeDatagetNodeData (int nodeId)=0
 
virtual const TreeLikelihoodNodeDatagetNodeData (int nodeId) const =0
 
virtual size_t getNumberOfDistinctSites () const =0
 
virtual size_t getNumberOfSites () const =0
 
virtual size_t getNumberOfStates () const =0
 

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_
 

Detailed Description

Partial implementation of the TreeLikelihoodData interface.

This data structure provides a simple compression, by performing and storing computations only one time per identical sites.

The compression is achieved by the TreeLikelihood object. The correspondance between sites in the dataset and the arrays in the structures is given by the rootPatternLinks_ array: the array indice for site $i$ if given by:

Finally, the rootWeights_ array gives for each array position, the number of sites with this pattern. The global likelihood is then given by the product of all likelihoods for each array position, weighted by the corresponding number of sites.

Definition at line 71 of file AbstractTreeLikelihoodData.h.

Constructor & Destructor Documentation

◆ AbstractTreeLikelihoodData() [1/2]

bpp::AbstractTreeLikelihoodData::AbstractTreeLikelihoodData ( const TreeTemplate< Node > *  tree)
inline

Definition at line 98 of file AbstractTreeLikelihoodData.h.

◆ AbstractTreeLikelihoodData() [2/2]

bpp::AbstractTreeLikelihoodData::AbstractTreeLikelihoodData ( const AbstractTreeLikelihoodData atd)
inline

Definition at line 101 of file AbstractTreeLikelihoodData.h.

◆ ~AbstractTreeLikelihoodData()

virtual bpp::AbstractTreeLikelihoodData::~AbstractTreeLikelihoodData ( )
inlinevirtual

Definition at line 118 of file AbstractTreeLikelihoodData.h.

Member Function Documentation

◆ clone()

TreeLikelihoodData* bpp::TreeLikelihoodData::clone ( ) const
pure virtualinherited

◆ getAlphabet()

const Alphabet* bpp::AbstractTreeLikelihoodData::getAlphabet ( ) const
inlinevirtual

Implements bpp::TreeLikelihoodData.

Definition at line 136 of file AbstractTreeLikelihoodData.h.

References alphabet_.

◆ getArrayPosition()

virtual size_t bpp::TreeLikelihoodData::getArrayPosition ( int  parentId,
int  sonId,
size_t  currentPosition 
) const
pure virtualinherited

◆ getNodeData() [1/2]

virtual TreeLikelihoodNodeData& bpp::TreeLikelihoodData::getNodeData ( int  nodeId)
pure virtualinherited

◆ getNodeData() [2/2]

virtual const TreeLikelihoodNodeData& bpp::TreeLikelihoodData::getNodeData ( int  nodeId) const
pure virtualinherited

◆ getNumberOfDistinctSites()

virtual size_t bpp::TreeLikelihoodData::getNumberOfDistinctSites ( ) const
pure virtualinherited
Returns
The number of non redundant patterns.

Implemented in bpp::DRASDRTreeLikelihoodData, and bpp::DRASRTreeLikelihoodData.

◆ getNumberOfSites()

virtual size_t bpp::TreeLikelihoodData::getNumberOfSites ( ) const
pure virtualinherited
Returns
The total number of sites.

Implemented in bpp::DRASDRTreeLikelihoodData, and bpp::DRASRTreeLikelihoodData.

◆ getNumberOfStates()

virtual size_t bpp::TreeLikelihoodData::getNumberOfStates ( ) const
pure virtualinherited
Returns
Get the number of states used in the model.

Implemented in bpp::DRASDRTreeLikelihoodData, and bpp::DRASRTreeLikelihoodData.

◆ getRootArrayPosition()

◆ getRootArrayPositions() [1/2]

std::vector<size_t>& bpp::AbstractTreeLikelihoodData::getRootArrayPositions ( )
inline

Definition at line 121 of file AbstractTreeLikelihoodData.h.

References rootPatternLinks_.

◆ getRootArrayPositions() [2/2]

const std::vector<size_t>& bpp::AbstractTreeLikelihoodData::getRootArrayPositions ( ) const
inline

Definition at line 122 of file AbstractTreeLikelihoodData.h.

References rootPatternLinks_.

◆ getTree()

const TreeTemplate<Node>* bpp::AbstractTreeLikelihoodData::getTree ( ) const
inlinevirtual

Implements bpp::TreeLikelihoodData.

Definition at line 138 of file AbstractTreeLikelihoodData.h.

References tree_.

◆ getWeight()

unsigned int bpp::AbstractTreeLikelihoodData::getWeight ( size_t  pos) const
inlinevirtual
Returns
The frequency of a given pattern.

Implements bpp::TreeLikelihoodData.

Definition at line 127 of file AbstractTreeLikelihoodData.h.

References rootWeights_.

Referenced by bpp::DRTreeLikelihoodTools::getPosteriorStateFrequencies().

◆ getWeights()

◆ operator=()

AbstractTreeLikelihoodData& bpp::AbstractTreeLikelihoodData::operator= ( const AbstractTreeLikelihoodData atd)
inline

Member Data Documentation

◆ alphabet_

const Alphabet* bpp::AbstractTreeLikelihoodData::alphabet_
protected

Definition at line 95 of file AbstractTreeLikelihoodData.h.

Referenced by getAlphabet(), and operator=().

◆ rootPatternLinks_

std::vector<size_t> bpp::AbstractTreeLikelihoodData::rootPatternLinks_
protected

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 getRootArrayPosition(), bpp::DRASRTreeLikelihoodData::getRootArrayPosition(), getRootArrayPositions(), and operator=().

◆ rootWeights_

std::vector<unsigned int> bpp::AbstractTreeLikelihoodData::rootWeights_
protected

The frequency of each site.

Definition at line 91 of file AbstractTreeLikelihoodData.h.

Referenced by getWeight(), getWeights(), and operator=().

◆ tree_


The documentation for this class was generated from the following file: