70 std::string
const& newick_filename
81 std::string
const& phyloxml_filename
84 tree, std::vector<utils::Color>{}, phyloxml_filename
90 std::vector<utils::Color>
const& color_per_branch,
91 std::string
const& phyloxml_filename
98 if( ! color_per_branch.empty() ) {
99 color_plugin.register_with( writer );
100 color_plugin.edge_colors( color_per_branch );
108 std::vector<double>
const& value_per_branch,
111 std::string
const& phyloxml_filename
114 tree, color_map( color_norm, value_per_branch ), phyloxml_filename
124 std::string
const& nexus_filename
127 tree, std::vector<utils::Color>{}, nexus_filename
133 std::vector<utils::Color>
const& color_per_branch,
134 std::string
const& nexus_filename
138 newick_writer.trailing_new_line(
false );
142 if( ! color_per_branch.empty() ) {
143 color_plugin.register_with( newick_writer );
144 color_plugin.edge_colors( color_per_branch );
151 auto taxa = utils::make_unique<utils::NexusTaxa>();
153 nexus_doc.set_block( std::move( taxa ));
156 auto trees = utils::make_unique<utils::NexusTrees>();
157 trees->add_tree(
"tree1", newick_writer.to_string(tree) );
158 nexus_doc.set_block( std::move(trees) );
167 std::vector<double>
const& value_per_branch,
170 std::string
const& nexus_filename
173 tree, color_map( color_norm, value_per_branch ), nexus_filename
184 std::vector<utils::Color>
const& color_per_branch
188 std::unique_ptr<LayoutBase> layout = [&]() -> std::unique_ptr<LayoutBase> {
190 return utils::make_unique<CircularLayout>( tree, params.
type, params.
ladderize );
193 return utils::make_unique<RectangularLayout>( tree, params.
type, params.
ladderize );
195 throw std::runtime_error(
"Unknown Tree shape parameter." );
199 if( ! color_per_branch.empty() ) {
200 std::vector<utils::SvgStroke> strokes;
201 for(
auto const& color : color_per_branch ) {
202 auto stroke = params.
stroke;
203 stroke.
color = color;
205 strokes.push_back( std::move( stroke ));
212 svg_doc.
margin.
left = svg_doc.margin.top = svg_doc.margin.bottom = svg_doc.margin.right = 200;
219 std::string
const& svg_filename
225 tree, params, std::vector<utils::Color>{},
234 std::vector<utils::Color>
const& color_per_branch,
235 std::string
const& svg_filename
241 tree, params, color_per_branch,
250 std::vector<double>
const& value_per_branch,
253 std::string
const& svg_filename
256 tree, params, color_map( color_norm, value_per_branch ), color_map, color_norm, svg_filename
263 std::vector<utils::Color>
const& color_per_branch,
266 std::string
const& svg_filename
272 if( ! color_map.
empty() ) {
276 svg_pal_settings.height = svg_doc.bounding_box().height() / 2.0;
277 svg_pal_settings.width = svg_pal_settings.height / 10.0;
278 svg_pal_settings.text_size = svg_pal_settings.height / 30.0;
284 1.2 * svg_doc.bounding_box().width() / 2.0, 0.0
286 svg_doc.margin.right = 0.2 * svg_doc.bounding_box().width() / 2.0 + 2 * svg_pal_settings.width + 200;
290 1.2 * svg_doc.bounding_box().width(), svg_pal_settings.height
292 svg_doc.margin.right = 0.2 * svg_doc.bounding_box().width() + 2 * svg_pal_settings.width + 200;
296 if( ! svg_scale.first.empty() ) {
297 svg_doc.defs.push_back( svg_scale.first );
299 svg_doc.add( svg_scale.second );
305 svg_doc.write( ofs );
311 std::vector<utils::Color>
const& color_per_branch,
312 std::vector<utils::Color>
const& color_list,
313 std::vector<std::string>
const& color_labels,
314 std::string
const& svg_filename
327 1.2 * svg_doc.bounding_box().width() / 2.0, 0.0
333 1.2 * svg_doc.bounding_box().width(), svg_doc.bounding_box().height() / 2.0
340 auto const sf = ( svg_doc.bounding_box().height() / 2.0 ) / (
static_cast<double>( color_list.size() ) * 15.0 );
344 svg_doc.add( svg_color_list );
349 svg_doc.write( ofs );