|
bpp-phyl
2.1.0
|
Partial implmentation of the MutationProcess interface. More...
#include <Bpp/Phyl/Simulation/MutationProcess.h>
Inheritance diagram for bpp::AbstractMutationProcess:
Collaboration diagram for bpp::AbstractMutationProcess:Public Member Functions | |
| AbstractMutationProcess (const SubstitutionModel *model) | |
| AbstractMutationProcess (const AbstractMutationProcess &) | |
| AbstractMutationProcess & | operator= (const AbstractMutationProcess &) |
| virtual | ~AbstractMutationProcess () |
| int | mutate (int state) const |
| Mutate a character in state i. | |
| int | mutate (int state, unsigned int n) const |
| Mutate a character in state i n times. | |
| double | getTimeBeforeNextMutationEvent (int state) const |
| Get the time before next mutation event. | |
| int | evolve (int initialState, double time) const |
| Simulation a character evolution during a specified time according to the given substitution model and send the final state. | |
| MutationPath | detailedEvolve (int initialState, double time) const |
| Simulation a character evolution during a specified time according to the given substitution model and send the total path with all intermediate states and times between mutation events. | |
| const SubstitutionModel * | getSubstitutionModel () const |
| Get the substitution model associated to the mutation process. | |
Protected Attributes | |
| const SubstitutionModel * | model_ |
| The substitution model to use: | |
| size_t | size_ |
| The number of states allowed for the character to mutate. | |
| VVdouble | repartition_ |
| The repartition function for states probabilities. | |
Partial implmentation of the MutationProcess interface.
This class provides an implementation of the MutationProcess interface. It assumes that there are size_ states allowed for the character of interest, and that the distribution of probabilities are in repartition_. As a matter of facts, probabilities must be cumulative, so that repartition_ contains values of the repartition function. The mutate function hence draws a random number between 0 and 1 and gives the corresponding character using the bijection of the repartition function.
All derived classes must initialize the repartition_ and size_ fields.
Definition at line 277 of file MutationProcess.h.
| bpp::AbstractMutationProcess::AbstractMutationProcess | ( | const SubstitutionModel * | model | ) | [inline] |
Definition at line 301 of file MutationProcess.h.
| bpp::AbstractMutationProcess::AbstractMutationProcess | ( | const AbstractMutationProcess & | amp | ) | [inline] |
Definition at line 305 of file MutationProcess.h.
| virtual bpp::AbstractMutationProcess::~AbstractMutationProcess | ( | ) | [inline, virtual] |
Definition at line 317 of file MutationProcess.h.
| MutationPath AbstractMutationProcess::detailedEvolve | ( | int | initialState, |
| double | time | ||
| ) | const [virtual] |
Simulation a character evolution during a specified time according to the given substitution model and send the total path with all intermediate states and times between mutation events.
| initialState | The state before beginning evolution. |
| time | The time during which evolution must occure. |
Implements bpp::MutationProcess.
Definition at line 98 of file MutationProcess.cpp.
References bpp::SubstitutionModel::getAlphabet(), getTimeBeforeNextMutationEvent(), model_, and mutate().
| int AbstractMutationProcess::evolve | ( | int | initialState, |
| double | time | ||
| ) | const [virtual] |
Simulation a character evolution during a specified time according to the given substitution model and send the final state.
| initialState | The state before beginning evolution. |
| time | The time during which evolution must occure. |
Implements bpp::MutationProcess.
Reimplemented in bpp::SimpleMutationProcess.
Definition at line 84 of file MutationProcess.cpp.
References getTimeBeforeNextMutationEvent(), and mutate().
| const SubstitutionModel* bpp::AbstractMutationProcess::getSubstitutionModel | ( | ) | const [inline, virtual] |
Get the substitution model associated to the mutation process.
Implements bpp::MutationProcess.
Definition at line 325 of file MutationProcess.h.
References model_.
| double AbstractMutationProcess::getTimeBeforeNextMutationEvent | ( | int | state | ) | const [virtual] |
Get the time before next mutation event.
| state | The actual state of the chain; |
Implements bpp::MutationProcess.
Definition at line 78 of file MutationProcess.cpp.
References model_, bpp::SubstitutionModel::Qij(), and bpp::RandomTools::randExponential().
Referenced by detailedEvolve(), and evolve().
| int AbstractMutationProcess::mutate | ( | int | state | ) | const [virtual] |
Mutate a character in state i.
| state | The current state of the character. |
Implements bpp::MutationProcess.
Definition at line 48 of file MutationProcess.cpp.
References bpp::RandomTools::giveRandomNumberBetweenZeroAndEntry(), repartition_, size_, and bpp::TextTools::toString().
Referenced by detailedEvolve(), and evolve().
| int AbstractMutationProcess::mutate | ( | int | state, |
| unsigned int | n | ||
| ) | const [virtual] |
Mutate a character in state i n times.
| state | The current state of the character. |
| n | The number of mutations to perform. |
Implements bpp::MutationProcess.
Definition at line 59 of file MutationProcess.cpp.
References bpp::RandomTools::giveRandomNumberBetweenZeroAndEntry(), repartition_, and size_.
| AbstractMutationProcess& bpp::AbstractMutationProcess::operator= | ( | const AbstractMutationProcess & | amp | ) | [inline] |
Definition at line 309 of file MutationProcess.h.
References model_, repartition_, and size_.
const SubstitutionModel* bpp::AbstractMutationProcess::model_ [protected] |
The substitution model to use:
Definition at line 285 of file MutationProcess.h.
Referenced by detailedEvolve(), bpp::SimpleMutationProcess::evolve(), getSubstitutionModel(), getTimeBeforeNextMutationEvent(), and operator=().
VVdouble bpp::AbstractMutationProcess::repartition_ [protected] |
The repartition function for states probabilities.
repartition_[i][j] = probability that, being in state i at time t, we'll be in state <= j at time t+1.
Definition at line 298 of file MutationProcess.h.
Referenced by mutate(), operator=(), bpp::SelfMutationProcess::SelfMutationProcess(), and bpp::SimpleMutationProcess::SimpleMutationProcess().
size_t bpp::AbstractMutationProcess::size_ [protected] |
The number of states allowed for the character to mutate.
Definition at line 290 of file MutationProcess.h.
Referenced by bpp::SimpleMutationProcess::evolve(), mutate(), operator=(), bpp::SelfMutationProcess::SelfMutationProcess(), and bpp::SimpleMutationProcess::SimpleMutationProcess().