5 #ifndef BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_SINGLEPROCESSPHYLOLIKELIHOOD_H
6 #define BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_SINGLEPROCESSPHYLOLIKELIHOOD_H
12 #include <unordered_map>
14 #include "../DataFlow/DataFlowNumeric.h"
15 #include "../DataFlow/LikelihoodCalculationSingleProcess.h"
16 #include "../DataFlow/Parameter.h"
35 mutable std::shared_ptr<LikelihoodCalculationSingleProcess>
likCal_;
47 mutable std::unordered_map<std::pair<std::string, std::string>,
ValueRef<RowLik>,
53 std::shared_ptr<LikelihoodCalculationSingleProcess> likCal,
55 size_t nProc = 0,
size_t nData = 0) :
69 std::shared_ptr<LikelihoodCalculationSingleProcess> likCal,
70 size_t nProc = 0,
size_t nData = 0) :
78 std::cerr <<
"SingleProcessPhyloLikelihood(context, LikelihoodCalculationSingleProcess)" << std::endl;
82 std::cerr <<
"singleprocessphylolikelihood(context, likelihoodcalculationsingleprocess)" << std::endl;
89 throw Exception(
"SingleProcessPhyloLikelihood::clone should not be called.");
93 void setData(std::shared_ptr<const AlignmentDataInterface> sites,
size_t nData = 0)
override
112 std::shared_ptr<const AlignmentDataInterface>
getData()
const override
146 std::shared_ptr<const ParametrizablePhyloTree>
tree()
const
303 const std::string& variable2)
const
309 const std::string& variable2)
const
311 const auto key = std::make_pair (variable1, variable2);
virtual void shareParameters_(const ParameterList ¶meters)
const Context & context() const override
static Node_DF & accessVariableNode(const Parameter ¶m)
virtual void setData(std::shared_ptr< const AlignmentDataInterface > sites, size_t nData=0)
Set the dataset for which the likelihood must be evaluated.
Context for dataflow node construction.
std::shared_ptr< const SubstitutionProcessInterface > getSubstitutionProcess() const
const SubstitutionProcessInterface & substitutionProcess() const
Return the ref to the SubstitutionProcess.
size_t getNumberOfSites() const
void setData(std::shared_ptr< const AlignmentDataInterface > sites)
std::shared_ptr< const AlignmentDataInterface > getShrunkData() const
size_t getNumberOfDistinctSites() const
const StateMapInterface & stateMap() const
std::shared_ptr< const AlignmentDataInterface > getData() const
virtual bool isInitialized() const
Wraps a dataflow graph as a function: resultNode = f(variableNodes).
ParameterList getBranchLengthParameters() const override
Get the independent branch lengths parameters.
size_t getNumberOfDistinctSites() const
std::shared_ptr< const AlignmentDataInterface > getData() const override
return a pointer to the original data.
size_t getNumberOfSites() const override
Get the number of sites in the dataset.
std::shared_ptr< const ParametrizablePhyloTree > tree() const
ValueRef< RowLik > firstOrderDerivativeVector(const std::string &variable) const
ParameterList getRootFrequenciesParameters() const override
Get the independent parameters associated to the root frequencies(s).
const SubstitutionProcessInterface & substitutionProcess() const
Return the ref to the SubstitutionProcess used to build the phylolikelihood.
size_t getNumberOfClasses() const
Get the number of model classes.
std::shared_ptr< const AlignmentDataInterface > getShrunkData() const
return a pointer to the compressed data.
std::shared_ptr< AlignedLikelihoodCalculation > getAlignedLikelihoodCalculation() const override
std::shared_ptr< const SubstitutionProcessInterface > getSubstitutionProcess() const
Return a smarter pointer to the SubstitutionProcess used to build the phylolikelihood.
ParameterList getRateDistributionParameters() const override
Get the independent parameters associated to the rate distribution(s).
SingleProcessPhyloLikelihood(Context &context, std::shared_ptr< LikelihoodCalculationSingleProcess > likCal, const ParameterList &variableNodes, size_t nProc=0, size_t nData=0)
ParameterList getDerivableParameters() const override
VVdouble getPosteriorProbabilitiesPerSitePerClass() const
Get the posterior probabilities of each class, for each site.
ValueRef< RowLik > getFirstOrderDerivativeVector(const std::string &variable) const
LikelihoodCalculation & likelihoodCalculation() const override
SingleProcessPhyloLikelihood * clone() const override
VVDataLik getLikelihoodPerSitePerClass() const
std::shared_ptr< LikelihoodCalculation > getLikelihoodCalculation() const override
LikelihoodCalculationSingleProcess & likelihoodCalculationSingleProcess() const
Vdouble getPosteriorProbabilitiesForSitePerClass(size_t pos) const
Vdouble getPosteriorStateFrequencies(uint nodeId)
AlignedLikelihoodCalculation & alignedLikelihoodCalculation() const override
std::shared_ptr< LikelihoodCalculationSingleProcess > getLikelihoodCalculationSingleProcess() const
ValueRef< RowLik > secondOrderDerivativeVector(const std::string &variable1, const std::string &variable2) const
ParameterList getNonDerivableParameters() const override
std::unordered_map< std::string, ValueRef< RowLik > > firstOrderDerivativeVectors_
For Dataflow computing.
std::shared_ptr< const Alphabet > getAlphabet() const override
Get the alphabet associated to the dataset.
std::vector< size_t > getClassWithMaxPostProbPerSite() const
size_t getSubstitutionProcessNumber() const
void setData(std::shared_ptr< const AlignmentDataInterface > sites, size_t nData=0) override
Set the dataset for which the likelihood must be evaluated.
Vdouble getPosteriorRatePerSite() const
ValueRef< RowLik > getSecondOrderDerivativeVector(const std::string &variable) const
ParameterList getSubstitutionModelParameters() const override
Get the independent parameters associated to substitution model(s).
ValueRef< RowLik > getSecondOrderDerivativeVector(const std::string &variable1, const std::string &variable2) const
size_t nProc_
the Substitution Process number
bool isInitialized() const override
std::unordered_map< std::pair< std::string, std::string >, ValueRef< RowLik >, StringPairHash > secondOrderDerivativeVectors_
std::shared_ptr< LikelihoodCalculationSingleProcess > likCal_
SingleProcessPhyloLikelihood(Context &context, std::shared_ptr< LikelihoodCalculationSingleProcess > likCal, size_t nProc=0, size_t nData=0)
: the parameters the independent parameters of the LikelihoodCalculation
virtual std::shared_ptr< const Alphabet > getAlphabet() const =0
This interface describes the substitution process along the tree and sites of the alignment.
virtual ParameterList getSubstitutionModelParameters(bool independent) const =0
Methods to retrieve the parameters of specific objects.
virtual size_t getNumberOfClasses() const =0
virtual ParameterList getRootFrequenciesParameters(bool independent) const =0
virtual ParameterList getNonDerivableParameters() const =0
virtual ParameterList getRateDistributionParameters(bool independent) const =0
virtual ParameterList getBranchLengthParameters(bool independent) const =0
virtual std::shared_ptr< const ParametrizablePhyloTree > getParametrizablePhyloTree() const =0
Defines the basic types of data flow nodes.
std::vector< double > Vdouble
std::shared_ptr< Value< T > > ValueRef
Shared pointer alias for Value<T>.
std::vector< VDataLik > VVDataLik
std::vector< Vdouble > VVdouble