bpp-phyl3  3.0.0
SingleProcessSubstitutionMapping.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_PHYL_MAPPING_PHYLOMAPPINGS_SINGLEPROCESSSUBSTITUTIONMAPPING_H
6 #define BPP_PHYL_MAPPING_PHYLOMAPPINGS_SINGLEPROCESSSUBSTITUTIONMAPPING_H
7 
8 
9 #include "../../Likelihood/PhyloLikelihoods/SingleProcessPhyloLikelihood.h"
10 #include "../ProbabilisticSubstitutionMapping.h"
11 #include "../SubstitutionMappingTools.h"
12 
14 
16 
17 namespace bpp
18 {
27  public std::enable_shared_from_this<SingleProcessSubstitutionMapping>
28 {
29 private:
30  std::shared_ptr<SingleProcessPhyloLikelihood> pSPP_;
31 
36  void setBranchedModelSet_();
37 
38 public:
40  std::shared_ptr<SingleProcessPhyloLikelihood> spp,
41  std::shared_ptr<SubstitutionRegisterInterface> reg,
42  std::shared_ptr<const AlphabetIndex2> weights,
43  std::shared_ptr<const AlphabetIndex2> distances,
44  double threshold = -1,
45  bool verbose = true);
46 
49  pSPP_(sppm.pSPP_)
50  {}
51 
53  {
55  pSPP_ = sppm.pSPP_;
56  return *this;
57  }
58 
60 
62 
63  /*
64  * @brief ComputeCounts
65  *
66  * @param unresolvedOption mgmt of gaps in the counts (default: counted as zeros)
67  * @param threshold
68  * @param verbose
69  */
70 
71  void computeCounts(short unresolvedOption = SubstitutionMappingTools::UNRESOLVED_ZERO, double threshold = -1, bool verbose = true)
72  {
76  getWeights(),
77  getDistances(),
78  unresolvedOption,
79  threshold,
80  verbose);
81  }
82 
83  /*
84  * @brief compute Normalization
85  *
86  * @param nullParams parameters values used for normalization
87  * @param unresolvedOption mgmt of gaps in the counts (default: counted as zeros)
88  * @param verbose
89  */
90 
91  void computeNormalizations(const ParameterList& nullParams,
92  short unresolvedOption = SubstitutionMappingTools::UNRESOLVED_ZERO,
93  bool verbose = true);
94 
95  /*
96  * @brief Return the tree of counts
97  *
98  */
99  size_t getNumberOfModels() const
100  {
101  return pSPP_->substitutionProcess().getNumberOfModels();
102  }
103 
104  std::vector<size_t> getModelNumbers() const
105  {
106  return pSPP_->substitutionProcess().getModelNumbers();
107  }
108 
110  {
111  return pSPP_->likelihoodCalculationSingleProcess();
112  }
113 
115  {
116  return pSPP_->likelihoodCalculationSingleProcess();
117  }
118 };
119 } // end of namespace bpp.
120 #endif // BPP_PHYL_MAPPING_PHYLOMAPPINGS_SINGLEPROCESSSUBSTITUTIONMAPPING_H
The AbstractSinglePhyloSubstitutionMapping class: substitution mapping linked with a Single Process P...
AbstractSinglePhyloSubstitutionMapping & operator=(const AbstractSinglePhyloSubstitutionMapping &sppm)
std::shared_ptr< const AlphabetIndex2 > getWeights() const
std::shared_ptr< const SubstitutionRegisterInterface > getSubstitutionRegister() const
std::shared_ptr< const AlphabetIndex2 > getDistances() const
std::unique_ptr< ProbabilisticSubstitutionMapping > counts_
The SingleProcessSubstitutionMapping class: substitution mapping linked with a SingleProcessPhyloLike...
SingleProcessSubstitutionMapping(std::shared_ptr< SingleProcessPhyloLikelihood > spp, std::shared_ptr< SubstitutionRegisterInterface > reg, std::shared_ptr< const AlphabetIndex2 > weights, std::shared_ptr< const AlphabetIndex2 > distances, double threshold=-1, bool verbose=true)
std::shared_ptr< SingleProcessPhyloLikelihood > pSPP_
SingleProcessSubstitutionMapping & operator=(const SingleProcessSubstitutionMapping &sppm)
void computeCounts(short unresolvedOption=SubstitutionMappingTools::UNRESOLVED_ZERO, double threshold=-1, bool verbose=true)
ComputeCounts.
LikelihoodCalculationSingleProcess & getLikelihoodCalculationSingleProcess()
void setBranchedModelSet_()
Set the models of the BranchedModelSet to the adhoc branches, for normalization.
const LikelihoodCalculationSingleProcess & getLikelihoodCalculationSingleProcess() const
SingleProcessSubstitutionMapping * clone() const
void computeNormalizations(const ParameterList &nullParams, short unresolvedOption=SubstitutionMappingTools::UNRESOLVED_ZERO, bool verbose=true)
compute Normalizations
SingleProcessSubstitutionMapping(const SingleProcessSubstitutionMapping &sppm)
static const short UNRESOLVED_ZERO
Constants describing how unresolved characters are counted:
static std::unique_ptr< ProbabilisticSubstitutionMapping > computeCounts(LikelihoodCalculationSingleProcess &rltc, SubstitutionCountInterface &substitutionCount, short unresolvedOption=UNRESOLVED_ZERO, double threshold=-1, bool verbose=true)
Methods to compute mapping Trees.
Defines the basic types of data flow nodes.