A library for working with phylogenetic and population genetic data.
v0.32.0
nhd.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_PLACEMENT_FUNCTION_NHD_H_
2 #define GENESIS_PLACEMENT_FUNCTION_NHD_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2018 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 
34 #include <cstddef>
35 #include <vector>
36 
37 namespace genesis {
38 
39 // =================================================================================================
40 // Forward Declarations
41 // =================================================================================================
42 
43 namespace placement {
44 
45  class Sample;
46  class SampleSet;
47 
48 }
49 
50 namespace tree {
51 
52  class Tree;
53 
54 }
55 
56 namespace utils {
57 
58  template<typename T>
59  class Matrix;
60 
61 }
62 
63 namespace placement {
64 
65 // =================================================================================================
66 // Node Distance Histogram
67 // =================================================================================================
68 
76 {
77  double min;
78  double max;
79  std::vector<double> bins;
80 };
81 
86 {
87  std::vector<NodeDistanceHistogram> histograms;
88 };
89 
90 // =================================================================================================
91 // Basic Functions
92 // =================================================================================================
93 
103  Sample const& sample,
104  utils::Matrix<double> const& node_distances,
105  utils::Matrix<signed char> const& node_sides,
106  size_t const histogram_bins
107 );
108 
113  NodeDistanceHistogramSet const& lhs,
114  NodeDistanceHistogramSet const& rhs
115 );
116 
122  std::vector<NodeDistanceHistogramSet> const& histogram_sets
123 );
124 
125 // =================================================================================================
126 // High Level Functions
127 // =================================================================================================
128 
139  Sample const& sample_a,
140  Sample const& sample_b,
141  size_t const histogram_bins = 25
142 );
143 
151  SampleSet const& sample_set,
152  size_t const histogram_bins = 25
153 );
154 
155 } // namespace placement
156 } // namespace genesis
157 
158 #endif // include guard
genesis::placement::SampleSet
Store a set of Samples with associated names.
Definition: sample_set.hpp:54
genesis::placement::node_distance_histogram_set
NodeDistanceHistogramSet node_distance_histogram_set(Sample const &sample, utils::Matrix< double > const &node_distances, utils::Matrix< signed char > const &node_sides, size_t const histogram_bins)
Calculate the NodeDistanceHistogramSet representing a single Sample, given the necessary matrices of ...
Definition: nhd.cpp:252
genesis::placement::Sample
Manage a set of Pqueries along with the PlacementTree where the PqueryPlacements are placed on.
Definition: sample.hpp:68
genesis::placement::NodeDistanceHistogram::bins
std::vector< double > bins
Definition: nhd.hpp:79
genesis::utils::Matrix< double >
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::placement::NodeDistanceHistogramSet::histograms
std::vector< NodeDistanceHistogram > histograms
Definition: nhd.hpp:87
genesis::placement::NodeDistanceHistogram::min
double min
Definition: nhd.hpp:77
genesis::placement::NodeDistanceHistogramSet
Collection of NodeDistanceHistograms that describes one Sample.
Definition: nhd.hpp:85
genesis::placement::NodeDistanceHistogram::max
double max
Definition: nhd.hpp:78
genesis::placement::NodeDistanceHistogram
Simple histogram data structure with equal sized bins.
Definition: nhd.hpp:75
genesis::placement::node_histogram_distance
static double node_histogram_distance(NodeDistanceHistogram const &lhs, NodeDistanceHistogram const &rhs)
Definition: nhd.cpp:270