bpp-phyl  2.2.0
bpp::ProbabilisticRewardMapping Class Referenceabstract

Data storage class for probabilistic rewards mappings. More...

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

+ Inheritance diagram for bpp::ProbabilisticRewardMapping:
+ Collaboration diagram for bpp::ProbabilisticRewardMapping:

Public Member Functions

 ProbabilisticRewardMapping (const Tree &tree, const Reward *reward, size_t numberOfSites)
 Build a new ProbabilisticRewardMapping object. More...
 
 ProbabilisticRewardMapping (const Tree &tree)
 Build a new ProbabilisticRewardMapping object. More...
 
ProbabilisticRewardMappingclone () const
 
 ProbabilisticRewardMapping (const ProbabilisticRewardMapping &prm)
 
ProbabilisticRewardMappingoperator= (const ProbabilisticRewardMapping &prm)
 
virtual ~ProbabilisticRewardMapping ()
 
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)
 
virtual double & operator() (size_t nodeIndex, size_t siteIndex)
 Direct access to rewards. More...
 
virtual const double & operator() (size_t nodeIndex, size_t siteIndex) const
 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 TreegetTree () const =0
 
const TreeTemplate< Node > & getTree () const throw (Exception)
 
virtual bool isEmpty () const =0
 
bool isEmpty () const
 
virtual size_t getNumberOfSites () const =0
 
size_t getNumberOfSites () const
 
virtual size_t getNumberOfBranches () const =0
 
size_t getNumberOfBranches () const
 
virtual int getSitePosition (size_t index) const =0
 
int getSitePosition (size_t index) const throw (Exception)
 
virtual std::vector< double > getBranchLengths () const =0
 
virtual std::vector< double > getBranchLengths () const
 
virtual size_t getNodeIndex (int nodeId) const =0 throw (NodeNotFoundException)
 
virtual size_t getNodeIndex (int nodeId) const throw (NodeNotFoundException)
 
virtual void setSitePosition (size_t index, int position)=0
 Set the position of a given site. More...
 
void setSitePosition (size_t index, int position) throw (Exception)
 Set the position of a given site. More...
 
virtual const NodegetNode (size_t nodeIndex) const
 

Private Attributes

const Rewardreward_
 
std::vector< std::vector< double > > mapping_
 Rewards storage. More...
 

Detailed Description

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 64 of file ProbabilisticRewardMapping.h.

Constructor & Destructor Documentation

◆ ProbabilisticRewardMapping() [1/3]

bpp::ProbabilisticRewardMapping::ProbabilisticRewardMapping ( const Tree tree,
const Reward reward,
size_t  numberOfSites 
)
inline

Build a new ProbabilisticRewardMapping 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 85 of file ProbabilisticRewardMapping.h.

References setNumberOfSites().

Referenced by clone().

◆ ProbabilisticRewardMapping() [2/3]

bpp::ProbabilisticRewardMapping::ProbabilisticRewardMapping ( 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 96 of file ProbabilisticRewardMapping.h.

◆ ProbabilisticRewardMapping() [3/3]

bpp::ProbabilisticRewardMapping::ProbabilisticRewardMapping ( const ProbabilisticRewardMapping prm)
inline

Definition at line 103 of file ProbabilisticRewardMapping.h.

◆ ~ProbabilisticRewardMapping()

virtual bpp::ProbabilisticRewardMapping::~ProbabilisticRewardMapping ( )
inlinevirtual

Definition at line 115 of file ProbabilisticRewardMapping.h.

Member Function Documentation

◆ clone()

ProbabilisticRewardMapping* bpp::ProbabilisticRewardMapping::clone ( ) const
inlinevirtual

Implements bpp::AbstractRewardMapping.

Definition at line 101 of file ProbabilisticRewardMapping.h.

References ProbabilisticRewardMapping().

◆ getBranchLengths() [1/2]

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

Implemented in bpp::AbstractMapping.

◆ getBranchLengths() [2/2]

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

Implements bpp::Mapping.

Definition at line 222 of file Mapping.h.

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

◆ getNode()

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

Definition at line 212 of file Mapping.h.

References bpp::AbstractMapping::nodes_.

◆ getNodeIndex() [1/2]

virtual size_t bpp::Mapping::getNodeIndex ( int  nodeId) const
throw (NodeNotFoundException
)
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::AbstractMapping.

◆ getNodeIndex() [2/2]

virtual size_t bpp::AbstractMapping::getNodeIndex ( int  nodeId) const
throw (NodeNotFoundException
)
inlinevirtualinherited

◆ getNumberOfBranches() [1/2]

virtual size_t bpp::Mapping::getNumberOfBranches ( ) const
pure virtualinherited

◆ getNumberOfBranches() [2/2]

size_t bpp::AbstractMapping::getNumberOfBranches ( ) const
inlinevirtualinherited

◆ getNumberOfSites() [1/2]

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

◆ getNumberOfSites() [2/2]

◆ getReward()

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

Definition at line 119 of file ProbabilisticRewardMapping.h.

References bpp::AbstractMapping::getNodeIndex(), and mapping_.

◆ getSitePosition() [1/2]

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

Implemented in bpp::AbstractMapping.

◆ getSitePosition() [2/2]

int bpp::AbstractMapping::getSitePosition ( size_t  index) const
throw (Exception
)
inlinevirtualinherited
Parameters
indexThe site index.
Returns
The site position corresponding to the index.

Implements bpp::Mapping.

Definition at line 196 of file Mapping.h.

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

◆ getTree() [1/2]

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

Implemented in bpp::AbstractMapping.

◆ getTree() [2/2]

const TreeTemplate<Node>& bpp::AbstractMapping::getTree ( ) const
throw (Exception
)
inlinevirtualinherited
Returns
Get the phylogenetic tree associated to this mapping.

Implements bpp::Mapping.

Definition at line 182 of file Mapping.h.

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

◆ isEmpty() [1/2]

virtual bool bpp::Mapping::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::AbstractMapping.

◆ isEmpty() [2/2]

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

Implements bpp::Mapping.

Definition at line 180 of file Mapping.h.

References bpp::AbstractMapping::tree_.

Referenced by bpp::AbstractMapping::getSitePosition(), bpp::AbstractMapping::getTree(), and bpp::AbstractMapping::setSitePosition().

◆ operator()() [1/2]

virtual double& bpp::ProbabilisticRewardMapping::operator() ( size_t  nodeIndex,
size_t  siteIndex 
)
inlinevirtual

Direct access to rewards.

Warning
No index checking is performed, use with care!

Implements bpp::RewardMapping.

Definition at line 138 of file ProbabilisticRewardMapping.h.

References mapping_.

◆ operator()() [2/2]

virtual const double& bpp::ProbabilisticRewardMapping::operator() ( size_t  nodeIndex,
size_t  siteIndex 
) const
inlinevirtual

Direct access to rewards.

Warning
No index checking is performed, use with care!

Implements bpp::RewardMapping.

Definition at line 148 of file ProbabilisticRewardMapping.h.

References mapping_.

◆ operator=()

ProbabilisticRewardMapping& bpp::ProbabilisticRewardMapping::operator= ( const ProbabilisticRewardMapping prm)
inline

◆ operator[]() [1/2]

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

Direct access to rewards.

Warning
No index checking is performed, use with care!

Definition at line 158 of file ProbabilisticRewardMapping.h.

References mapping_.

◆ operator[]() [2/2]

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

Direct access to rewards.

Warning
No index checking is performed, use with care!

Definition at line 168 of file ProbabilisticRewardMapping.h.

References mapping_.

◆ setNumberOfSites()

void ProbabilisticRewardMapping::setNumberOfSites ( size_t  numberOfSites)
virtual

◆ setSitePosition() [1/2]

virtual void bpp::Mapping::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::AbstractMapping.

◆ setSitePosition() [2/2]

void bpp::AbstractMapping::setSitePosition ( size_t  index,
int  position 
)
throw (Exception
)
inlinevirtualinherited

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::Mapping.

Definition at line 202 of file Mapping.h.

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

◆ setTree()

void ProbabilisticRewardMapping::setTree ( const Tree tree)
virtual

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

Parameters
treeThe new tree.

Definition at line 44 of file ProbabilisticRewardMapping.cpp.

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

Member Data Documentation

◆ mapping_

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

Rewards storage.

Rewards are stored by sites.

Definition at line 74 of file ProbabilisticRewardMapping.h.

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

◆ reward_

const Reward* bpp::ProbabilisticRewardMapping::reward_
private

Definition at line 68 of file ProbabilisticRewardMapping.h.

Referenced by operator=().


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