5 #ifndef BPP_PHYL_DISTANCE_DISTANCEESTIMATION_H
6 #define BPP_PHYL_DISTANCE_DISTANCEESTIMATION_H
15 #include "../Likelihood/SubstitutionProcess.h"
16 #include "../PseudoNewtonOptimizer.h"
17 #include "../Likelihood/PhyloLikelihoods/SingleProcessPhyloLikelihood.h"
18 #include "../Likelihood/RateAcrossSitesSubstitutionProcess.h"
32 std::shared_ptr<SubstitutionProcessInterface>
process_;
34 std::shared_ptr<const AlignmentDataInterface>
sites_;
35 std::shared_ptr<DistanceMatrix>
dist_;
54 std::shared_ptr<SubstitutionProcessInterface>
process,
81 std::shared_ptr<BranchModelInterface> model,
82 std::shared_ptr<DiscreteDistributionInterface> rateDist,
93 process_ = std::make_shared<RateAcrossSitesSubstitutionProcess>(model, rateDist);
112 std::shared_ptr<SubstitutionProcessInterface>
process,
113 std::shared_ptr<const AlignmentDataInterface> sites,
115 bool computeMat =
true) :
145 std::shared_ptr<BranchModelInterface> model,
146 std::shared_ptr<DiscreteDistributionInterface> rateDist,
147 std::shared_ptr<const AlignmentDataInterface> sites,
149 bool computeMat =
true) :
159 process_ = std::make_shared<RateAcrossSitesSubstitutionProcess>(model, rateDist);
181 if (distanceEstimation.
dist_ != 0)
182 dist_ = std::make_shared<DistanceMatrix>(*distanceEstimation.
dist_);
200 if (distanceEstimation.
dist_)
201 dist_ = std::make_shared<DistanceMatrix>(*distanceEstimation.
dist_);
236 return dist_ ==
nullptr ? nullptr : std::make_unique<DistanceMatrix>(*
dist_);
246 throw Exception(
"DistanceEstimation::getSubstitutionModel(). No process associated to this instance.");
249 std::shared_ptr<const SubstitutionProcessInterface>
getProcess()
const
256 void setData(std::shared_ptr<const AlignmentDataInterface> sites =
nullptr) {
sites_ = sites; }
258 std::shared_ptr<const AlignmentDataInterface>
getData()
const {
return sites_; }
280 return process_->matchParametersValues(parameters);
std::shared_ptr< DistanceMatrix > dist_
std::unique_ptr< DistanceMatrix > getMatrix() const
Get the distance matrix.
void resetAdditionalParameters()
Reset all additional parameters.
const SubstitutionProcessInterface & process() const
std::shared_ptr< const AlignmentDataInterface > sites_
DistanceEstimation & operator=(const DistanceEstimation &distanceEstimation)
Assignment operator.
void setProcess(std::shared_ptr< SubstitutionProcessInterface > process=nullptr)
DistanceEstimation(std::shared_ptr< BranchModelInterface > model, std::shared_ptr< DiscreteDistributionInterface > rateDist, size_t verbose=1)
Create a new DistanceEstimation object according to a given substitution model and a rate distributio...
void computeMatrix()
Perform the distance computation.
const AlignmentDataInterface & data() const
bool matchParametersValues(const ParameterList ¶meters)
void setOptimizer(std::shared_ptr< OptimizerInterface > optimizer)
const OptimizerInterface & optimizer() const
size_t getVerbose() const
DistanceEstimation(std::shared_ptr< BranchModelInterface > model, std::shared_ptr< DiscreteDistributionInterface > rateDist, std::shared_ptr< const AlignmentDataInterface > sites, size_t verbose=1, bool computeMat=true)
Create a new DistanceEstimation object and compute distances according to a given substitution model ...
OptimizerInterface & optimizer()
std::shared_ptr< OptimizerInterface > getOptimizer()
std::shared_ptr< const OptimizerInterface > getOptimizer() const
void setData(std::shared_ptr< const AlignmentDataInterface > sites=nullptr)
std::shared_ptr< MetaOptimizer > defaultOptimizer_
DistanceEstimation(std::shared_ptr< SubstitutionProcessInterface > process, std::shared_ptr< const AlignmentDataInterface > sites, size_t verbose=1, bool computeMat=true)
Create a new DistanceEstimation object and compute distances according to a given substitution proces...
std::shared_ptr< SubstitutionProcessInterface > process_
std::shared_ptr< const SubstitutionProcessInterface > getProcess() const
void setVerbose(size_t verbose)
ParameterList parameters_
DistanceEstimation(const DistanceEstimation &distanceEstimation)
Copy constructor.
DistanceEstimation(std::shared_ptr< SubstitutionProcessInterface > process, size_t verbose=1)
Create a new DistanceEstimation object according to a given substitution process.
DistanceEstimation * clone() const override
std::shared_ptr< OptimizerInterface > optimizer_
virtual ~DistanceEstimation()
std::shared_ptr< const AlignmentDataInterface > getData() const
void setAdditionalParameters(const ParameterList ¶meters)
Specify a list of parameters to be estimated.
This interface describes the substitution process along the tree and sites of the alignment.
Defines the basic types of data flow nodes.