bpp-phyl  2.2.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:

Public Member Functions

 MutationPath (const Alphabet *alphabet, size_t initialState, double time)
 Builds a new MutationPath object with initial state 'initialState' and total time 'time'. More...
 
 MutationPath (const MutationPath &path)
 
MutationPathoperator= (const MutationPath &path)
 
virtual ~MutationPath ()
 
const Alphabet * getAlphabet () const
 
void addEvent (size_t state, double time)
 Add a new mutation event. More...
 
size_t getInitialState () const
 Retrieve the initial state. More...
 
double getTotalTime () const
 Retrieve the total time of evolution. More...
 
size_t getNumberOfEvents () const
 Retrieve the number of substitution events. More...
 
template<class Scalar >
void getEventCounts (Matrix< Scalar > &counts) const
 Retrieve the number of substitution events per type of substitution. More...
 
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. More...
 
size_t getFinalState () const
 Retrieve the final state of this path. More...
 

Private Attributes

const Alphabet * alphabet_
 
std::vector< size_t > states_
 The states taken, without initial state. More...
 
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_. More...
 
size_t initialState_
 The initial state. More...
 
double totalTime_
 Total time of evolution. Typically, this is a branch length. More...
 

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

◆ MutationPath() [1/2]

bpp::MutationPath::MutationPath ( const Alphabet *  alphabet,
size_t  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.

◆ MutationPath() [2/2]

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

Definition at line 96 of file MutationProcess.h.

◆ ~MutationPath()

virtual bpp::MutationPath::~MutationPath ( )
inlinevirtual

Definition at line 108 of file MutationProcess.h.

Member Function Documentation

◆ addEvent()

void bpp::MutationPath::addEvent ( size_t  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_.

◆ getAlphabet()

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_.

◆ getEventCounts() [1/2]

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_, initialState_, and states_.

◆ getEventCounts() [2/2]

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_.

◆ getFinalState()

size_t 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().

◆ getInitialState()

size_t 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_.

◆ getNumberOfEvents()

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_.

◆ getTotalTime()

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_.

◆ operator=()

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

◆ alphabet_

const Alphabet* bpp::MutationPath::alphabet_
private

Definition at line 60 of file MutationProcess.h.

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

◆ initialState_

size_t bpp::MutationPath::initialState_
private

The initial state.

Definition at line 76 of file MutationProcess.h.

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

◆ states_

std::vector<size_t> bpp::MutationPath::states_
private

The states taken, without initial state.

Definition at line 65 of file MutationProcess.h.

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

◆ times_

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=().

◆ totalTime_

double bpp::MutationPath::totalTime_
private

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: