A toolkit for working with phylogenetic data.
v0.24.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 {
161  utils::Color factor_edges = utils::Color( 0.0, 0.0, 0.0 );
162 
171  utils::Color base_edges = utils::Color( 0.8, 0.8, 0.8 );
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
utils::Color secondary_edges
Color for the edges away from the root that have been used in this phylo factor.
utils::Color previous_factors
Color for the edges that have been factored out before (earlier factors in the greedy search)...
Store a set of colors for making visualizations of the clades of all phylo factors.
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
Header of Color class.
utils::Color primary_edges
Color for the edges towards the root that have been used in this phylo factor.
utils::Color factor_edge
Color for the edge of that phylo factor.
Tree MassTree
Alias for a Tree that stores masses on its TreeEdges.
Class for representing phylogenetic trees.
Definition: tree/tree.hpp:97
std::vector< Color > const & color_list_set1()
Color palette set1.
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. ...
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...
utils::Color neutral_edges
Color for the edges that have not been used in this phylo factor.
Store a set of colors for making visualizations of individual phylo factors.
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().