A toolkit for working with phylogenetic data.
v0.24.0
rf.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TREE_BIPARTITION_RF_H_
2 #define GENESIS_TREE_BIPARTITION_RF_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2019 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 
34 #include "genesis/tree/tree.hpp"
38 
39 #include <string>
40 #include <unordered_map>
41 #include <unordered_set>
42 #include <vector>
43 #include <utility>
44 
45 namespace genesis {
46 namespace tree {
47 
48 // =================================================================================================
49 // Helper Functions
50 // =================================================================================================
51 
61 std::unordered_map<std::string, size_t> rf_taxon_name_map( Tree const& tree );
62 
72 std::vector<utils::Bitvector> rf_get_bitvectors(
73  Tree const& tree,
74  std::unordered_map<std::string, size_t> const& names
75 );
76 
90 std::unordered_map<utils::Bitvector, utils::Bitvector> rf_get_occurrences(
91  TreeSet const& trees
92 );
93 
104 std::unordered_map<utils::Bitvector, utils::Bitvector> rf_get_occurrences(
105  Tree const& lhs,
106  TreeSet const& rhs
107 );
108 
115 std::unordered_map<utils::Bitvector, utils::Bitvector> rf_get_occurrences(
116  Tree const& lhs,
117  Tree const& rhs
118 );
119 
120 // =================================================================================================
121 // Absolute RF Distance Functions
122 // =================================================================================================
123 
129 utils::Matrix<size_t> rf_distance_absolute( TreeSet const& trees );
130 
138 std::vector<size_t> rf_distance_absolute( Tree const& lhs, TreeSet const& rhs );
139 
145 size_t rf_distance_absolute( Tree const& lhs, Tree const& rhs );
146 
147 // =================================================================================================
148 // Relative RF Distance Functions
149 // =================================================================================================
150 
161 utils::Matrix<double> rf_distance_relative( TreeSet const& trees );
162 
175 std::vector<double> rf_distance_relative( Tree const& lhs, TreeSet const& rhs );
176 
187 double rf_distance_relative( Tree const& lhs, Tree const& rhs );
188 
189 } // namespace tree
190 } // namespace genesis
191 
192 #endif // include guard
utils::Matrix< double > rf_distance_relative(TreeSet const &trees)
Compute the pairwise relative RF (Robinson-Foulds) distance metric between a set of trees...
Definition: rf.cpp:459
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
utils::Matrix< size_t > rf_distance_absolute(TreeSet const &trees)
Compute the pairwise absolute RF (Robinson-Foulds) distance metric between a set of trees...
Definition: rf.cpp:358
std::vector< utils::Bitvector > rf_get_bitvectors(Tree const &tree, std::unordered_map< std::string, size_t > const &names)
Get all split Bitvectors for a given Tree.
Definition: rf.cpp:218
Header of Tree class.
std::unordered_map< std::string, size_t > rf_taxon_name_map(Tree const &tree)
Get a mapping from taxon names to unique IDs.
Definition: rf.cpp:54
std::unordered_map< utils::Bitvector, utils::Bitvector > rf_get_occurrences(TreeSet const &trees)
Get an occurrence map for each split found in the given TreeSet.
Definition: rf.cpp:240