bpp-phyl3  3.0.0
bpp::LegacyProbabilisticRewardMapping Class Referenceabstract

Legacy data storage class for probabilistic rewards mappings. More...

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

+ Inheritance diagram for bpp::LegacyProbabilisticRewardMapping:
+ Collaboration diagram for bpp::LegacyProbabilisticRewardMapping:

Public Member Functions

 LegacyProbabilisticRewardMapping (const Tree &tree, std::shared_ptr< const Reward > reward, size_t numberOfSites)
 Build a new LegacyProbabilisticRewardMapping object. More...
 
 LegacyProbabilisticRewardMapping (const Tree &tree)
 Build a new ProbabilisticRewardMapping object. More...
 
LegacyProbabilisticRewardMappingclone () const override
 
 LegacyProbabilisticRewardMapping (const LegacyProbabilisticRewardMapping &prm)=default
 
LegacyProbabilisticRewardMappingoperator= (const LegacyProbabilisticRewardMapping &prm)=default
 
virtual ~LegacyProbabilisticRewardMapping ()
 
virtual double getReward (int nodeId, size_t siteIndex) const
 
virtual void setTree (const Tree &tree)
 (Re)-set the phylogenetic tree associated to this mapping. More...
 
virtual void setNumberOfSites (size_t numberOfSites) override
 
virtual double & operator() (size_t nodeIndex, size_t siteIndex) override
 Direct access to rewards. More...
 
virtual const double & operator() (size_t nodeIndex, size_t siteIndex) const override
 Direct access to rewards. More...
 
std::vector< double > & operator[] (size_t siteIndex)
 Direct access to rewards. More...
 
const std::vector< double > & operator[] (size_t siteIndex) const
 Direct access to rewards. More...
 
virtual const Treetree () const =0
 
const TreeTemplate< Node > & tree () const override
 
virtual bool isEmpty () const =0
 
bool isEmpty () const override
 
virtual size_t getNumberOfSites () const =0
 
size_t getNumberOfSites () const override
 
virtual size_t getNumberOfBranches () const =0
 
size_t getNumberOfBranches () const override
 
virtual int getSitePosition (size_t index) const =0
 
int getSitePosition (size_t index) const override
 
virtual std::vector< double > getBranchLengths () const =0
 
virtual std::vector< double > getBranchLengths () const override
 
virtual size_t getNodeIndex (int nodeId) const =0
 
virtual size_t getNodeIndex (int nodeId) const override
 
virtual void setSitePosition (size_t index, int position)=0
 Set the position of a given site. More...
 
void setSitePosition (size_t index, int position) override
 Set the position of a given site. More...
 
virtual const NodegetNode (size_t nodeIndex) const
 

Private Attributes

std::shared_ptr< const Rewardreward_
 
std::vector< std::vector< double > > mapping_
 Rewards storage. More...
 
std::unique_ptr< const TreeTemplate< Node > > tree_
 
std::vector< int > sitesPositions_
 
std::vector< const Node * > nodes_
 
size_t nbSites_
 
size_t nbBranches_
 

Detailed Description

Legacy data storage class for probabilistic rewards mappings.

A 'probabilistic' mapping contains an single value for each branch and each site. This number is an average reward. Probabilistic was coined there by opposition to the'stochastic' mapping, where a path (sequence of rewards along the branch) is available for each branch and site.

Definition at line 28 of file ProbabilisticRewardMapping.h.

Constructor & Destructor Documentation

◆ LegacyProbabilisticRewardMapping() [1/3]

bpp::LegacyProbabilisticRewardMapping::LegacyProbabilisticRewardMapping ( const Tree tree,
std::shared_ptr< const Reward reward,
size_t  numberOfSites 
)
inline

Build a new LegacyProbabilisticRewardMapping object.

Parameters
treeThe tree object to use. It will be cloned for internal use.
rewardA pointer toward the Reward object that has been used for the mapping, if any.
numberOfSitesThe number of sites to map.

Definition at line 49 of file ProbabilisticRewardMapping.h.

References setNumberOfSites().

Referenced by clone().

◆ LegacyProbabilisticRewardMapping() [2/3]

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

Build a new ProbabilisticRewardMapping object.

Parameters
treeThe tree object to use. It will be cloned for internal use.

Definition at line 62 of file ProbabilisticRewardMapping.h.

◆ LegacyProbabilisticRewardMapping() [3/3]

bpp::LegacyProbabilisticRewardMapping::LegacyProbabilisticRewardMapping ( const LegacyProbabilisticRewardMapping prm)
default

◆ ~LegacyProbabilisticRewardMapping()

virtual bpp::LegacyProbabilisticRewardMapping::~LegacyProbabilisticRewardMapping ( )
inlinevirtual

Definition at line 78 of file ProbabilisticRewardMapping.h.

Member Function Documentation

◆ clone()

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

◆ getBranchLengths() [1/2]

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

Implemented in bpp::LegacyAbstractMapping.

◆ getBranchLengths() [2/2]

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

Implements bpp::LegacyMappingInterface.

Definition at line 174 of file Mapping.h.

References bpp::LegacyAbstractMapping::nbBranches_, and bpp::LegacyAbstractMapping::nodes_.

◆ getNode()

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

◆ getNodeIndex() [1/2]

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

Implemented in bpp::LegacyAbstractMapping.

◆ getNodeIndex() [2/2]

virtual size_t bpp::LegacyAbstractMapping::getNodeIndex ( int  nodeId) const
inlineoverridevirtualinherited

◆ getNumberOfBranches() [1/2]

◆ getNumberOfBranches() [2/2]

size_t bpp::LegacyAbstractMapping::getNumberOfBranches ( ) const
inlineoverridevirtualinherited

◆ getNumberOfSites() [1/2]

virtual size_t bpp::LegacyMappingInterface::getNumberOfSites ( ) const
pure virtualinherited

◆ getNumberOfSites() [2/2]

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

◆ getReward()

virtual double bpp::LegacyProbabilisticRewardMapping::getReward ( int  nodeId,
size_t  siteIndex 
) const
inlinevirtual

◆ getSitePosition() [1/2]

virtual int bpp::LegacyMappingInterface::getSitePosition ( size_t  index) const
pure virtualinherited
Parameters
indexThe site index.
Returns
The site position corresponding to the index.

Implemented in bpp::LegacyAbstractMapping.

◆ getSitePosition() [2/2]

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

Implements bpp::LegacyMappingInterface.

Definition at line 146 of file Mapping.h.

References bpp::LegacyAbstractMapping::isEmpty(), and bpp::LegacyAbstractMapping::sitesPositions_.

◆ isEmpty() [1/2]

virtual bool bpp::LegacyMappingInterface::isEmpty ( ) const
pure virtualinherited
Returns
True is the map is empty, that is, if no tree is associated to the map yet.

Implemented in bpp::LegacyAbstractMapping.

◆ isEmpty() [2/2]

bool bpp::LegacyAbstractMapping::isEmpty ( ) const
inlineoverridevirtualinherited
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 bpp::LegacyAbstractMapping::tree_.

Referenced by bpp::LegacyAbstractMapping::getSitePosition(), bpp::LegacyAbstractMapping::setSitePosition(), and bpp::LegacyAbstractMapping::tree().

◆ operator()() [1/2]

virtual const double& bpp::LegacyProbabilisticRewardMapping::operator() ( size_t  nodeIndex,
size_t  siteIndex 
) const
inlineoverridevirtual

Direct access to rewards.

Warning
No index checking is performed, use with care!

Implements bpp::LegacyRewardMappingInterface.

Definition at line 110 of file ProbabilisticRewardMapping.h.

References mapping_.

◆ operator()() [2/2]

virtual double& bpp::LegacyProbabilisticRewardMapping::operator() ( size_t  nodeIndex,
size_t  siteIndex 
)
inlineoverridevirtual

Direct access to rewards.

Warning
No index checking is performed, use with care!

Implements bpp::LegacyRewardMappingInterface.

Definition at line 100 of file ProbabilisticRewardMapping.h.

References mapping_.

◆ operator=()

LegacyProbabilisticRewardMapping& bpp::LegacyProbabilisticRewardMapping::operator= ( const LegacyProbabilisticRewardMapping prm)
default

◆ operator[]() [1/2]

std::vector<double>& bpp::LegacyProbabilisticRewardMapping::operator[] ( size_t  siteIndex)
inline

Direct access to rewards.

Warning
No index checking is performed, use with care!

Definition at line 120 of file ProbabilisticRewardMapping.h.

References mapping_.

◆ operator[]() [2/2]

const std::vector<double>& bpp::LegacyProbabilisticRewardMapping::operator[] ( size_t  siteIndex) const
inline

Direct access to rewards.

Warning
No index checking is performed, use with care!

Definition at line 130 of file ProbabilisticRewardMapping.h.

References mapping_.

◆ setNumberOfSites()

void LegacyProbabilisticRewardMapping::setNumberOfSites ( size_t  numberOfSites)
overridevirtual

◆ setSitePosition() [1/2]

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

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 bpp::LegacyAbstractMapping::isEmpty(), and bpp::LegacyAbstractMapping::sitesPositions_.

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

◆ setSitePosition() [2/2]

virtual void bpp::LegacyMappingInterface::setSitePosition ( size_t  index,
int  position 
)
pure virtualinherited

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.

Implemented in bpp::LegacyAbstractMapping.

◆ setTree()

void LegacyProbabilisticRewardMapping::setTree ( const Tree tree)
virtual

(Re)-set the phylogenetic tree associated to this mapping.

Parameters
treeThe new tree.

Definition at line 9 of file ProbabilisticRewardMapping.cpp.

References bpp::LegacyAbstractMapping::getNumberOfBranches(), bpp::LegacyAbstractMapping::getNumberOfSites(), mapping_, bpp::LegacyAbstractMapping::setTree(), and bpp::LegacyAbstractMapping::tree().

◆ tree() [1/2]

virtual const Tree& bpp::LegacyMappingInterface::tree ( ) const
pure virtualinherited
Returns
Get the phylogenetic tree associated to this mapping.

Implemented in bpp::LegacyAbstractMapping.

◆ tree() [2/2]

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

Implements bpp::LegacyMappingInterface.

Definition at line 132 of file Mapping.h.

References bpp::LegacyAbstractMapping::isEmpty(), and bpp::LegacyAbstractMapping::tree_.

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

Member Data Documentation

◆ mapping_

std::vector<std::vector<double> > bpp::LegacyProbabilisticRewardMapping::mapping_
private

Rewards storage.

Rewards are stored by sites.

Definition at line 39 of file ProbabilisticRewardMapping.h.

Referenced by getReward(), operator()(), operator[](), setNumberOfSites(), and setTree().

◆ nbBranches_

◆ nbSites_

size_t bpp::LegacyAbstractMapping::nbSites_
privateinherited

◆ nodes_

◆ reward_

std::shared_ptr<const Reward> bpp::LegacyProbabilisticRewardMapping::reward_
private

Definition at line 32 of file ProbabilisticRewardMapping.h.

◆ sitesPositions_

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

◆ tree_


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