A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
measures.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_PLACEMENT_FUNCTION_MEASURES_H_
2 #define GENESIS_PLACEMENT_FUNCTION_MEASURES_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 
35 
36 #include <cstddef>
37 #include <utility>
38 #include <vector>
39 
40 namespace genesis {
41 
42 // =================================================================================================
43 // Forward Declarations
44 // =================================================================================================
45 
46 namespace placement {
47 
48  class Sample;
49  class SampleSet;
50  class PlacementTreeEdgeData;
51  class PlacementTreeNodeData;
52  class Pquery;
53  class PqueryPlacement;
54  struct PqueryPlain;
55 
56 }
57 
58 namespace utils {
59 
60  template<typename T>
61  class Matrix;
62 
63  class Histogram;
64 
65 }
66 
67 // =================================================================================================
68 // Placement Measures
69 // =================================================================================================
70 
71 namespace placement {
72 
122 double pquery_distance (
123  const PqueryPlain& pqry_a,
124  const PqueryPlain& pqry_b,
125  const utils::Matrix<double>& node_distances,
126  bool with_pendant_length = false
127 );
128 
129 double placement_distance(
130  PqueryPlacement const& place_a,
131  PqueryPlacement const& place_b,
132  utils::Matrix<double> const& node_distances
133 );
134 
135 // -------------------------------------------------------------------------------------------------
136 // Expected Distance between Placement Locations
137 // -------------------------------------------------------------------------------------------------
138 
148  Pquery const& pquery,
149  utils::Matrix<double> const& node_distances
150 );
151 
160 double expected_distance_between_placement_locations( Sample const& sample, Pquery const& pquery );
161 
167 double edpl( Sample const& sample, Pquery const& pquery );
168 
175 std::vector<double> expected_distance_between_placement_locations( Sample const& sample );
176 
181 std::vector<double> edpl( Sample const& sample );
182 
183 // -------------------------------------------------------------------------------------------------
184 // Pairwise Distance
185 // -------------------------------------------------------------------------------------------------
186 
201 double pairwise_distance (
202  const Sample& smp_a,
203  const Sample& smp_b,
204  bool with_pendant_length = false
205 );
206 
207 // double closest_pair_distance (
208 // const Sample& smp_a,
209 // const Sample& smp_b,
210 // bool with_pendant_length = false
211 // );
212 
213 // -------------------------------------------------------------------------------------------------
214 // Variance
215 // -------------------------------------------------------------------------------------------------
216 
241 double variance (
242  const Sample& smp,
243  bool with_pendant_length = false
244 );
245 
246 } // namespace placement
247 } // namespace genesis
248 
249 #endif // include guard
double pairwise_distance(const Sample &smp_a, const Sample &smp_b, bool with_pendant_length)
Calculate the normalized pairwise distance between all placements of the two Samples.
Definition: measures.cpp:229
double variance(const Sample &smp, bool with_pendant_length)
Calculate the variance of the placements on a tree.
Definition: measures.cpp:327
double pquery_distance(const PqueryPlain &pqry_a, const PqueryPlain &pqry_b, const utils::Matrix< double > &node_distances, bool with_pendant_length)
Calculates the normalized distance between two plain pqueries. It is mainly a helper method for dista...
Definition: measures.cpp:77
double edpl(Sample const &sample, Pquery const &pquery)
Shortcut alias for expected_distance_between_placement_locations().
Definition: measures.cpp:199
double placement_distance(PqueryPlacement const &place_a, PqueryPlacement const &place_b, utils::Matrix< double > const &node_distances)
Definition: measures.cpp:126
double expected_distance_between_placement_locations(Pquery const &pquery, utils::Matrix< double > const &node_distances)
Calculate the EDPL uncertainty values for a Pquery.
Definition: measures.cpp:175