bpp-phyl3  3.0.0
AbstractTreeParsimonyScore.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_PARSIMONY_ABSTRACTTREEPARSIMONYSCORE_H
6 #define BPP_PHYL_PARSIMONY_ABSTRACTTREEPARSIMONYSCORE_H
7 
8 
9 #include "../Model/StateMap.h"
10 #include "TreeParsimonyScore.h"
11 
12 // From bpp-seq:
14 
15 namespace bpp
16 {
21  public virtual TreeParsimonyScoreInterface
22 {
23 private:
24  std::shared_ptr<TreeTemplate<Node>> treePtr_;
25  std::shared_ptr<const SiteContainerInterface> data_;
26  std::shared_ptr<const Alphabet> alphabet_;
27  std::shared_ptr<const StateMapInterface> statesMap_;
28  size_t nbStates_;
29 
30 public:
32  std::shared_ptr<TreeTemplate<Node>> tree,
33  std::shared_ptr<const SiteContainerInterface> data,
34  bool verbose,
35  bool includeGaps);
36 
38  std::shared_ptr<TreeTemplate<Node>> tree,
39  std::shared_ptr<const SiteContainerInterface> data,
40  std::shared_ptr<const StateMapInterface> statesMap,
41  bool verbose);
42 
44 
45 private:
46  void init_(std::shared_ptr<const SiteContainerInterface> data, bool verbose);
47 
48 public:
49  const Tree& tree() const override { return *treePtr_; }
50  virtual const TreeTemplate<Node>& treeTemplate() const { return *treePtr_; }
51  virtual std::shared_ptr<const TreeTemplate<Node>> getTreeTemplate() const { return treePtr_; }
52  std::vector<unsigned int> getScorePerSite() const override;
53  const StateMapInterface& stateMap() const override { return *statesMap_; }
54  std::shared_ptr<const StateMapInterface> getStateMap() const override { return statesMap_; }
55 
56 protected:
57  virtual Tree& tree_() { return *treePtr_; }
58  virtual TreeTemplate<Node>& treeTemplate_() { return *treePtr_; }
59  virtual std::shared_ptr<TreeTemplate<Node>> getTreeTemplate_() { return treePtr_; }
60 };
61 } // end of namespace bpp.
62 #endif // BPP_PHYL_PARSIMONY_ABSTRACTTREEPARSIMONYSCORE_H
Partial implementation of the TreeParsimonyScore interface.
const Tree & tree() const override
Get the tree for which scores are computed.
virtual const TreeTemplate< Node > & treeTemplate() const
virtual std::shared_ptr< TreeTemplate< Node > > getTreeTemplate_()
void init_(std::shared_ptr< const SiteContainerInterface > data, bool verbose)
std::shared_ptr< TreeTemplate< Node > > treePtr_
const StateMapInterface & stateMap() const override
Get the state map associated to this instance.
virtual std::shared_ptr< const TreeTemplate< Node > > getTreeTemplate() const
virtual TreeTemplate< Node > & treeTemplate_()
std::vector< unsigned int > getScorePerSite() const override
Get the score for each site for the current tree, i.e. the total minimum number of changes in the tre...
std::shared_ptr< const SiteContainerInterface > data_
std::shared_ptr< const StateMapInterface > getStateMap() const override
Get the state map associated to this instance.
std::shared_ptr< const Alphabet > alphabet_
std::shared_ptr< const StateMapInterface > statesMap_
AbstractTreeParsimonyScore(std::shared_ptr< TreeTemplate< Node >> tree, std::shared_ptr< const SiteContainerInterface > data, bool verbose, bool includeGaps)
Map the states of a given alphabet which have a model state.
Definition: StateMap.h:25
Compute a parsimony score.
The phylogenetic tree class.
Definition: TreeTemplate.h:59
Interface for phylogenetic tree objects.
Definition: Tree.h:115
Defines the basic types of data flow nodes.