bpp-phyl  2.1.0
bpp::MutationPath Class Reference

This class is used by MutationProcess to store detailed results of simulations. More...

#include <Bpp/Phyl/Simulation/MutationProcess.h>

+ Collaboration diagram for bpp::MutationPath:

List of all members.

Public Member Functions

 MutationPath (const Alphabet *alphabet, int initialState, double time)
 Builds a new MutationPath object with initial state 'initialState' and total time 'time'.
 MutationPath (const MutationPath &path)
MutationPathoperator= (const MutationPath &path)
virtual ~MutationPath ()
const AlphabetgetAlphabet () const
void addEvent (int state, double time)
 Add a new mutation event.
int getInitialState () const
 Retrieve the initial state.
double getTotalTime () const
 Retrieve the total time of evolution.
size_t getNumberOfEvents () const
 Retrieve the number of substitution events.
template<class Scalar >
void getEventCounts (Matrix< Scalar > &counts) const
 Retrieve the number of substitution events per type of substitution.
template<class Scalar >
void getEventCounts (std::vector< Scalar > &counts, const SubstitutionRegister &reg) const
 Retrieve the number of substitution events per type of substitution, defined by a SubstitutionRegister object.
int getFinalState () const
 Retrieve the final state of this path.

Private Attributes

const Alphabetalphabet_
std::vector< int > states_
 The states taken, without intiial state.
std::vector< double > times_
 Times between states. The first element in array is the time between the initial state and the first state in states_.
int initialState_
 The initial state.
double totalTime_
 Total time of evolution. Typically, this is a branch length.

Detailed Description

This class is used by MutationProcess to store detailed results of simulations.

Author:
Julien Dutheil

Definition at line 56 of file MutationProcess.h.


Constructor & Destructor Documentation

bpp::MutationPath::MutationPath ( const Alphabet alphabet,
int  initialState,
double  time 
) [inline]

Builds a new MutationPath object with initial state 'initialState' and total time 'time'.

Parameters:
alphabetThe alphabet associated to the states in this path.
initialStateThe initial state.
timeThe total time of evolution.

Definition at line 93 of file MutationProcess.h.

bpp::MutationPath::MutationPath ( const MutationPath path) [inline]

Definition at line 96 of file MutationProcess.h.

virtual bpp::MutationPath::~MutationPath ( ) [inline, virtual]

Definition at line 108 of file MutationProcess.h.


Member Function Documentation

void bpp::MutationPath::addEvent ( int  state,
double  time 
) [inline]

Add a new mutation event.

Parameters:
stateThe new state after mutation event.
timeThe time between this mutation and previous mutation (or initial state).

Definition at line 123 of file MutationProcess.h.

References states_, and times_.

const Alphabet* bpp::MutationPath::getAlphabet ( ) const [inline]
Returns:
A pointer toward the alphabet associated to this path.

Definition at line 115 of file MutationProcess.h.

References alphabet_.

template<class Scalar >
void bpp::MutationPath::getEventCounts ( Matrix< Scalar > &  counts) const [inline]

Retrieve the number of substitution events per type of substitution.

Parameters:
countsA matrix with the same size as the alphabet. The substitution counts will be incremented according to the mutation path, which allows to efficiently sum various mutation paths with a look.

Definition at line 155 of file MutationProcess.h.

References alphabet_, bpp::Matrix< Scalar >::getNumberOfColumns(), bpp::Matrix< Scalar >::getNumberOfRows(), bpp::Alphabet::getSize(), initialState_, and states_.

template<class Scalar >
void bpp::MutationPath::getEventCounts ( std::vector< Scalar > &  counts,
const SubstitutionRegister reg 
) const [inline]

Retrieve the number of substitution events per type of substitution, defined by a SubstitutionRegister object.

Parameters:
countsA vector with the appropriate size, as defined by SubstitutionRegister::getNumberOfSubstitutionTypes(). The substitution counts will be incremented according to the mutation path, which allows to efficiently sum various mutation paths with a look.
regThe substitution register to use to categorize substitutions.

Definition at line 174 of file MutationProcess.h.

References bpp::SubstitutionRegister::getNumberOfSubstitutionTypes(), bpp::SubstitutionRegister::getType(), initialState_, and states_.

int bpp::MutationPath::getFinalState ( ) const [inline]

Retrieve the final state of this path.

Returns:
The initial state if no mutation occured, otherwise sends the state after last mutation event.

Definition at line 191 of file MutationProcess.h.

References initialState_, and states_.

Referenced by bpp::SiteSimulationResult::addNode().

int bpp::MutationPath::getInitialState ( ) const [inline]

Retrieve the initial state.

Returns:
The initial state of this path.

Definition at line 133 of file MutationProcess.h.

References initialState_.

size_t bpp::MutationPath::getNumberOfEvents ( ) const [inline]

Retrieve the number of substitution events.

Returns:
The number of substitution events, i.e. the number of states (without initial state).

Definition at line 147 of file MutationProcess.h.

References states_.

double bpp::MutationPath::getTotalTime ( ) const [inline]

Retrieve the total time of evolution.

Returns:
The total time of evolution.

Definition at line 140 of file MutationProcess.h.

References totalTime_.

MutationPath& bpp::MutationPath::operator= ( const MutationPath path) [inline]

Definition at line 99 of file MutationProcess.h.

References alphabet_, initialState_, states_, times_, and totalTime_.


Member Data Documentation

Definition at line 60 of file MutationProcess.h.

Referenced by getAlphabet(), getEventCounts(), and operator=().

The initial state.

Definition at line 76 of file MutationProcess.h.

Referenced by getEventCounts(), getFinalState(), getInitialState(), and operator=().

std::vector<int> bpp::MutationPath::states_ [private]

The states taken, without intiial state.

Definition at line 65 of file MutationProcess.h.

Referenced by addEvent(), getEventCounts(), getFinalState(), getNumberOfEvents(), and operator=().

std::vector<double> bpp::MutationPath::times_ [private]

Times between states. The first element in array is the time between the initial state and the first state in states_.

Definition at line 71 of file MutationProcess.h.

Referenced by addEvent(), and operator=().

Total time of evolution. Typically, this is a branch length.

Definition at line 82 of file MutationProcess.h.

Referenced by getTotalTime(), and operator=().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends