A toolkit for working with phylogenetic data.
v0.20.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2017 Lucas Czech
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() = 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
Store counts of the occurence for certain characters at the sites of Sequences.
Definition: counts.hpp:85
static std::string status_text(PruneStatus stat)
static std::unique_ptr< EntropyTaxonData > create()
static std::string status_abbreviation(PruneStatus stat)
virtual std::unique_ptr< BaseTaxonData > clone() const override
Polymorphically copy an instance of this class. Use instead of copy constructor.
EntropyTaxonData & operator=(EntropyTaxonData &&)=delete
Base class for storing data on Taxa of a Taxonomy.
Definition: taxon_data.hpp:56