A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tree/bipartition/functions.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TREE_BIPARTITION_FUNCTIONS_H_
2 #define GENESIS_TREE_BIPARTITION_FUNCTIONS_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 "genesis/tree/tree.hpp"
37 
38 #include <string>
39 #include <vector>
40 
41 namespace genesis {
42 namespace tree {
43 
44 // =================================================================================================
45 // Bipartition Functions
46 // =================================================================================================
47 
48 std::vector<Bipartition> bipartition_set( Tree const& tree );
49 
50 std::vector<size_t> node_to_leaf_map( Tree const& tree );
51 
56 utils::Bitvector leaf_node_bitvector( Tree const& tree, std::vector<TreeNode const*> leaf_nodes );
57 
58 std::vector<size_t> get_subtree_edges( TreeLink const& subtree );
59 
64 std::vector<size_t> find_monophyletic_subtree_edges(
65  Tree const& tree,
66  std::vector<Bipartition> const& bipartitions,
67  std::vector<TreeNode const*> nodes
68 );
69 
78 Bipartition find_smallest_subtree(
79  Tree const& tree,
80  std::vector<Bipartition> const& bipartitions,
81  std::vector<TreeNode const*> nodes
82 );
83 
84 std::vector<size_t> get_clade_edges( Tree const& tree, std::vector< tree::TreeNode const* > const& nodes );
85 
86 std::vector<size_t> get_clade_edges( Tree const& tree, std::vector< std::string > const& node_names );
87 
88 } // namespace tree
89 } // namespace genesis
90 
91 #endif // include guard
std::unordered_set< std::string > node_names(Tree const &tree, bool leaves_only)
Returns an unordered set of all TreeNode names of a Tree.
std::vector< size_t > find_monophyletic_subtree_edges(Tree const &tree, std::vector< Bipartition > const &bips, std::vector< TreeNode const * > nodes)
Find clades of the tree that are monophyletic with respect to the given list of nodes, that is, clades that only contain nodes from that list. Retun all edge indices of those clades.
std::vector< size_t > get_clade_edges(Tree const &tree, std::vector< tree::TreeNode const * > const &nodes)
std::vector< Bipartition > bipartition_set(Tree const &tree)
std::vector< size_t > node_to_leaf_map(Tree const &tree)
std::vector< size_t > get_subtree_edges(TreeLink const &subtree)
Bipartition find_smallest_subtree(Tree const &tree, std::vector< Bipartition > const &bipartitions, std::vector< TreeNode const * > nodes)
Find the smallest subtree (measured in number of nodes) that contains all given nodes.
Header of Tree class.
utils::Bitvector leaf_node_bitvector(Tree const &tree, std::vector< TreeNode const * > leaf_nodes)
Return a Bitvector that has as many entries as the tree has leaf nodes, and is true where the given l...