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
15namespace bpp
16{
21 public virtual TreeParsimonyScoreInterface
22{
23private:
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
30public:
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
45private:
46 void init_(std::shared_ptr<const SiteContainerInterface> data, bool verbose);
47
48public:
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
56protected:
57 virtual Tree& tree_() { 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.
std::shared_ptr< const StateMapInterface > getStateMap() const override
Get the state map associated to this instance.
void init_(std::shared_ptr< const SiteContainerInterface > data, bool verbose)
virtual std::shared_ptr< TreeTemplate< Node > > getTreeTemplate_()
std::shared_ptr< TreeTemplate< Node > > treePtr_
AbstractTreeParsimonyScore(std::shared_ptr< TreeTemplate< Node > > tree, std::shared_ptr< const SiteContainerInterface > data, bool verbose, bool includeGaps)
virtual std::shared_ptr< const TreeTemplate< Node > > getTreeTemplate() const
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...
virtual TreeTemplate< Node > & treeTemplate_()
std::shared_ptr< const SiteContainerInterface > data_
virtual const TreeTemplate< Node > & treeTemplate() const
std::shared_ptr< const Alphabet > alphabet_
std::shared_ptr< const StateMapInterface > statesMap_
const StateMapInterface & stateMap() const override
Get the state map associated to this instance.
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.