bpp-phyl3
3.0.0
|
Site simulation under a unique substitution process, given data. More...
#include <Bpp/Phyl/Simulation/GivenDataSubstitutionProcessSiteSimulator.h>
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) | |
GivenDataSubstitutionProcessSiteSimulator & | operator= (const GivenDataSubstitutionProcessSiteSimulator &nhss) |
GivenDataSubstitutionProcessSiteSimulator * | clone () const override |
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_ |
Private Member Functions | |
void | init () override |
Init all probabilities. More... | |
Private Attributes | |
std::shared_ptr< LikelihoodCalculationSingleProcess > | calcul_ |
Eigen::Index | pos_ |
Position of the copied site, in SHRUNKED data. More... | |
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
where 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:
where is the data below son node and is the likelihood of under the TOP of edge e':
for all states at the top of edge and the number of states
Definition at line 37 of file GivenDataSubstitutionProcessSiteSimulator.h.
|
inline |
Build a Site Simulator of histories from the a posteriori likelihoods at a given site.
calcul | the a posteriori likelihood calculation |
pos | the position of the site to imitate |
shrunked | if 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().
|
inline |
Definition at line 67 of file GivenDataSubstitutionProcessSiteSimulator.h.
|
inlineoverridevirtualinherited |
Implements bpp::SiteSimulatorInterface.
Definition at line 207 of file SimpleSubstitutionProcessSiteSimulator.h.
References bpp::SimpleSubstitutionProcessSiteSimulator::process_.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().
|
inlineoverridevirtual |
Implements bpp::DetailedSiteSimulatorInterface.
Definition at line 82 of file GivenDataSubstitutionProcessSiteSimulator.h.
References GivenDataSubstitutionProcessSiteSimulator().
|
overridevirtualinherited |
Get a detailed simulation result for one site.
Implements bpp::DetailedSiteSimulatorInterface.
Definition at line 249 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::SimpleSubstitutionProcessSiteSimulator::continuousRates_, bpp::RandomTools::pickFromCumSum(), bpp::SimpleSubstitutionProcessSiteSimulator::process_, and bpp::SimpleSubstitutionProcessSiteSimulator::qRates_.
|
overridevirtualinherited |
Implements bpp::DetailedSiteSimulatorInterface.
Definition at line 264 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), bpp::SimpleSubstitutionProcessSiteSimulator::phyloTree_, bpp::RandomTools::pickFromCumSum(), bpp::SimpleSubstitutionProcessSiteSimulator::process_, bpp::SimpleSubstitutionProcessSiteSimulator::qRoots_, and bpp::SimpleSubstitutionProcessSiteSimulator::tree_.
|
overridevirtualinherited |
Implements bpp::DetailedSiteSimulatorInterface.
Definition at line 298 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), bpp::SimpleSubstitutionProcessSiteSimulator::phyloTree_, bpp::SimpleSubstitutionProcessSiteSimulator::process_, and bpp::SimpleSubstitutionProcessSiteSimulator::tree_.
|
overridevirtualinherited |
Implements bpp::DetailedSiteSimulatorInterface.
Definition at line 281 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), bpp::SimpleSubstitutionProcessSiteSimulator::phyloTree_, bpp::RandomTools::pickFromCumSum(), bpp::SimpleSubstitutionProcessSiteSimulator::process_, bpp::SimpleSubstitutionProcessSiteSimulator::qRoots_, and bpp::SimpleSubstitutionProcessSiteSimulator::tree_.
|
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.
yn | Tell if we should use continuous rates. |
Definition at line 257 of file SimpleSubstitutionProcessSiteSimulator.h.
References bpp::SimpleSubstitutionProcessSiteSimulator::continuousRates_.
|
protectedinherited |
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(), bpp::SimpleSubstitutionProcessSiteSimulator::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(), bpp::SimpleSubstitutionProcessSiteSimulator::nbStates_, bpp::SimpleSubstitutionProcessSiteSimulator::phyloTree_, bpp::RandomTools::pickFromCumSum(), bpp::SimpleSubstitutionProcessSiteSimulator::process_, bpp::SimpleSubstitutionProcessSiteSimulator::speciesNodes_, bpp::TextTools::toString(), and bpp::SimpleSubstitutionProcessSiteSimulator::tree_.
|
protectedinherited |
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(), bpp::SimpleSubstitutionProcessSiteSimulator::phyloTree_, bpp::RandomTools::pickFromCumSum(), bpp::SimpleSubstitutionProcessSiteSimulator::process_, bpp::SimpleSubstitutionProcessSiteSimulator::speciesNodes_, bpp::TextTools::toString(), and bpp::SimpleSubstitutionProcessSiteSimulator::tree_.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::dSimulateSite(), bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), and bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().
|
inlineoverridevirtualinherited |
Implements bpp::SiteSimulatorInterface.
Definition at line 205 of file SimpleSubstitutionProcessSiteSimulator.h.
References bpp::SimpleSubstitutionProcessSiteSimulator::process_.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().
|
inlineoverridevirtualinherited |
Implements bpp::SiteSimulatorInterface.
Definition at line 193 of file SimpleSubstitutionProcessSiteSimulator.h.
References bpp::SimpleSubstitutionProcessSiteSimulator::seqNames_.
|
inlineinherited |
Get the substitution process associated to this instance.
Definition at line 231 of file SimpleSubstitutionProcessSiteSimulator.h.
References bpp::SimpleSubstitutionProcessSiteSimulator::process_.
|
inlineinherited |
Get the tree associated to this instance.
Definition at line 241 of file SimpleSubstitutionProcessSiteSimulator.h.
References bpp::SimpleSubstitutionProcessSiteSimulator::phyloTree_.
|
overrideprivatevirtual |
Init all probabilities.
Method called by constructors.
Reimplemented from bpp::SimpleSubstitutionProcessSiteSimulator.
Definition at line 21 of file GivenDataSubstitutionProcessSiteSimulator.cpp.
References bpp::ExtendedFloatEigen< R, C, EigenType >::col(), bpp::Matrix< class >::col(), bpp::convert(), bpp::copyEigenToBpp(), bpp::VectorTools::cumSum(), bpp::NumConstants::PICO(), bpp::ExtendedFloatEigen< R, C, EigenType >::sum(), bpp::VectorTools::sum(), and bpp::TextTools::toString().
Referenced by GivenDataSubstitutionProcessSiteSimulator().
|
inline |
Definition at line 73 of file GivenDataSubstitutionProcessSiteSimulator.h.
References calcul_, bpp::SimpleSubstitutionProcessSiteSimulator::operator=(), and pos_.
|
overridevirtualinherited |
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 bpp::SimpleSubstitutionProcessSiteSimulator::outputInternalSites_, bpp::SimpleSubstitutionProcessSiteSimulator::phyloTree_, bpp::SimpleSubstitutionProcessSiteSimulator::seqIndexes_, bpp::SimpleSubstitutionProcessSiteSimulator::seqNames_, and bpp::TextTools::toString().
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::init().
|
overridevirtualinherited |
Implements bpp::SiteSimulatorInterface.
Definition at line 168 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::SimpleSubstitutionProcessSiteSimulator::continuousRates_, bpp::RandomTools::pickFromCumSum(), bpp::SimpleSubstitutionProcessSiteSimulator::process_, and bpp::SimpleSubstitutionProcessSiteSimulator::qRates_.
|
overridevirtualinherited |
Implements bpp::SiteSimulatorInterface.
Definition at line 183 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::SimpleSubstitutionProcessSiteSimulator::alphabet(), bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::SimpleSubstitutionProcessSiteSimulator::getAlphabet(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), bpp::RandomTools::pickFromCumSum(), bpp::SimpleSubstitutionProcessSiteSimulator::process_, bpp::SimpleSubstitutionProcessSiteSimulator::qRoots_, bpp::SimpleSubstitutionProcessSiteSimulator::seqIndexes_, bpp::SimpleSubstitutionProcessSiteSimulator::seqNames_, bpp::SimpleSubstitutionProcessSiteSimulator::speciesNodes_, and bpp::SimpleSubstitutionProcessSiteSimulator::tree_.
|
overridevirtualinherited |
Implements bpp::SiteSimulatorInterface.
Definition at line 229 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::SimpleSubstitutionProcessSiteSimulator::alphabet(), bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::SimpleSubstitutionProcessSiteSimulator::getAlphabet(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), bpp::SimpleSubstitutionProcessSiteSimulator::process_, bpp::SimpleSubstitutionProcessSiteSimulator::seqIndexes_, bpp::SimpleSubstitutionProcessSiteSimulator::seqNames_, bpp::SimpleSubstitutionProcessSiteSimulator::speciesNodes_, and bpp::SimpleSubstitutionProcessSiteSimulator::tree_.
|
overridevirtualinherited |
Implements bpp::SiteSimulatorInterface.
Definition at line 206 of file SimpleSubstitutionProcessSiteSimulator.cpp.
References bpp::SimpleSubstitutionProcessSiteSimulator::alphabet(), bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::SimpleSubstitutionProcessSiteSimulator::getAlphabet(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getRoot(), bpp::RandomTools::pickFromCumSum(), bpp::SimpleSubstitutionProcessSiteSimulator::process_, bpp::SimpleSubstitutionProcessSiteSimulator::qRoots_, bpp::SimpleSubstitutionProcessSiteSimulator::seqIndexes_, bpp::SimpleSubstitutionProcessSiteSimulator::seqNames_, bpp::SimpleSubstitutionProcessSiteSimulator::speciesNodes_, and bpp::SimpleSubstitutionProcessSiteSimulator::tree_.
|
private |
Definition at line 41 of file GivenDataSubstitutionProcessSiteSimulator.h.
Referenced by operator=().
|
protectedinherited |
Definition at line 113 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::dSimulateSite(), bpp::SimpleSubstitutionProcessSiteSimulator::enableContinuousRates(), GivenDataSubstitutionProcessSiteSimulator(), bpp::SimpleSubstitutionProcessSiteSimulator::operator=(), and bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().
|
protectedinherited |
Definition at line 110 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::init(), and bpp::SimpleSubstitutionProcessSiteSimulator::operator=().
|
protectedinherited |
Definition at line 109 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::operator=().
|
protectedinherited |
Definition at line 111 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::SimpleSubstitutionProcessSiteSimulator::init(), and bpp::SimpleSubstitutionProcessSiteSimulator::operator=().
|
protectedinherited |
|
protectedinherited |
Definition at line 74 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::dSimulateSite(), bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::SimpleSubstitutionProcessSiteSimulator::getTree(), bpp::SimpleSubstitutionProcessSiteSimulator::init(), bpp::SimpleSubstitutionProcessSiteSimulator::operator=(), and bpp::SimpleSubstitutionProcessSiteSimulator::outputInternalSites().
|
private |
Position of the copied site, in SHRUNKED data.
Definition at line 46 of file GivenDataSubstitutionProcessSiteSimulator.h.
Referenced by operator=().
|
protectedinherited |
Definition at line 73 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::alphabet(), bpp::SimpleSubstitutionProcessSiteSimulator::dSimulateSite(), bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::SimpleSubstitutionProcessSiteSimulator::getAlphabet(), bpp::SimpleSubstitutionProcessSiteSimulator::getSubstitutionProcess(), bpp::SimpleSubstitutionProcessSiteSimulator::init(), bpp::SimpleSubstitutionProcessSiteSimulator::operator=(), and bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().
|
protectedinherited |
cumsum probas of the substitution rates
Definition at line 85 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::dSimulateSite(), bpp::SimpleSubstitutionProcessSiteSimulator::init(), bpp::SimpleSubstitutionProcessSiteSimulator::operator=(), and bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().
|
protectedinherited |
Definition at line 91 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::dSimulateSite(), bpp::SimpleSubstitutionProcessSiteSimulator::init(), bpp::SimpleSubstitutionProcessSiteSimulator::operator=(), and bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().
|
protectedinherited |
Vector of indexes of sequenced output species.
Definition at line 96 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::operator=(), bpp::SimpleSubstitutionProcessSiteSimulator::outputInternalSites(), and bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().
|
protectedinherited |
Vector of names of sequenced output species.
Definition at line 101 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::getSequenceNames(), bpp::SimpleSubstitutionProcessSiteSimulator::operator=(), bpp::SimpleSubstitutionProcessSiteSimulator::outputInternalSites(), and bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().
|
mutableprotectedinherited |
Map between species Indexes & used nodes, may change at each simulation.
Definition at line 107 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::SimpleSubstitutionProcessSiteSimulator::operator=(), and bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().
|
protectedinherited |
To store states & transition probabilities of the simulator.
Definition at line 80 of file SimpleSubstitutionProcessSiteSimulator.h.
Referenced by bpp::SimpleSubstitutionProcessSiteSimulator::dSimulateSite(), bpp::SimpleSubstitutionProcessSiteSimulator::evolveInternal(), bpp::SimpleSubstitutionProcessSiteSimulator::init(), bpp::SimpleSubstitutionProcessSiteSimulator::operator=(), and bpp::SimpleSubstitutionProcessSiteSimulator::simulateSite().