bpp-phyl3  3.0.0
bpp::LegacyAbstractMapping Class Referenceabstract

Partial implementation of the mapping interface. More...

#include <Bpp/Phyl/Legacy/Mapping/Mapping.h>

+ Inheritance diagram for bpp::LegacyAbstractMapping:
+ Collaboration diagram for bpp::LegacyAbstractMapping:

Public Member Functions

 LegacyAbstractMapping (const Tree &tree)
 
 LegacyAbstractMapping (const LegacyAbstractMapping &absm)
 
LegacyAbstractMappingoperator= (const LegacyAbstractMapping &absm)
 
LegacyAbstractMappingclone () const override=0
 
virtual ~LegacyAbstractMapping ()
 
bool isEmpty () const override
 
const TreeTemplate< Node > & tree () const override
 
void setTree (const Tree &tree)
 
int getSitePosition (size_t index) const override
 
void setSitePosition (size_t index, int position) override
 Set the position of a given site. More...
 
size_t getNumberOfSites () const override
 
size_t getNumberOfBranches () const override
 
virtual const NodegetNode (size_t nodeIndex) const
 
virtual void setNumberOfSites (size_t numberOfSites)
 
virtual std::vector< double > getBranchLengths () const override
 
virtual size_t getNodeIndex (int nodeId) const override
 

Private Attributes

std::unique_ptr< const TreeTemplate< Node > > tree_
 
std::vector< int > sitesPositions_
 
std::vector< const Node * > nodes_
 
size_t nbSites_
 
size_t nbBranches_
 

Detailed Description

Partial implementation of the mapping interface.

This implementation copies the input tree in a TreeTemplate<Node> object.

Definition at line 85 of file Mapping.h.

Constructor & Destructor Documentation

◆ LegacyAbstractMapping() [1/2]

bpp::LegacyAbstractMapping::LegacyAbstractMapping ( const Tree tree)
inline

Definition at line 96 of file Mapping.h.

References nbBranches_, nodes_, and tree_.

◆ LegacyAbstractMapping() [2/2]

bpp::LegacyAbstractMapping::LegacyAbstractMapping ( const LegacyAbstractMapping absm)
inline

Definition at line 103 of file Mapping.h.

References nodes_, and tree_.

◆ ~LegacyAbstractMapping()

virtual bpp::LegacyAbstractMapping::~LegacyAbstractMapping ( )
inlinevirtual

Definition at line 127 of file Mapping.h.

Member Function Documentation

◆ clone()

◆ getBranchLengths()

virtual std::vector<double> bpp::LegacyAbstractMapping::getBranchLengths ( ) const
inlineoverridevirtual
Returns
A vector with all tree branch lengths.

Implements bpp::LegacyMappingInterface.

Definition at line 174 of file Mapping.h.

References nbBranches_, and nodes_.

◆ getNode()

virtual const Node* bpp::LegacyAbstractMapping::getNode ( size_t  nodeIndex) const
inlinevirtual

◆ getNodeIndex()

virtual size_t bpp::LegacyAbstractMapping::getNodeIndex ( int  nodeId) const
inlineoverridevirtual
Parameters
nodeIdAn id of the node to look for in the map.
Returns
The mapping index for the specified node id.

Implements bpp::LegacyMappingInterface.

Definition at line 184 of file Mapping.h.

References nbBranches_, nodes_, and bpp::TextTools::toString().

Referenced by bpp::LegacyProbabilisticSubstitutionMapping::getNumberOfSubstitutions(), bpp::LegacyProbabilisticRewardMapping::getReward(), bpp::LegacyRewardMappingTools::readFromStream(), and bpp::LegacySubstitutionMappingTools::readFromStream().

◆ getNumberOfBranches()

◆ getNumberOfSites()

size_t bpp::LegacyAbstractMapping::getNumberOfSites ( ) const
inlineoverridevirtual

◆ getSitePosition()

int bpp::LegacyAbstractMapping::getSitePosition ( size_t  index) const
inlineoverridevirtual
Parameters
indexThe site index.
Returns
The site position corresponding to the index.

Implements bpp::LegacyMappingInterface.

Definition at line 146 of file Mapping.h.

References isEmpty(), and sitesPositions_.

◆ isEmpty()

bool bpp::LegacyAbstractMapping::isEmpty ( ) const
inlineoverridevirtual
Returns
True is the map is empty, that is, if no tree is associated to the map yet.

Implements bpp::LegacyMappingInterface.

Definition at line 130 of file Mapping.h.

References tree_.

Referenced by getSitePosition(), setSitePosition(), and tree().

◆ operator=()

LegacyAbstractMapping& bpp::LegacyAbstractMapping::operator= ( const LegacyAbstractMapping absm)
inline

Definition at line 114 of file Mapping.h.

References nbBranches_, nbSites_, nodes_, sitesPositions_, and tree_.

◆ setNumberOfSites()

virtual void bpp::LegacyAbstractMapping::setNumberOfSites ( size_t  numberOfSites)
inlinevirtual

◆ setSitePosition()

void bpp::LegacyAbstractMapping::setSitePosition ( size_t  index,
int  position 
)
inlineoverridevirtual

Set the position of a given site.

Warning
No index checking is performed, use with care!
Parameters
indexThe site index.
positionThe position of the site.

Implements bpp::LegacyMappingInterface.

Definition at line 152 of file Mapping.h.

References isEmpty(), and sitesPositions_.

Referenced by bpp::LegacyRewardMappingTools::readFromStream(), and bpp::LegacySubstitutionMappingTools::readFromStream().

◆ setTree()

void bpp::LegacyAbstractMapping::setTree ( const Tree tree)
inline

◆ tree()

const TreeTemplate<Node>& bpp::LegacyAbstractMapping::tree ( ) const
inlineoverridevirtual
Returns
Get the phylogenetic tree associated to this mapping.

Implements bpp::LegacyMappingInterface.

Definition at line 132 of file Mapping.h.

References isEmpty(), and tree_.

Referenced by setTree(), bpp::LegacyProbabilisticRewardMapping::setTree(), and bpp::LegacyProbabilisticSubstitutionMapping::setTree().

Member Data Documentation

◆ nbBranches_

size_t bpp::LegacyAbstractMapping::nbBranches_
private

◆ nbSites_

size_t bpp::LegacyAbstractMapping::nbSites_
private

Definition at line 92 of file Mapping.h.

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

◆ nodes_

std::vector<const Node*> bpp::LegacyAbstractMapping::nodes_
private

◆ sitesPositions_

std::vector<int> bpp::LegacyAbstractMapping::sitesPositions_
private

Definition at line 90 of file Mapping.h.

Referenced by getSitePosition(), operator=(), setNumberOfSites(), and setSitePosition().

◆ tree_

std::unique_ptr<const TreeTemplate<Node> > bpp::LegacyAbstractMapping::tree_
private

Definition at line 89 of file Mapping.h.

Referenced by isEmpty(), LegacyAbstractMapping(), operator=(), setTree(), and tree().


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