A library for working with phylogenetic and population genetic data.
v0.27.0
phylo_factor_colors.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TREE_MASS_TREE_PHYLO_FACTOR_COLORS_H_
2 #define GENESIS_TREE_MASS_TREE_PHYLO_FACTOR_COLORS_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2020 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 
37 
38 #include <functional>
39 #include <limits>
40 #include <unordered_set>
41 #include <vector>
42 
43 namespace genesis {
44 namespace tree {
45 
46 // =================================================================================================
47 // Forward Declarations
48 // =================================================================================================
49 
50 class Subtree;
51 class Tree;
52 using MassTree = Tree;
53 
54 // =================================================================================================
55 // Helper Functions
56 // =================================================================================================
57 
66 std::vector<size_t> phylo_factor_edge_indices(
67  std::vector<PhyloFactor> const& factors,
68  size_t max_factor = std::numeric_limits<std::size_t>::max()
69 );
70 
71 // =================================================================================================
72 // Single Factor Coloring
73 // =================================================================================================
74 
83 {
90 
96  utils::Color primary_edges = utils::Color( 0.529411765, 0.439215686, 0.670588235 );
97 
103  utils::Color secondary_edges = utils::Color( 0.352941176, 0.682352941, 0.380392157 );
104 
112 
119 };
120 
136 std::vector<utils::Color> phylo_factor_single_factor_colors(
137  Tree const& tree,
138  std::vector<PhyloFactor> const& factors,
139  size_t factor_index,
140  PhyloFactorSingleColors colors = {}
141 );
142 
143 // =================================================================================================
144 // Factor Clade Coloring
145 // =================================================================================================
146 
155 {
162 
172 
179  std::vector<utils::Color> clade_colors = utils::color_list_set1();
180 };
181 
199 std::vector<utils::Color> phylo_factor_clade_colors(
200  Tree const& tree,
201  std::vector<PhyloFactor> const& factors,
202  size_t num_factors = 0,
203  PhyloFactorCladeColors colors = {}
204 );
205 
206 } // namespace tree
207 } // namespace genesis
208 
209 #endif // include guard
genesis::utils::Color
Definition: color.hpp:47
phylo_factor.hpp
genesis::tree::phylo_factor_single_factor_colors
std::vector< utils::Color > phylo_factor_single_factor_colors(Tree const &tree, std::vector< PhyloFactor > const &factors, size_t factor_index, PhyloFactorSingleColors colors)
Return a color for each edge indicating its role in a single phylogenetic factor.
Definition: phylo_factor_colors.cpp:60
genesis::tree::MassTree
Tree MassTree
Alias for a Tree that stores masses on its TreeEdges.
Definition: placement/function/operators.hpp:54
genesis::tree::PhyloFactorSingleColors::previous_factors
utils::Color previous_factors
Color for the edges that have been factored out before (earlier factors in the greedy search).
Definition: phylo_factor_colors.hpp:111
genesis::tree::PhyloFactorCladeColors::base_edges
utils::Color base_edges
Color for the edges towards the root of the first phylo factor.
Definition: phylo_factor_colors.hpp:171
genesis::utils::color_list_set1
std::vector< Color > const & color_list_set1()
Color palette set1.
Definition: list_qualitative.cpp:183
genesis::tree::Tree
Class for representing phylogenetic trees.
Definition: tree/tree.hpp:97
genesis::tree::PhyloFactorSingleColors::primary_edges
utils::Color primary_edges
Color for the edges towards the root that have been used in this phylo factor.
Definition: phylo_factor_colors.hpp:96
genesis::tree::phylo_factor_clade_colors
std::vector< utils::Color > phylo_factor_clade_colors(Tree const &tree, std::vector< PhyloFactor > const &factors, size_t num_factors, PhyloFactorCladeColors colors)
Return a color for each edge, indicating which factor (phylogenetic unit, clade) it belongs to.
Definition: phylo_factor_colors.cpp:112
genesis::tree::PhyloFactorSingleColors::factor_edge
utils::Color factor_edge
Color for the edge of that phylo factor.
Definition: phylo_factor_colors.hpp:89
genesis::tree::PhyloFactorCladeColors::factor_edges
utils::Color factor_edges
Color for the "winning" edges of phylo factors.
Definition: phylo_factor_colors.hpp:161
genesis::tree::phylo_factor_edge_indices
std::vector< size_t > phylo_factor_edge_indices(std::vector< PhyloFactor > const &factors, size_t max_factor)
Get a list of all edges that have factored out by phylogenetic_factorization().
Definition: phylo_factor_colors.cpp:43
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::tree::PhyloFactorCladeColors
Store a set of colors for making visualizations of the clades of all phylo factors.
Definition: phylo_factor_colors.hpp:154
color.hpp
Header of Color class.
genesis::tree::PhyloFactorSingleColors::neutral_edges
utils::Color neutral_edges
Color for the edges that have not been used in this phylo factor.
Definition: phylo_factor_colors.hpp:118
list_qualitative.hpp
genesis::tree::PhyloFactorSingleColors
Store a set of colors for making visualizations of individual phylo factors.
Definition: phylo_factor_colors.hpp:82
genesis::tree::PhyloFactorSingleColors::secondary_edges
utils::Color secondary_edges
Color for the edges away from the root that have been used in this phylo factor.
Definition: phylo_factor_colors.hpp:103
genesis::tree::PhyloFactorCladeColors::clade_colors
std::vector< utils::Color > clade_colors
Colors for the sets of edges away from the root that have been split by the phylo factors.
Definition: phylo_factor_colors.hpp:179