bpp-phyl  2.1.0
 All Classes Namespaces Files Functions Variables Friends Pages
bpp::ProbabilisticSubstitutionMapping Class Reference

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

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

+ Inheritance diagram for bpp::ProbabilisticSubstitutionMapping:
+ Collaboration diagram for bpp::ProbabilisticSubstitutionMapping:

Public Member Functions

 ProbabilisticSubstitutionMapping (const Tree &tree, const SubstitutionCount *sc, size_t numberOfSites)
 Build a new ProbabilisticSubstitutionMapping object. More...
 
 ProbabilisticSubstitutionMapping (const Tree &tree)
 Build a new ProbabilisticSubstitutionMapping object. More...
 
ProbabilisticSubstitutionMappingclone () const
 
 ProbabilisticSubstitutionMapping (const ProbabilisticSubstitutionMapping &psm)
 
ProbabilisticSubstitutionMappingoperator= (const ProbabilisticSubstitutionMapping &psm)
 
virtual ~ProbabilisticSubstitutionMapping ()
 
size_t getNumberOfSubstitutionTypes () const
 
virtual double getNumberOfSubstitutions (int nodeId, size_t siteIndex, size_t type) const
 
virtual std::vector< double > getNumberOfSubstitutions (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, size_t type)
 Direct access to substitution numbers. More...
 
virtual const double & operator() (size_t nodeIndex, size_t siteIndex, size_t type) const
 Direct access to substitution numbers. More...
 
std::vector< std::vector
< double > > & 
operator[] (size_t siteIndex)
 Direct access to substitution numbers. More...
 
const std::vector< std::vector
< double > > & 
operator[] (size_t siteIndex) const
 Direct access to substitution numbers. More...
 
bool isEmpty () const
 
const TreeTemplate< Node > & getTree () const throw (Exception)
 
int getSitePosition (size_t index) const throw (Exception)
 
void setSitePosition (size_t index, int position) throw (Exception)
 Set the position of a given site. More...
 
size_t getNumberOfSites () const
 
size_t getNumberOfBranches () const
 
virtual const NodegetNode (size_t nodeIndex) const
 
virtual std::vector< double > getBranchLengths () const
 
virtual size_t getNodeIndex (int nodeId) const throw (NodeNotFoundException)
 

Private Attributes

const SubstitutionCountsubstitutionCount_
 
std::vector< std::vector
< std::vector< double > > > 
mapping_
 Substitution numbers storage. More...
 

Detailed Description

Data storage class for probabilistic substitution mappings.

A 'probabilistic' mapping contains an single value for each branch and each site. This number can be an average number of substitutions, optionally waited, or a probability of observing a certain number of substitutions. Probabilistic was coined there by opposition to the'stochastic' mapping, where a path (number of susbstitutions + there position along the branch) is available for each branch and site. The probabilistic mapping can however be extended to contain a matrix will all types of substitutions, instead of their total number.

Definition at line 63 of file ProbabilisticSubstitutionMapping.h.

Constructor & Destructor Documentation

bpp::ProbabilisticSubstitutionMapping::ProbabilisticSubstitutionMapping ( const Tree tree,
const SubstitutionCount sc,
size_t  numberOfSites 
)
inline

Build a new ProbabilisticSubstitutionMapping object.

Parameters
treeThe tree object to use. It will be cloned for internal use.
scA pointer toward the substitution count object that has been used for the mapping, if any. This object allows to get the substitution types description, if there are several. If set to 0, then the mapping will be considered as having only one type of substitution mapped.
numberOfSitesThe number of sites to map.

Definition at line 86 of file ProbabilisticSubstitutionMapping.h.

References setNumberOfSites().

Referenced by clone().

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

Build a new ProbabilisticSubstitutionMapping object.

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

Definition at line 97 of file ProbabilisticSubstitutionMapping.h.

bpp::ProbabilisticSubstitutionMapping::ProbabilisticSubstitutionMapping ( const ProbabilisticSubstitutionMapping psm)
inline

Definition at line 104 of file ProbabilisticSubstitutionMapping.h.

virtual bpp::ProbabilisticSubstitutionMapping::~ProbabilisticSubstitutionMapping ( )
inlinevirtual

Definition at line 116 of file ProbabilisticSubstitutionMapping.h.

Member Function Documentation

ProbabilisticSubstitutionMapping* bpp::ProbabilisticSubstitutionMapping::clone ( ) const
inlinevirtual
virtual std::vector<double> bpp::AbstractSubstitutionMapping::getBranchLengths ( ) const
inlinevirtualinherited
virtual const Node* bpp::AbstractSubstitutionMapping::getNode ( size_t  nodeIndex) const
inlinevirtualinherited

Definition at line 223 of file SubstitutionMapping.h.

References bpp::AbstractSubstitutionMapping::nodes_.

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

Implements bpp::SubstitutionMapping.

Definition at line 241 of file SubstitutionMapping.h.

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

Referenced by getNumberOfSubstitutions(), and getNumberOfSubstitutions().

size_t bpp::AbstractSubstitutionMapping::getNumberOfBranches ( ) const
inlinevirtualinherited
Returns
The number of branches mapped.

Implements bpp::SubstitutionMapping.

Definition at line 221 of file SubstitutionMapping.h.

References bpp::AbstractSubstitutionMapping::nbBranches_.

Referenced by setNumberOfSites(), setNumberOfSites(), setTree(), and setTree().

size_t bpp::AbstractSubstitutionMapping::getNumberOfSites ( ) const
inlinevirtualinherited
Returns
The number of sites mapped.

Implements bpp::SubstitutionMapping.

Definition at line 219 of file SubstitutionMapping.h.

References bpp::AbstractSubstitutionMapping::nbSites_.

Referenced by setTree().

virtual double bpp::ProbabilisticSubstitutionMapping::getNumberOfSubstitutions ( int  nodeId,
size_t  siteIndex,
size_t  type 
) const
inlinevirtual
virtual std::vector<double> bpp::ProbabilisticSubstitutionMapping::getNumberOfSubstitutions ( int  nodeId,
size_t  siteIndex 
) const
inlinevirtual
size_t bpp::ProbabilisticSubstitutionMapping::getNumberOfSubstitutionTypes ( ) const
inlinevirtual
Returns
The number of distinct types of substitutions mapped.

Implements bpp::SubstitutionMapping.

Definition at line 120 of file ProbabilisticSubstitutionMapping.h.

References substitutionCount_, and substitutionCount_.

Referenced by setNumberOfSites().

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

Implements bpp::SubstitutionMapping.

Definition at line 207 of file SubstitutionMapping.h.

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

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

Implements bpp::SubstitutionMapping.

Definition at line 193 of file SubstitutionMapping.h.

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

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

Implements bpp::SubstitutionMapping.

Definition at line 191 of file SubstitutionMapping.h.

References bpp::AbstractSubstitutionMapping::tree_.

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

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

Direct access to substitution numbers.

Warning
No index checking is performed, use with care!

Implements bpp::SubstitutionMapping.

Definition at line 150 of file ProbabilisticSubstitutionMapping.h.

References mapping_.

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

Direct access to substitution numbers.

Warning
No index checking is performed, use with care!

Implements bpp::SubstitutionMapping.

Definition at line 160 of file ProbabilisticSubstitutionMapping.h.

References mapping_.

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

Direct access to substitution numbers.

Warning
No index checking is performed, use with care!

Definition at line 170 of file ProbabilisticSubstitutionMapping.h.

References mapping_.

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

Direct access to substitution numbers.

Warning
No index checking is performed, use with care!

Definition at line 180 of file ProbabilisticSubstitutionMapping.h.

References mapping_.

void bpp::AbstractSubstitutionMapping::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::SubstitutionMapping.

Definition at line 213 of file SubstitutionMapping.h.

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

void ProbabilisticSubstitutionMapping::setTree ( const Tree tree)
virtual

Member Data Documentation

std::vector< std::vector< std::vector<double> > > bpp::ProbabilisticSubstitutionMapping::mapping_
private
const SubstitutionCount* bpp::ProbabilisticSubstitutionMapping::substitutionCount_
private

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