bpp-phyl3  3.0.0
bpp::GivenDataSubstitutionProcessSiteSimulator Class Reference

Site simulation under a unique substitution process, given data. More...

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

+ Inheritance diagram for bpp::GivenDataSubstitutionProcessSiteSimulator:
+ Collaboration diagram for bpp::GivenDataSubstitutionProcessSiteSimulator:

Public Member Functions

 GivenDataSubstitutionProcessSiteSimulator (std::shared_ptr< LikelihoodCalculationSingleProcess > calcul, size_t pos, bool shrunked=false)
 Build a Site Simulator of histories from the a posteriori likelihoods at a given site. More...
 
 GivenDataSubstitutionProcessSiteSimulator (const GivenDataSubstitutionProcessSiteSimulator &nhss)
 
GivenDataSubstitutionProcessSiteSimulatoroperator= (const GivenDataSubstitutionProcessSiteSimulator &nhss)
 
GivenDataSubstitutionProcessSiteSimulatorclone () const override
 
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_
 

Private Member Functions

void init () override
 Init all probabilities. More...
 

Private Attributes

std::shared_ptr< LikelihoodCalculationSingleProcesscalcul_
 
Eigen::Index pos_
 Position of the copied site, in SHRUNKED data. More...
 

Detailed Description

Site simulation under a unique substitution process, given data.

So it will need a LikelihoodCalculationSingleProcess to have site specific likelihoods and manage a posteriori transition probabilities.

Transition probabilities are computed a posteriori: On an edge with states x -> y

$P(y|x,D) = P(y|x) * P(D\_ | y) / (sum_y' P(y'|x) * P(D\_ | y'))$ where $D\_$ is the data below son node

Mixture probabilities are computed a posteriori: On a node n, to choose an edge e among all outgoing edges of n:

$P(e|D) = P(e) * P(D\_ | e) / (sum_e' P(e') * P(D\_ | e'))$ where $D\_$ is the data below son node and $P(D\_ | e')$ is the likelihood of $D\_$ under the TOP of edge e':

$P(D\_ | e') = 1/N . \sum_x P(D\_ | x)$ for $x$ all states at the top of edge $e'$ and $N$ the number of states

Definition at line 37 of file GivenDataSubstitutionProcessSiteSimulator.h.

Constructor & Destructor Documentation

◆ GivenDataSubstitutionProcessSiteSimulator() [1/2]

bpp::GivenDataSubstitutionProcessSiteSimulator::GivenDataSubstitutionProcessSiteSimulator ( std::shared_ptr< LikelihoodCalculationSingleProcess calcul,
size_t  pos,
bool  shrunked = false 
)
inline

Build a Site Simulator of histories from the a posteriori likelihoods at a given site.

Parameters
calculthe a posteriori likelihood calculation
posthe position of the site to imitate
shrunkedif the given position is on the shrunked data (default: false)

Definition at line 57 of file GivenDataSubstitutionProcessSiteSimulator.h.

References bpp::SimpleSubstitutionProcessSiteSimulator::continuousRates_, and init().

Referenced by clone().

◆ GivenDataSubstitutionProcessSiteSimulator() [2/2]

bpp::GivenDataSubstitutionProcessSiteSimulator::GivenDataSubstitutionProcessSiteSimulator ( const GivenDataSubstitutionProcessSiteSimulator nhss)
inline

Definition at line 67 of file GivenDataSubstitutionProcessSiteSimulator.h.

Member Function Documentation

◆ alphabet()

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

◆ clone()

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

◆ dSimulateSite() [1/4]

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

◆ dSimulateSite() [2/4]

◆ dSimulateSite() [3/4]

◆ dSimulateSite() [4/4]

◆ enableContinuousRates()

void bpp::SimpleSubstitutionProcessSiteSimulator::enableContinuousRates ( bool  yn)
inlineinherited

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 bpp::SimpleSubstitutionProcessSiteSimulator::continuousRates_.

◆ evolveInternal() [1/2]

◆ evolveInternal() [2/2]

◆ getAlphabet()

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

◆ getSequenceNames()

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

◆ getSubstitutionProcess()

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

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 bpp::SimpleSubstitutionProcessSiteSimulator::process_.

◆ getTree()

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

Get the tree associated to this instance.

Returns
The Tree object associated to this instance.

Definition at line 241 of file SimpleSubstitutionProcessSiteSimulator.h.

References bpp::SimpleSubstitutionProcessSiteSimulator::phyloTree_.

◆ init()

◆ operator=()

GivenDataSubstitutionProcessSiteSimulator& bpp::GivenDataSubstitutionProcessSiteSimulator::operator= ( const GivenDataSubstitutionProcessSiteSimulator nhss)
inline

◆ outputInternalSites()

void SimpleSubstitutionProcessSiteSimulator::outputInternalSites ( bool  yn)
overridevirtualinherited

◆ simulateSite() [1/4]

◆ simulateSite() [2/4]

◆ simulateSite() [3/4]

◆ simulateSite() [4/4]

Member Data Documentation

◆ calcul_

std::shared_ptr<LikelihoodCalculationSingleProcess> bpp::GivenDataSubstitutionProcessSiteSimulator::calcul_
private

Definition at line 41 of file GivenDataSubstitutionProcessSiteSimulator.h.

Referenced by operator=().

◆ continuousRates_

◆ nbClasses_

size_t bpp::SimpleSubstitutionProcessSiteSimulator::nbClasses_
protectedinherited

◆ nbNodes_

size_t bpp::SimpleSubstitutionProcessSiteSimulator::nbNodes_
protectedinherited

◆ nbStates_

◆ outputInternalSites_

bool bpp::SimpleSubstitutionProcessSiteSimulator::outputInternalSites_
protectedinherited

◆ phyloTree_

◆ pos_

Eigen::Index bpp::GivenDataSubstitutionProcessSiteSimulator::pos_
private

Position of the copied site, in SHRUNKED data.

Definition at line 46 of file GivenDataSubstitutionProcessSiteSimulator.h.

Referenced by operator=().

◆ process_

◆ qRates_

◆ qRoots_

◆ seqIndexes_

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

◆ seqNames_

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

◆ speciesNodes_

std::map<size_t, std::shared_ptr<SimProcessNode> > bpp::SimpleSubstitutionProcessSiteSimulator::speciesNodes_
mutableprotectedinherited

◆ tree_


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