bpp-phyl3  3.0.0
bpp::AbstractTreeLikelihoodData Class Referenceabstract

Partial implementation of the TreeLikelihoodData interface. More...

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

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

Public Member Functions

 AbstractTreeLikelihoodData (std::shared_ptr< 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
 
std::shared_ptr< const AlphabetgetAlphabet () const
 
std::shared_ptr< 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...
 
std::shared_ptr< const TreeTemplate< Node > > tree_
 
std::shared_ptr< const Alphabetalphabet_
 

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 correspondence 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:

std::vector< size_t > rootPatternLinks_
Links between sites and patterns.

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 35 of file AbstractTreeLikelihoodData.h.

Constructor & Destructor Documentation

◆ AbstractTreeLikelihoodData() [1/2]

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

Definition at line 62 of file AbstractTreeLikelihoodData.h.

◆ AbstractTreeLikelihoodData() [2/2]

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

Definition at line 65 of file AbstractTreeLikelihoodData.h.

◆ ~AbstractTreeLikelihoodData()

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

Definition at line 82 of file AbstractTreeLikelihoodData.h.

Member Function Documentation

◆ clone()

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

◆ getAlphabet()

std::shared_ptr<const Alphabet> bpp::AbstractTreeLikelihoodData::getAlphabet ( ) const
inlinevirtual

Implements bpp::TreeLikelihoodData.

Definition at line 100 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 const TreeLikelihoodNodeData& bpp::TreeLikelihoodData::getNodeData ( int  nodeId) const
pure virtualinherited

◆ getNodeData() [2/2]

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

◆ getNumberOfDistinctSites()

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

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

Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies().

◆ getNumberOfSites()

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

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

◆ getNumberOfStates()

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

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

◆ getRootArrayPosition()

size_t bpp::AbstractTreeLikelihoodData::getRootArrayPosition ( const size_t  site) const
inlinevirtual

Implements bpp::TreeLikelihoodData.

Reimplemented in bpp::DRASRTreeLikelihoodData.

Definition at line 87 of file AbstractTreeLikelihoodData.h.

References rootPatternLinks_.

◆ getRootArrayPositions() [1/2]

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

Definition at line 85 of file AbstractTreeLikelihoodData.h.

References rootPatternLinks_.

◆ getRootArrayPositions() [2/2]

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

Definition at line 86 of file AbstractTreeLikelihoodData.h.

References rootPatternLinks_.

◆ getTree()

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

Implements bpp::TreeLikelihoodData.

Definition at line 102 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 91 of file AbstractTreeLikelihoodData.h.

References rootWeights_.

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

◆ getWeights()

const std::vector<unsigned int>& bpp::AbstractTreeLikelihoodData::getWeights ( ) const
inlinevirtual
Returns
Frequencies for each pattern.

Implements bpp::TreeLikelihoodData.

Definition at line 95 of file AbstractTreeLikelihoodData.h.

References rootWeights_.

◆ operator=()

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

Member Data Documentation

◆ alphabet_

std::shared_ptr<const Alphabet> bpp::AbstractTreeLikelihoodData::alphabet_
protected

Definition at line 59 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 50 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 55 of file AbstractTreeLikelihoodData.h.

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

◆ tree_

std::shared_ptr<const TreeTemplate<Node> > bpp::AbstractTreeLikelihoodData::tree_
protected

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