bpp-phyl3
3.0.0
|
Site simulation under a unique substitution process. More...
#include <Bpp/Phyl/Simulation/SimpleSubstitutionProcessSiteSimulator.h>
Public Member Functions | |
std::shared_ptr< const SubstitutionProcessInterface > | getSubstitutionProcess () const |
Get the substitution process associated to this instance. More... | |
std::shared_ptr< const ParametrizablePhyloTree > | getTree () const |
Get the tree associated to this instance. More... | |
void | enableContinuousRates (bool yn) |
Enable the use of continuous rates instead of discrete rates. More... | |
void | outputInternalSites (bool yn) override |
Sets whether we will output the internal sequences or not. More... | |
The SiteSimulator interface | |
std::unique_ptr< Site > | simulateSite () const override |
std::unique_ptr< Site > | simulateSite (size_t rateClass) const override |
std::unique_ptr< Site > | simulateSite (double rate) const override |
std::unique_ptr< Site > | simulateSite (size_t ancestralStateIndex, double rate) const override |
std::vector< std::string > | getSequenceNames () const override |
SiteSimulator interface | |
std::shared_ptr< const Alphabet > | getAlphabet () const override |
const Alphabet & | alphabet () const override |
The DetailedSiteSimulator interface. | |
std::unique_ptr< SiteSimulationResult > | dSimulateSite () const override |
Get a detailed simulation result for one site. More... | |
std::unique_ptr< SiteSimulationResult > | dSimulateSite (size_t rateClass) const override |
std::unique_ptr< SiteSimulationResult > | dSimulateSite (double rate) const override |
std::unique_ptr< SiteSimulationResult > | dSimulateSite (size_t ancestralStateIndex, double rate) const override |
Protected Member Functions | |
The 'Internal' methods. | |
void | evolveInternal (std::shared_ptr< SimProcessNode > node, size_t rateClass, SiteSimulationResult *ssr=nullptr) const |
void | evolveInternal (std::shared_ptr< SimProcessNode > node, double rate, SiteSimulationResult *ssr=nullptr) const |
Protected Attributes | |
std::shared_ptr< const SubstitutionProcessInterface > | process_ |
std::shared_ptr< const ParametrizablePhyloTree > | phyloTree_ |
SPTree | tree_ |
To store states & transition probabilities of the simulator. More... | |
Vdouble | qRates_ |
cumsum probas of the substitution rates More... | |
VVdouble | qRoots_ |
std::vector< size_t > | seqIndexes_ |
Vector of indexes of sequenced output species. More... | |
std::vector< std::string > | seqNames_ |
Vector of names of sequenced output species. More... | |
std::map< size_t, std::shared_ptr< SimProcessNode > > | speciesNodes_ |
Map between species Indexes & used nodes, may change at each simulation. More... | |
size_t | nbNodes_ |
size_t | nbClasses_ |
size_t | nbStates_ |
bool | continuousRates_ |
bool | outputInternalSites_ |
Stores intermediate results. | |
SimpleSubstitutionProcessSiteSimulator (std::shared_ptr< const SubstitutionProcessInterface > process) | |
virtual | ~SimpleSubstitutionProcessSiteSimulator () |
SimpleSubstitutionProcessSiteSimulator (const SimpleSubstitutionProcessSiteSimulator &nhss) | |
SimpleSubstitutionProcessSiteSimulator & | operator= (const SimpleSubstitutionProcessSiteSimulator &nhss) |
SimpleSubstitutionProcessSiteSimulator * | clone () const override |
virtual void | init () |
Init all probabilities. More... | |
Site simulation under a unique substitution process.
Definition at line 69 of file SimpleSubstitutionProcessSiteSimulator.h.
SimpleSubstitutionProcessSiteSimulator::SimpleSubstitutionProcessSiteSimulator | ( | std::shared_ptr< const SubstitutionProcessInterface > | process | ) |
Definition at line 22 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References init().
Referenced by clone().
|
inlinevirtual |
Definition at line 128 of file SimpleSubstitutionProcessSiteSimulator.h.
|
inline |
Definition at line 130 of file SimpleSubstitutionProcessSiteSimulator.h.
|
inlineoverridevirtual |
Implements bpp::SiteSimulatorInterface.
Definition at line 207 of file SimpleSubstitutionProcessSiteSimulator.h.
References process_.
Referenced by simulateSite().
|
inlineoverridevirtual |
Implements bpp::DetailedSiteSimulatorInterface.
Definition at line 165 of file SimpleSubstitutionProcessSiteSimulator.h.
References SimpleSubstitutionProcessSiteSimulator().
|
overridevirtual |
Get a detailed simulation result for one site.
Implements bpp::DetailedSiteSimulatorInterface.
Definition at line 249 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References continuousRates_, bpp::RandomTools::pickFromCumSum(), process_, and qRates_.
|
overridevirtual |
Implements bpp::DetailedSiteSimulatorInterface.
Definition at line 264 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References evolveInternal(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), phyloTree_, bpp::RandomTools::pickFromCumSum(), process_, qRoots_, and tree_.
|
overridevirtual |
Implements bpp::DetailedSiteSimulatorInterface.
Definition at line 298 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References evolveInternal(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), phyloTree_, process_, and tree_.
|
overridevirtual |
Implements bpp::DetailedSiteSimulatorInterface.
Definition at line 281 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References evolveInternal(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), phyloTree_, bpp::RandomTools::pickFromCumSum(), process_, qRoots_, and tree_.
|
inline |
Enable the use of continuous rates instead of discrete rates.
To work, the DiscreteDistribution object used should implement the randC method.
In this case, sampling is done jointly on the process classes and on the continuous rate.
yn | Tell if we should use continuous rates. |
Definition at line 257 of file SimpleSubstitutionProcessSiteSimulator.h.
References continuousRates_.
|
protected |
This method uses the states_ variable for saving ancestral states.
Definition at line 380 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::SiteSimulationResult::addNode(), bpp::AbstractMutationProcess::detailedEvolve(), evolveInternal(), bpp::MutationPath::getFinalState(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getNodeIndex(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getOutgoingEdges(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getSon(), bpp::RandomTools::giveRandomNumberBetweenZeroAndEntry(), nbStates_, phyloTree_, bpp::RandomTools::pickFromCumSum(), process_, speciesNodes_, bpp::TextTools::toString(), and tree_.
|
protected |
This method uses the states_ variable for saving ancestral states.
Definition at line 313 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::SiteSimulationResult::addNode(), bpp::AbstractMutationProcess::detailedEvolve(), bpp::MutationPath::getFinalState(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getNodeIndex(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getOutgoingEdges(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getSon(), phyloTree_, bpp::RandomTools::pickFromCumSum(), process_, speciesNodes_, bpp::TextTools::toString(), and tree_.
Referenced by dSimulateSite(), evolveInternal(), and simulateSite().
|
inlineoverridevirtual |
Implements bpp::SiteSimulatorInterface.
Definition at line 205 of file SimpleSubstitutionProcessSiteSimulator.h.
References process_.
Referenced by simulateSite().
|
inlineoverridevirtual |
Implements bpp::SiteSimulatorInterface.
Definition at line 193 of file SimpleSubstitutionProcessSiteSimulator.h.
References seqNames_.
|
inline |
Get the substitution process associated to this instance.
Definition at line 231 of file SimpleSubstitutionProcessSiteSimulator.h.
References process_.
|
inline |
Get the tree associated to this instance.
Definition at line 241 of file SimpleSubstitutionProcessSiteSimulator.h.
References phyloTree_.
|
privatevirtual |
Init all probabilities.
Method called by constructors.
Reimplemented in bpp::GivenDataSubstitutionProcessSiteSimulator.
Definition at line 43 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::VectorTools::cumSum(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllEdges(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getAllNodes(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getEdgeIndex(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getOutgoingEdges(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getSon(), nbClasses_, nbStates_, outputInternalSites(), outputInternalSites_, phyloTree_, process_, qRates_, qRoots_, bpp::Matrix< class >::resize(), bpp::VectorTools::sum(), bpp::TextTools::toString(), and tree_.
Referenced by SimpleSubstitutionProcessSiteSimulator().
|
inline |
Definition at line 146 of file SimpleSubstitutionProcessSiteSimulator.h.
References continuousRates_, nbClasses_, nbNodes_, nbStates_, outputInternalSites_, phyloTree_, process_, qRates_, qRoots_, seqIndexes_, seqNames_, speciesNodes_, and tree_.
Referenced by bpp::GivenDataSubstitutionProcessSiteSimulator::operator=().
|
overridevirtual |
Sets whether we will output the internal sequences or not.
yn | Tell if we should output internal sequences. |
Implements bpp::SiteSimulatorInterface.
Definition at line 486 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References outputInternalSites_, phyloTree_, seqIndexes_, seqNames_, and bpp::TextTools::toString().
Referenced by init().
|
overridevirtual |
Implements bpp::SiteSimulatorInterface.
Definition at line 168 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References continuousRates_, bpp::RandomTools::pickFromCumSum(), process_, and qRates_.
|
overridevirtual |
Implements bpp::SiteSimulatorInterface.
Definition at line 183 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References alphabet(), evolveInternal(), getAlphabet(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), bpp::RandomTools::pickFromCumSum(), process_, qRoots_, seqIndexes_, seqNames_, speciesNodes_, and tree_.
|
overridevirtual |
Implements bpp::SiteSimulatorInterface.
Definition at line 229 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References alphabet(), evolveInternal(), getAlphabet(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), process_, seqIndexes_, seqNames_, speciesNodes_, and tree_.
|
overridevirtual |
Implements bpp::SiteSimulatorInterface.
Definition at line 206 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References alphabet(), evolveInternal(), getAlphabet(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), bpp::RandomTools::pickFromCumSum(), process_, qRoots_, seqIndexes_, seqNames_, speciesNodes_, and tree_.
|
protected |
Definition at line 113 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by dSimulateSite(), enableContinuousRates(), bpp::GivenDataSubstitutionProcessSiteSimulator::GivenDataSubstitutionProcessSiteSimulator(), operator=(), and simulateSite().
|
protected |
Definition at line 110 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by init(), and operator=().
|
protected |
Definition at line 109 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by operator=().
|
protected |
Definition at line 111 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by evolveInternal(), init(), and operator=().
|
protected |
Definition at line 116 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by init(), operator=(), and outputInternalSites().
|
protected |
Definition at line 74 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by dSimulateSite(), evolveInternal(), getTree(), init(), operator=(), and outputInternalSites().
|
protected |
Definition at line 73 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by alphabet(), dSimulateSite(), evolveInternal(), getAlphabet(), getSubstitutionProcess(), init(), operator=(), and simulateSite().
|
protected |
cumsum probas of the substitution rates
Definition at line 85 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by dSimulateSite(), init(), operator=(), and simulateSite().
|
protected |
Definition at line 91 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by dSimulateSite(), init(), operator=(), and simulateSite().
|
protected |
Vector of indexes of sequenced output species.
Definition at line 96 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by operator=(), outputInternalSites(), and simulateSite().
|
protected |
Vector of names of sequenced output species.
Definition at line 101 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by getSequenceNames(), operator=(), outputInternalSites(), and simulateSite().
|
mutableprotected |
Map between species Indexes & used nodes, may change at each simulation.
Definition at line 107 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by evolveInternal(), operator=(), and simulateSite().
|
protected |
To store states & transition probabilities of the simulator.
Definition at line 80 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by dSimulateSite(), evolveInternal(), init(), operator=(), and simulateSite().