A library for working with phylogenetic and population genetic data.
v0.32.0
tree/drawing/functions.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TREE_DRAWING_FUNCTIONS_H_
2 #define GENESIS_TREE_DRAWING_FUNCTIONS_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2024 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@sund.ku.dk>
23  University of Copenhagen, Globe Institute, Section for GeoGenetics
24  Oster Voldgade 5-7, 1350 Copenhagen K, Denmark
25 */
26 
40 
41 #include <string>
42 #include <vector>
43 
44 namespace genesis {
45 namespace tree {
46 
47 // =================================================================================================
48 // Newick Functions
49 // =================================================================================================
50 
57  CommonTree const& tree,
58  std::string const& newick_filename
59 );
60 
61 // =================================================================================================
62 // Phyloxml Functions
63 // =================================================================================================
64 
71  CommonTree const& tree,
72  std::string const& phyloxml_filename
73 );
74 
76  CommonTree const& tree,
77  std::vector<utils::Color> const& color_per_branch,
78  std::string const& phyloxml_filename
79 );
80 
82  CommonTree const& tree,
83  std::vector<double> const& value_per_branch,
84  utils::ColorMap const& color_map,
85  utils::ColorNormalization const& color_norm,
86  std::string const& phyloxml_filename
87 );
88 
89 // =================================================================================================
90 // Nexus Functions
91 // =================================================================================================
92 
99  CommonTree const& tree,
100  std::string const& nexus_filename
101 );
102 
104  CommonTree const& tree,
105  std::vector<utils::Color> const& color_per_branch,
106  std::string const& nexus_filename
107 );
108 
110  CommonTree const& tree,
111  std::vector<double> const& value_per_branch,
112  utils::ColorMap const& color_map,
113  utils::ColorNormalization const& color_norm,
114  std::string const& nexus_filename
115 );
116 
117 // =================================================================================================
118 // SVG Params
119 // =================================================================================================
120 
127 {
130  bool ladderize = true;
132 };
133 
134 // =================================================================================================
135 // Tree to SVG Document
136 // =================================================================================================
137 
139  CommonTree const& tree,
140  LayoutParameters const& params
141 );
142 
144  CommonTree const& tree,
145  LayoutParameters const& params,
146  std::vector<utils::Color> const& color_per_branch
147 );
148 
150  CommonTree const& tree,
151  LayoutParameters const& params,
152  std::vector<double> const& value_per_branch,
153  utils::ColorMap const& color_map,
154  utils::ColorNormalization const& color_norm
155 );
156 
158  CommonTree const& tree,
159  LayoutParameters const& params,
160  std::vector<utils::Color> const& color_per_branch,
161  utils::ColorMap const& color_map,
162  utils::ColorNormalization const& color_norm
163 );
164 
166  CommonTree const& tree,
167  LayoutParameters const& params,
168  std::vector<utils::Color> const& color_per_branch,
169  utils::ColorMap const& color_map,
170  utils::ColorNormalization const& color_norm,
171  std::vector<utils::SvgGroup> const& node_shapes,
172  std::vector<utils::SvgGroup> const& edge_shapes
173 );
174 
176  CommonTree const& tree,
177  LayoutParameters const& params,
178  std::vector<utils::Color> const& color_per_branch,
179  std::vector<utils::Color> const& color_list,
180  std::vector<std::string> const& color_labels
181 );
182 
183 // =================================================================================================
184 // Tree to SVG File
185 // =================================================================================================
186 
188  CommonTree const& tree,
189  LayoutParameters const& params,
190  std::string const& svg_filename
191 );
192 
194  CommonTree const& tree,
195  LayoutParameters const& params,
196  std::vector<utils::Color> const& color_per_branch,
197  std::string const& svg_filename
198 );
199 
201  CommonTree const& tree,
202  LayoutParameters const& params,
203  std::vector<double> const& value_per_branch,
204  utils::ColorMap const& color_map,
205  utils::ColorNormalization const& color_norm,
206  std::string const& svg_filename
207 );
208 
210  CommonTree const& tree,
211  LayoutParameters const& params,
212  std::vector<utils::Color> const& color_per_branch,
213  utils::ColorMap const& color_map,
214  utils::ColorNormalization const& color_norm,
215  std::string const& svg_filename
216 );
217 
219  CommonTree const& tree,
220  LayoutParameters const& params,
221  std::vector<utils::Color> const& color_per_branch,
222  utils::ColorMap const& color_map,
223  utils::ColorNormalization const& color_norm,
224  std::vector<utils::SvgGroup> const& node_shapes,
225  std::vector<utils::SvgGroup> const& edge_shapes,
226  std::string const& svg_filename
227 );
228 
230  CommonTree const& tree,
231  LayoutParameters const& params,
232  std::vector<utils::Color> const& color_per_branch,
233  std::vector<utils::Color> const& color_list,
234  std::vector<std::string> const& color_labels,
235  std::string const& svg_filename
236 );
237 
238 } // namespace tree
239 } // namespace genesis
240 
241 #endif // include guard
genesis::tree::LayoutShape
LayoutShape
Shape of the tree for drawing, either circular or rectangular.
Definition: layout_base.hpp:50
genesis::utils::ColorMap
Store a list of colors and offer them as a map for values in range [ 0.0, 1.0 ].
Definition: map.hpp:61
genesis::tree::LayoutParameters
Collection of params for simple tree to svg wrapper functions.
Definition: tree/drawing/functions.hpp:126
genesis::tree::LayoutType
LayoutType
Type of tree for drawing, either phylogram or cladogram.
Definition: layout_base.hpp:62
genesis::utils::ColorNormalization
Base class for color normalization.
Definition: normalization.hpp:52
map.hpp
genesis::tree::write_tree_to_newick_file
void write_tree_to_newick_file(CommonTree const &tree, std::string const &newick_filename)
Write a newick file containing a tree.
Definition: tree/drawing/functions.cpp:68
layout_base.hpp
genesis::tree::write_color_tree_to_phyloxml_file
void write_color_tree_to_phyloxml_file(CommonTree const &tree, std::vector< utils::Color > const &color_per_branch, std::string const &phyloxml_filename)
Definition: tree/drawing/functions.cpp:88
genesis::tree::get_tree_svg_document
utils::SvgDocument get_tree_svg_document(CommonTree const &tree, LayoutParameters const &params)
Definition: tree/drawing/functions.cpp:226
genesis::utils::SvgStroke
Definition: attributes.hpp:49
genesis::tree::LayoutParameters::stroke
utils::SvgStroke stroke
Definition: tree/drawing/functions.hpp:131
genesis::tree::Tree
Class for representing phylogenetic trees.
Definition: tree/tree.hpp:97
genesis::tree::LayoutShape::kCircular
@ kCircular
genesis::tree::write_tree_to_phyloxml_file
void write_tree_to_phyloxml_file(CommonTree const &tree, std::string const &phyloxml_filename)
Write a phyloxml file containing a tree.
Definition: tree/drawing/functions.cpp:79
genesis::tree::LayoutParameters::ladderize
bool ladderize
Definition: tree/drawing/functions.hpp:130
genesis::tree::CommonTree
Tree CommonTree
Alias for a Tree with data types CommonNodeData and CommonEdgeData.
Definition: placement/function/distances.hpp:55
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::write_tree_to_nexus_file
void write_tree_to_nexus_file(CommonTree const &tree, std::string const &nexus_filename)
Write a nexus file containing a tree.
Definition: tree/drawing/functions.cpp:122
genesis::tree::get_color_tree_svg_document
utils::SvgDocument get_color_tree_svg_document(CommonTree const &tree, LayoutParameters const &params, std::vector< utils::Color > const &color_per_branch)
Definition: tree/drawing/functions.cpp:238
tree.hpp
color.hpp
Header of Color class.
genesis::tree::write_color_tree_to_svg_file
void write_color_tree_to_svg_file(CommonTree const &tree, LayoutParameters const &params, std::vector< utils::Color > const &color_per_branch, std::string const &svg_filename)
Definition: tree/drawing/functions.cpp:386
genesis::utils::SvgDocument
Definition: svg/document.hpp:50
genesis::tree::LayoutType::kCladogram
@ kCladogram
svg.hpp
genesis::tree::write_tree_to_svg_file
void write_tree_to_svg_file(CommonTree const &tree, LayoutParameters const &params, std::string const &svg_filename)
Definition: tree/drawing/functions.cpp:371
normalization.hpp
genesis::tree::write_color_tree_to_nexus_file
void write_color_tree_to_nexus_file(CommonTree const &tree, std::vector< utils::Color > const &color_per_branch, std::string const &nexus_filename)
Definition: tree/drawing/functions.cpp:131
genesis::tree::LayoutParameters::shape
LayoutShape shape
Definition: tree/drawing/functions.hpp:128
genesis::tree::LayoutParameters::type
LayoutType type
Definition: tree/drawing/functions.hpp:129