bpp-phyl3  3.0.0
bpp::DRTreeParsimonyData Class Reference

Parsimony data structure for double-recursive (DR) algorithm. More...

#include <Bpp/Phyl/Parsimony/DRTreeParsimonyData.h>

+ Inheritance diagram for bpp::DRTreeParsimonyData:
+ Collaboration diagram for bpp::DRTreeParsimonyData:

Public Member Functions

 DRTreeParsimonyData (std::shared_ptr< const TreeTemplate< Node >> tree)
 
 DRTreeParsimonyData (const DRTreeParsimonyData &data)
 
DRTreeParsimonyDataoperator= (const DRTreeParsimonyData &data)
 
virtual ~DRTreeParsimonyData ()
 
DRTreeParsimonyDataclone () const override
 
void setTree (std::shared_ptr< const TreeTemplate< Node >> tree)
 Set the tree associated to the data. More...
 
DRTreeParsimonyNodeDatanodeData (int nodeId) override
 
const DRTreeParsimonyNodeDatanodeData (int nodeId) const override
 
DRTreeParsimonyLeafDataleafData (int nodeId)
 
const DRTreeParsimonyLeafDataleafData (int nodeId) const
 
std::vector< Bitset > & getBitsetsArray (int nodeId, int neighborId)
 
const std::vector< Bitset > & getBitsetsArray (int nodeId, int neighborId) const
 
std::vector< unsigned int > & getScoresArray (int nodeId, int neighborId)
 
const std::vector< unsigned int > & getScoresArray (int nodeId, int neighborId) const
 
size_t getArrayPosition (int parentId, int sonId, size_t currentPosition) const override
 
std::vector< Bitset > & getRootBitsets ()
 
const std::vector< Bitset > & getRootBitsets () const
 
const BitsetgetRootBitset (size_t i) const
 
std::vector< unsigned int > & getRootScores ()
 
const std::vector< unsigned int > & getRootScores () const
 
unsigned int getRootScore (size_t i) const
 
size_t getNumberOfDistinctSites () const
 
size_t getNumberOfSites () const
 
size_t getNumberOfStates () const
 
void init (std::shared_ptr< const SiteContainerInterface > sites, std::shared_ptr< const StateMapInterface > stateMap)
 
void reInit ()
 
size_t getRootArrayPosition (size_t site) const override
 
unsigned int getWeight (size_t pos) const
 
const TreeTemplate< Node > & tree () const override
 
std::shared_ptr< const TreeTemplate< Node > > getTree () const override
 

Protected Member Functions

void init_ (const Node *node, std::shared_ptr< const SiteContainerInterface > sites, std::shared_ptr< const StateMapInterface > stateMap)
 
void reInit_ (const Node *node)
 

Protected Attributes

std::vector< size_t > rootPatternLinks_
 
std::vector< unsigned int > rootWeights_
 
std::shared_ptr< const TreeTemplate< Node > > tree_
 

Private Attributes

std::map< int, DRTreeParsimonyNodeDatanodeData_
 
std::map< int, DRTreeParsimonyLeafDataleafData_
 
std::vector< BitsetrootBitsets_
 
std::vector< unsigned int > rootScores_
 
std::unique_ptr< SiteContainerInterfaceshrunkData_
 
size_t nbSites_
 
size_t nbStates_
 
size_t nbDistinctSites_
 

Detailed Description

Parsimony data structure for double-recursive (DR) algorithm.

States are coded using bitsets for faster computing (

See also
AbstractTreeParsimonyData). For each inner node in the tree, we store a DRTreeParsimonyNodeData object in nodeData_. For each leaf node in the tree, we store a DRTreeParsimonyLeafData object in leafData_.

The dataset is first compressed, removing all identical sites. The resulting dataset is stored in shrunkData_. The corresponding positions are stored in rootPatternLinks_, inherited from AbstractTreeParsimonyData.

Definition at line 160 of file DRTreeParsimonyData.h.

Constructor & Destructor Documentation

◆ DRTreeParsimonyData() [1/2]

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

Definition at line 174 of file DRTreeParsimonyData.h.

Referenced by clone().

◆ DRTreeParsimonyData() [2/2]

DRTreeParsimonyData::DRTreeParsimonyData ( const DRTreeParsimonyData data)

Definition at line 16 of file DRTreeParsimonyData.cpp.

References shrunkData_.

◆ ~DRTreeParsimonyData()

virtual bpp::DRTreeParsimonyData::~DRTreeParsimonyData ( )
inlinevirtual

Definition at line 190 of file DRTreeParsimonyData.h.

Member Function Documentation

◆ clone()

DRTreeParsimonyData* bpp::DRTreeParsimonyData::clone ( ) const
inlineoverridevirtual

Implements bpp::TreeParsimonyDataInterface.

Definition at line 192 of file DRTreeParsimonyData.h.

References DRTreeParsimonyData().

◆ getArrayPosition()

size_t bpp::DRTreeParsimonyData::getArrayPosition ( int  parentId,
int  sonId,
size_t  currentPosition 
) const
inlineoverridevirtual

Implements bpp::TreeParsimonyDataInterface.

Definition at line 255 of file DRTreeParsimonyData.h.

◆ getBitsetsArray() [1/2]

std::vector<Bitset>& bpp::DRTreeParsimonyData::getBitsetsArray ( int  nodeId,
int  neighborId 
)
inline

Definition at line 237 of file DRTreeParsimonyData.h.

References nodeData_.

◆ getBitsetsArray() [2/2]

const std::vector<Bitset>& bpp::DRTreeParsimonyData::getBitsetsArray ( int  nodeId,
int  neighborId 
) const
inline

Definition at line 241 of file DRTreeParsimonyData.h.

References nodeData_.

◆ getNumberOfDistinctSites()

size_t bpp::DRTreeParsimonyData::getNumberOfDistinctSites ( ) const
inline

Definition at line 268 of file DRTreeParsimonyData.h.

References nbDistinctSites_.

◆ getNumberOfSites()

size_t bpp::DRTreeParsimonyData::getNumberOfSites ( ) const
inline

Definition at line 269 of file DRTreeParsimonyData.h.

References nbSites_.

◆ getNumberOfStates()

size_t bpp::DRTreeParsimonyData::getNumberOfStates ( ) const
inline

Definition at line 270 of file DRTreeParsimonyData.h.

References nbStates_.

◆ getRootArrayPosition()

size_t bpp::AbstractTreeParsimonyData::getRootArrayPosition ( size_t  site) const
inlineoverridevirtualinherited

◆ getRootBitset()

const Bitset& bpp::DRTreeParsimonyData::getRootBitset ( size_t  i) const
inline

Definition at line 262 of file DRTreeParsimonyData.h.

References rootBitsets_.

◆ getRootBitsets() [1/2]

std::vector<Bitset>& bpp::DRTreeParsimonyData::getRootBitsets ( )
inline

Definition at line 260 of file DRTreeParsimonyData.h.

References rootBitsets_.

◆ getRootBitsets() [2/2]

const std::vector<Bitset>& bpp::DRTreeParsimonyData::getRootBitsets ( ) const
inline

Definition at line 261 of file DRTreeParsimonyData.h.

References rootBitsets_.

◆ getRootScore()

unsigned int bpp::DRTreeParsimonyData::getRootScore ( size_t  i) const
inline

Definition at line 266 of file DRTreeParsimonyData.h.

References rootScores_.

◆ getRootScores() [1/2]

std::vector<unsigned int>& bpp::DRTreeParsimonyData::getRootScores ( )
inline

Definition at line 264 of file DRTreeParsimonyData.h.

References rootScores_.

◆ getRootScores() [2/2]

const std::vector<unsigned int>& bpp::DRTreeParsimonyData::getRootScores ( ) const
inline

Definition at line 265 of file DRTreeParsimonyData.h.

References rootScores_.

◆ getScoresArray() [1/2]

std::vector<unsigned int>& bpp::DRTreeParsimonyData::getScoresArray ( int  nodeId,
int  neighborId 
)
inline

Definition at line 246 of file DRTreeParsimonyData.h.

References nodeData_.

◆ getScoresArray() [2/2]

const std::vector<unsigned int>& bpp::DRTreeParsimonyData::getScoresArray ( int  nodeId,
int  neighborId 
) const
inline

Definition at line 250 of file DRTreeParsimonyData.h.

References nodeData_.

◆ getTree()

std::shared_ptr<const TreeTemplate<Node> > bpp::AbstractTreeParsimonyData::getTree ( ) const
inlineoverridevirtualinherited

◆ getWeight()

unsigned int bpp::AbstractTreeParsimonyData::getWeight ( size_t  pos) const
inlineinherited

◆ init()

◆ init_()

◆ leafData() [1/2]

DRTreeParsimonyLeafData& bpp::DRTreeParsimonyData::leafData ( int  nodeId)
inline

Definition at line 228 of file DRTreeParsimonyData.h.

References leafData_.

Referenced by init_().

◆ leafData() [2/2]

const DRTreeParsimonyLeafData& bpp::DRTreeParsimonyData::leafData ( int  nodeId) const
inline

Definition at line 232 of file DRTreeParsimonyData.h.

References leafData_.

◆ nodeData() [1/2]

const DRTreeParsimonyNodeData& bpp::DRTreeParsimonyData::nodeData ( int  nodeId) const
inlineoverridevirtual

Implements bpp::TreeParsimonyDataInterface.

Definition at line 223 of file DRTreeParsimonyData.h.

References nodeData_.

◆ nodeData() [2/2]

DRTreeParsimonyNodeData& bpp::DRTreeParsimonyData::nodeData ( int  nodeId)
inlineoverridevirtual

Implements bpp::TreeParsimonyDataInterface.

Definition at line 219 of file DRTreeParsimonyData.h.

References nodeData_.

Referenced by init_(), and reInit_().

◆ operator=()

◆ reInit()

void DRTreeParsimonyData::reInit ( )

Definition at line 155 of file DRTreeParsimonyData.cpp.

References reInit_(), and bpp::AbstractTreeParsimonyData::tree().

◆ reInit_()

◆ setTree()

void bpp::DRTreeParsimonyData::setTree ( std::shared_ptr< const TreeTemplate< Node >>  tree)
inline

Set the tree associated to the data.

All node data will be actualized accordingly by calling the setNode() method on the corresponding nodes.

Warning
: the old tree and the new tree must be two clones! And particularly, they have to share the same topology and nodes id.
Parameters
treeThe tree to be associated to this data.

Definition at line 204 of file DRTreeParsimonyData.h.

References leafData_, nodeData_, bpp::AbstractTreeParsimonyData::setTree(), bpp::AbstractTreeParsimonyData::tree(), and bpp::AbstractTreeParsimonyData::tree_.

◆ tree()

const TreeTemplate<Node>& bpp::AbstractTreeParsimonyData::tree ( ) const
inlineoverridevirtualinherited

Member Data Documentation

◆ leafData_

std::map<int, DRTreeParsimonyLeafData> bpp::DRTreeParsimonyData::leafData_
mutableprivate

Definition at line 165 of file DRTreeParsimonyData.h.

Referenced by init_(), leafData(), operator=(), and setTree().

◆ nbDistinctSites_

size_t bpp::DRTreeParsimonyData::nbDistinctSites_
private

Definition at line 171 of file DRTreeParsimonyData.h.

Referenced by getNumberOfDistinctSites(), init(), init_(), operator=(), and reInit_().

◆ nbSites_

size_t bpp::DRTreeParsimonyData::nbSites_
private

Definition at line 169 of file DRTreeParsimonyData.h.

Referenced by getNumberOfSites(), init(), and operator=().

◆ nbStates_

size_t bpp::DRTreeParsimonyData::nbStates_
private

Definition at line 170 of file DRTreeParsimonyData.h.

Referenced by getNumberOfStates(), init(), init_(), and operator=().

◆ nodeData_

std::map<int, DRTreeParsimonyNodeData> bpp::DRTreeParsimonyData::nodeData_
mutableprivate

◆ rootBitsets_

std::vector<Bitset> bpp::DRTreeParsimonyData::rootBitsets_
mutableprivate

Definition at line 166 of file DRTreeParsimonyData.h.

Referenced by getRootBitset(), getRootBitsets(), init(), and operator=().

◆ rootPatternLinks_

std::vector<size_t> bpp::AbstractTreeParsimonyData::rootPatternLinks_
protectedinherited

◆ rootScores_

std::vector<unsigned int> bpp::DRTreeParsimonyData::rootScores_
mutableprivate

Definition at line 167 of file DRTreeParsimonyData.h.

Referenced by getRootScore(), getRootScores(), init(), and operator=().

◆ rootWeights_

std::vector<unsigned int> bpp::AbstractTreeParsimonyData::rootWeights_
protectedinherited

◆ shrunkData_

std::unique_ptr<SiteContainerInterface> bpp::DRTreeParsimonyData::shrunkData_
private

Definition at line 168 of file DRTreeParsimonyData.h.

Referenced by DRTreeParsimonyData(), init(), and operator=().

◆ tree_


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