5 #ifndef BPP_PHYL_SIMULATION_DETAILEDSITESIMULATOR_H
6 #define BPP_PHYL_SIMULATION_DETAILEDSITESIMULATOR_H
9 #include "../Likelihood/ParametrizablePhyloTree.h"
31 std::shared_ptr<const ParametrizablePhyloTree>
tree_;
37 std::shared_ptr<const ParametrizablePhyloTree> tree,
38 std::shared_ptr<const StateMapInterface> statemap,
39 size_t ancestralState) :
45 leavesId_ (tree->getNodeIndexes(tree->getLeavesUnderNode(tree->getRoot()))),
106 std::vector<double>& counts)
const
108 paths_[i].getEventCounts(counts, reg);
116 std::vector<double>& counts)
const
125 for (
size_t i = 0; i < n; ++i)
128 paths_[i].getEventCounts(counts[i], reg);
139 std::vector<size_t> states(n);
140 for (
size_t i = 0; i < n; i++)
153 std::vector<int> astates(mstates.size());
154 for (
size_t i = 0; i < mstates.size(); ++i)
156 astates[i] =
statemap_->getAlphabetStateAsInt(mstates[i]);
159 return std::make_unique<Site>(astates,
alphabet);
168 std::vector<std::string> names(n);
169 for (
size_t i = 0; i < n; i++)
193 std::shared_ptr<const ParametrizablePhyloTree> tree,
194 std::shared_ptr<const StateMapInterface> stateMap,
195 size_t ancestralStateIndex,
233 virtual std::unique_ptr<SiteSimulationResult>
dSimulateSite(
size_t rateClass)
const = 0;
234 virtual std::unique_ptr<SiteSimulationResult>
dSimulateSite(
double rate)
const = 0;
235 virtual std::unique_ptr<SiteSimulationResult>
dSimulateSite(
size_t ancestralStateIndex,
double rate)
const = 0;
This interface adds the dSimulate method to the SiteSimulator interface.
virtual ~DetailedSiteSimulatorInterface()
virtual std::unique_ptr< SiteSimulationResult > dSimulateSite(size_t rateClass) const =0
virtual std::unique_ptr< SiteSimulationResult > dSimulateSite() const =0
Get a detailed simulation result for one site.
virtual std::unique_ptr< SiteSimulationResult > dSimulateSite(size_t ancestralStateIndex, double rate) const =0
DetailedSiteSimulatorInterface * clone() const override=0
DetailedSiteSimulatorInterface()
virtual std::unique_ptr< SiteSimulationResult > dSimulateSite(double rate) const =0
This class is used by MutationProcess to store detailed results of simulations.
size_t getFinalState() const
Retrieve the final state of this path.
Data structure to store the result of a DetailedSiteSimulator.
RASiteSimulationResult(std::shared_ptr< const ParametrizablePhyloTree > tree, std::shared_ptr< const StateMapInterface > stateMap, size_t ancestralStateIndex, double rate)
virtual ~RASiteSimulationResult()
virtual double getRate() const
Data structure to store the result of a DetailedSiteSimulator.
virtual void addNode(unsigned int nodeId, MutationPath path)
std::shared_ptr< const StateMapInterface > statemap_
std::vector< size_t > ancestralStates_
SiteSimulationResult(std::shared_ptr< const ParametrizablePhyloTree > tree, std::shared_ptr< const StateMapInterface > statemap, size_t ancestralState)
virtual const MutationPath & getMutationPath(unsigned int nodeId) const
virtual size_t getSubstitutionCount(unsigned int nodeId) const
virtual std::vector< std::string > getLeaveNames() const
virtual size_t getAncestralState(unsigned int nodeId) const
virtual size_t getSubstitutionCount(size_t i) const
SiteSimulationResult & operator=(const SiteSimulationResult &ssr)
const Alphabet & alphabet() const
virtual void getSubstitutionCount(size_t i, const SubstitutionRegisterInterface ®, std::vector< double > &counts) const
std::map< uint, size_t > indexes_
SiteSimulationResult(const SiteSimulationResult &ssr)
virtual std::vector< size_t > getFinalStates() const
virtual size_t getAncestralState(size_t i) const
std::shared_ptr< const ParametrizablePhyloTree > tree_
virtual void getSubstitutionCount(unsigned int nodeId, const SubstitutionRegisterInterface ®, std::vector< double > &counts) const
virtual VVdouble getSubstitutionVector(const SubstitutionRegisterInterface ®) const
std::vector< unsigned int > leavesId_
virtual const MutationPath & getMutationPath(size_t i) const
virtual ~SiteSimulationResult()
std::vector< MutationPath > paths_
std::shared_ptr< const Alphabet > getAlphabet() const
virtual std::unique_ptr< SiteInterface > getSite(const TransitionModelInterface &model) const
The SiteSimulator interface. SiteSimulator classes can simulate single sites.
The SubstitutionRegister interface.
virtual size_t getNumberOfSubstitutionTypes() const =0
Interface for all transition models.
Defines the basic types of data flow nodes.
std::vector< Vdouble > VVdouble