A library for working with phylogenetic and population genetic data.
v0.27.0
entropy_data.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TAXONOMY_FUNCTIONS_ENTROPY_DATA_H_
2 #define GENESIS_TAXONOMY_FUNCTIONS_ENTROPY_DATA_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2019 Lucas Czech and HITS gGmbH
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
36 
37 #include <string>
38 
39 namespace genesis {
40 namespace taxonomy {
41 
42 // =================================================================================================
43 // Forwad Declarations
44 // =================================================================================================
45 
46 class Taxon;
47 class Taxonomy;
48 
49 // =================================================================================================
50 // Entropy Data
51 // =================================================================================================
52 
54 {
55 public:
56 
57  // -------------------------------------------------------------------
58  // Typedefs and Enums
59  // -------------------------------------------------------------------
60 
61  enum class PruneStatus
62  {
63  kInside,
64  kBorder,
65  kOutside
66  };
67 
68  static std::string status_text( PruneStatus stat )
69  {
70  switch( stat ) {
71  case PruneStatus::kInside: return "Inside";
72  case PruneStatus::kBorder: return "Border";
73  case PruneStatus::kOutside: return "Outside";
74  default: return "Unknown";
75  }
76  }
77 
78  static std::string status_abbreviation( PruneStatus stat )
79  {
80  switch( stat ) {
81  case PruneStatus::kInside: return "I";
82  case PruneStatus::kBorder: return "B";
83  case PruneStatus::kOutside: return "O";
84  default: return "U";
85  }
86  }
87 
88  // -------------------------------------------------------------------
89  // Constructor and Rule of Five
90  // -------------------------------------------------------------------
91 
92 public:
93 
94  virtual ~EntropyTaxonData() override = default;
95 
96  // Move ctor and assignment.
97  EntropyTaxonData( EntropyTaxonData&& ) = delete;
99 
100 protected:
101 
102  EntropyTaxonData() = default;
103 
104  // Copy ctor and assignment.
105  EntropyTaxonData( EntropyTaxonData const& ) = default;
106  EntropyTaxonData& operator= ( EntropyTaxonData const& ) = default;
107 
108 public:
109 
110  static std::unique_ptr< EntropyTaxonData > create()
111  {
112  return std::unique_ptr< EntropyTaxonData >( new EntropyTaxonData() );
113  }
114 
115  virtual std::unique_ptr< BaseTaxonData > clone() const override
116  {
117  return std::unique_ptr< EntropyTaxonData >( new EntropyTaxonData( *this ));
118  }
119 
120  // -----------------------------------------------------
121  // Data Members
122  // -----------------------------------------------------
123 
125  double entropy = 0.0;
127 
128 };
129 
130 } // namespace taxonomy
131 } // namespace genesis
132 
133 #endif // include guard
genesis::taxonomy::BaseTaxonData
Base class for storing data on Taxa of a Taxonomy.
Definition: taxon_data.hpp:56
genesis::taxonomy::EntropyTaxonData::PruneStatus::kBorder
@ kBorder
genesis::taxonomy::EntropyTaxonData::EntropyTaxonData
EntropyTaxonData()=default
genesis::taxonomy::EntropyTaxonData::status_abbreviation
static std::string status_abbreviation(PruneStatus stat)
Definition: entropy_data.hpp:78
counts.hpp
genesis::taxonomy::EntropyTaxonData
Definition: entropy_data.hpp:53
taxon_data.hpp
genesis::sequence::SiteCounts
Store counts of the occurence for certain characters at the sites of Sequences.
Definition: counts.hpp:85
genesis::taxonomy::EntropyTaxonData::~EntropyTaxonData
virtual ~EntropyTaxonData() override=default
genesis::taxonomy::EntropyTaxonData::counts
sequence::SiteCounts counts
Definition: entropy_data.hpp:124
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition: placement/formats/edge_color.cpp:42
genesis::taxonomy::EntropyTaxonData::operator=
EntropyTaxonData & operator=(EntropyTaxonData &&)=delete
genesis::taxonomy::EntropyTaxonData::status_text
static std::string status_text(PruneStatus stat)
Definition: entropy_data.hpp:68
genesis::taxonomy::EntropyTaxonData::status
PruneStatus status
Definition: entropy_data.hpp:126
genesis::taxonomy::EntropyTaxonData::PruneStatus
PruneStatus
Definition: entropy_data.hpp:61
genesis::taxonomy::EntropyTaxonData::entropy
double entropy
Definition: entropy_data.hpp:125
genesis::taxonomy::EntropyTaxonData::PruneStatus::kOutside
@ kOutside
genesis::taxonomy::EntropyTaxonData::clone
virtual std::unique_ptr< BaseTaxonData > clone() const override
Polymorphically copy an instance of this class. Use instead of copy constructor.
Definition: entropy_data.hpp:115
genesis::taxonomy::EntropyTaxonData::create
static std::unique_ptr< EntropyTaxonData > create()
Definition: entropy_data.hpp:110
genesis::taxonomy::EntropyTaxonData::PruneStatus::kInside
@ kInside