bpp-phyl3  3.0.0
bpp::SimpleSubstitutionProcessSiteSimulator Class Reference

Site simulation under a unique substitution process. More...

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

+ Inheritance diagram for bpp::SimpleSubstitutionProcessSiteSimulator:
+ Collaboration diagram for bpp::SimpleSubstitutionProcessSiteSimulator:

Public Member Functions

std::shared_ptr< const SubstitutionProcessInterfacegetSubstitutionProcess () const
 Get the substitution process associated to this instance. More...
 
std::shared_ptr< const ParametrizablePhyloTreegetTree () 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< SitesimulateSite () const override
 
std::unique_ptr< SitesimulateSite (size_t rateClass) const override
 
std::unique_ptr< SitesimulateSite (double rate) const override
 
std::unique_ptr< SitesimulateSite (size_t ancestralStateIndex, double rate) const override
 
std::vector< std::string > getSequenceNames () const override
 
SiteSimulator interface
std::shared_ptr< const AlphabetgetAlphabet () const override
 
const Alphabetalphabet () const override
 
The DetailedSiteSimulator interface.
std::unique_ptr< SiteSimulationResultdSimulateSite () const override
 Get a detailed simulation result for one site. More...
 
std::unique_ptr< SiteSimulationResultdSimulateSite (size_t rateClass) const override
 
std::unique_ptr< SiteSimulationResultdSimulateSite (double rate) const override
 
std::unique_ptr< SiteSimulationResultdSimulateSite (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 SubstitutionProcessInterfaceprocess_
 
std::shared_ptr< const ParametrizablePhyloTreephyloTree_
 
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)
 
SimpleSubstitutionProcessSiteSimulatoroperator= (const SimpleSubstitutionProcessSiteSimulator &nhss)
 
SimpleSubstitutionProcessSiteSimulatorclone () const override
 
virtual void init ()
 Init all probabilities. More...
 

Detailed Description

Site simulation under a unique substitution process.

Definition at line 69 of file SimpleSubstitutionProcessSiteSimulator.h.

Constructor & Destructor Documentation

◆ SimpleSubstitutionProcessSiteSimulator() [1/2]

SimpleSubstitutionProcessSiteSimulator::SimpleSubstitutionProcessSiteSimulator ( std::shared_ptr< const SubstitutionProcessInterface process)

Definition at line 22 of file SimpleSubstitutionProcessSiteSimulator.cpp.

References init().

Referenced by clone().

◆ ~SimpleSubstitutionProcessSiteSimulator()

virtual bpp::SimpleSubstitutionProcessSiteSimulator::~SimpleSubstitutionProcessSiteSimulator ( )
inlinevirtual

Definition at line 128 of file SimpleSubstitutionProcessSiteSimulator.h.

◆ SimpleSubstitutionProcessSiteSimulator() [2/2]

bpp::SimpleSubstitutionProcessSiteSimulator::SimpleSubstitutionProcessSiteSimulator ( const SimpleSubstitutionProcessSiteSimulator nhss)
inline

Definition at line 130 of file SimpleSubstitutionProcessSiteSimulator.h.

Member Function Documentation

◆ alphabet()

const Alphabet& bpp::SimpleSubstitutionProcessSiteSimulator::alphabet ( ) const
inlineoverridevirtual

Implements bpp::SiteSimulatorInterface.

Definition at line 207 of file SimpleSubstitutionProcessSiteSimulator.h.

References process_.

Referenced by simulateSite().

◆ clone()

SimpleSubstitutionProcessSiteSimulator* bpp::SimpleSubstitutionProcessSiteSimulator::clone ( ) const
inlineoverridevirtual

◆ dSimulateSite() [1/4]

unique_ptr< SiteSimulationResult > SimpleSubstitutionProcessSiteSimulator::dSimulateSite ( ) const
overridevirtual

Get a detailed simulation result for one site.

Returns
A SiteSimulationResult object with all ancestral states for all nodes and branches.

Implements bpp::DetailedSiteSimulatorInterface.

Definition at line 249 of file SimpleSubstitutionProcessSiteSimulator.cpp.

References continuousRates_, bpp::RandomTools::pickFromCumSum(), process_, and qRates_.

◆ dSimulateSite() [2/4]

unique_ptr< SiteSimulationResult > SimpleSubstitutionProcessSiteSimulator::dSimulateSite ( double  rate) const
overridevirtual

◆ dSimulateSite() [3/4]

unique_ptr< SiteSimulationResult > SimpleSubstitutionProcessSiteSimulator::dSimulateSite ( size_t  ancestralStateIndex,
double  rate 
) const
overridevirtual

◆ dSimulateSite() [4/4]

unique_ptr< SiteSimulationResult > SimpleSubstitutionProcessSiteSimulator::dSimulateSite ( size_t  rateClass) const
overridevirtual

◆ enableContinuousRates()

void bpp::SimpleSubstitutionProcessSiteSimulator::enableContinuousRates ( bool  yn)
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.

Parameters
ynTell if we should use continuous rates.

Definition at line 257 of file SimpleSubstitutionProcessSiteSimulator.h.

References continuousRates_.

◆ evolveInternal() [1/2]

◆ evolveInternal() [2/2]

◆ getAlphabet()

std::shared_ptr<const Alphabet> bpp::SimpleSubstitutionProcessSiteSimulator::getAlphabet ( ) const
inlineoverridevirtual

Implements bpp::SiteSimulatorInterface.

Definition at line 205 of file SimpleSubstitutionProcessSiteSimulator.h.

References process_.

Referenced by simulateSite().

◆ getSequenceNames()

std::vector<std::string> bpp::SimpleSubstitutionProcessSiteSimulator::getSequenceNames ( ) const
inlineoverridevirtual

Implements bpp::SiteSimulatorInterface.

Definition at line 193 of file SimpleSubstitutionProcessSiteSimulator.h.

References seqNames_.

◆ getSubstitutionProcess()

std::shared_ptr<const SubstitutionProcessInterface> bpp::SimpleSubstitutionProcessSiteSimulator::getSubstitutionProcess ( ) const
inline

Get the substitution process associated to this instance.

Returns
The substitution process associated to this instance.

Definition at line 231 of file SimpleSubstitutionProcessSiteSimulator.h.

References process_.

◆ getTree()

std::shared_ptr<const ParametrizablePhyloTree> bpp::SimpleSubstitutionProcessSiteSimulator::getTree ( ) const
inline

Get the tree associated to this instance.

Returns
The Tree object associated to this instance.

Definition at line 241 of file SimpleSubstitutionProcessSiteSimulator.h.

References phyloTree_.

◆ init()

◆ operator=()

◆ outputInternalSites()

void SimpleSubstitutionProcessSiteSimulator::outputInternalSites ( bool  yn)
overridevirtual

Sets whether we will output the internal sequences or not.

Parameters
ynTell 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().

◆ simulateSite() [1/4]

unique_ptr< Site > SimpleSubstitutionProcessSiteSimulator::simulateSite ( ) const
overridevirtual

◆ simulateSite() [2/4]

unique_ptr< Site > SimpleSubstitutionProcessSiteSimulator::simulateSite ( double  rate) const
overridevirtual

◆ simulateSite() [3/4]

unique_ptr< Site > SimpleSubstitutionProcessSiteSimulator::simulateSite ( size_t  ancestralStateIndex,
double  rate 
) const
overridevirtual

◆ simulateSite() [4/4]

unique_ptr< Site > SimpleSubstitutionProcessSiteSimulator::simulateSite ( size_t  rateClass) const
overridevirtual

Member Data Documentation

◆ continuousRates_

bool bpp::SimpleSubstitutionProcessSiteSimulator::continuousRates_
protected

◆ nbClasses_

size_t bpp::SimpleSubstitutionProcessSiteSimulator::nbClasses_
protected

Definition at line 110 of file SimpleSubstitutionProcessSiteSimulator.h.

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

◆ nbNodes_

size_t bpp::SimpleSubstitutionProcessSiteSimulator::nbNodes_
protected

Definition at line 109 of file SimpleSubstitutionProcessSiteSimulator.h.

Referenced by operator=().

◆ nbStates_

size_t bpp::SimpleSubstitutionProcessSiteSimulator::nbStates_
protected

Definition at line 111 of file SimpleSubstitutionProcessSiteSimulator.h.

Referenced by evolveInternal(), init(), and operator=().

◆ outputInternalSites_

bool bpp::SimpleSubstitutionProcessSiteSimulator::outputInternalSites_
protected

Definition at line 116 of file SimpleSubstitutionProcessSiteSimulator.h.

Referenced by init(), operator=(), and outputInternalSites().

◆ phyloTree_

std::shared_ptr<const ParametrizablePhyloTree> bpp::SimpleSubstitutionProcessSiteSimulator::phyloTree_
protected

◆ process_

std::shared_ptr<const SubstitutionProcessInterface> bpp::SimpleSubstitutionProcessSiteSimulator::process_
protected

◆ qRates_

Vdouble bpp::SimpleSubstitutionProcessSiteSimulator::qRates_
protected

cumsum probas of the substitution rates

Definition at line 85 of file SimpleSubstitutionProcessSiteSimulator.h.

Referenced by dSimulateSite(), init(), operator=(), and simulateSite().

◆ qRoots_

VVdouble bpp::SimpleSubstitutionProcessSiteSimulator::qRoots_
protected

◆ seqIndexes_

std::vector<size_t> bpp::SimpleSubstitutionProcessSiteSimulator::seqIndexes_
protected

Vector of indexes of sequenced output species.

Definition at line 96 of file SimpleSubstitutionProcessSiteSimulator.h.

Referenced by operator=(), outputInternalSites(), and simulateSite().

◆ seqNames_

std::vector<std::string> bpp::SimpleSubstitutionProcessSiteSimulator::seqNames_
protected

Vector of names of sequenced output species.

Definition at line 101 of file SimpleSubstitutionProcessSiteSimulator.h.

Referenced by getSequenceNames(), operator=(), outputInternalSites(), and simulateSite().

◆ speciesNodes_

std::map<size_t, std::shared_ptr<SimProcessNode> > bpp::SimpleSubstitutionProcessSiteSimulator::speciesNodes_
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().

◆ tree_

SPTree bpp::SimpleSubstitutionProcessSiteSimulator::tree_
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().


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