ʻOhana
Population structure, admixture history, and selection using learning methods.
jade.nwk2svg.hpp
1 /* -------------------------------------------------------------------------
2  Ohana
3  Copyright (c) 2015-2020 Jade Cheng (\___/)
4  Jade Cheng <info@jade-cheng.com> (='.'=)
5  ------------------------------------------------------------------------- */
6 
7 #ifndef JADE_NWK2SVG_HPP__
8 #define JADE_NWK2SVG_HPP__
9 
10 #include "jade.svg_tree.hpp"
11 
12 namespace jade
13 {
14  ///
15  /// A template for a class that converts Newick-formatted trees to SVG
16  /// representations.
17  ///
18  template <typename TValue>
20  {
21  public:
22  /// The value type.
23  typedef TValue value_type;
24 
25  /// The node type.
27 
28  /// The SVG tree type.
30 
31  ///
32  /// Executes the program through the specified streams.
33  ///
34  static void execute(
35  std::istream & in, ///< The input stream.
36  std::ostream & out) ///< The output stream.
37  {
38  node_type node (in);
39  svg_tree_type svg (node);
40 
41  svg.optimize_positions();
42  svg.write(out);
43  }
44  };
45 }
46 
47 #endif // JADE_NWK2SVG_HPP__
jade::basic_svg_tree::write
void write(std::ostream &out) const
Writes the SVG scene to the specified output stream.
Definition: jade.svg_tree.hpp:151
jade::basic_nwk2svg::execute
static void execute(std::istream &in, std::ostream &out)
Executes the program through the specified streams.
Definition: jade.nwk2svg.hpp:34
jade::basic_nwk2svg
A template for a class that converts Newick-formatted trees to SVG representations.
Definition: jade.nwk2svg.hpp:20
jade::basic_newick_node
A template class representing a node from a Newick tree.
Definition: jade.newick.hpp:19
jade::basic_nwk2svg::value_type
TValue value_type
The value type.
Definition: jade.nwk2svg.hpp:23
jade::basic_nwk2svg::svg_tree_type
jade::basic_svg_tree< value_type > svg_tree_type
The SVG tree type.
Definition: jade.nwk2svg.hpp:29
jade::basic_nwk2svg::node_type
jade::basic_newick_node< value_type > node_type
The node type.
Definition: jade.nwk2svg.hpp:26
jade::basic_svg_tree
A template for a class that renders newick trees as SVG.
Definition: jade.svg_tree.hpp:21
jade::basic_svg_tree::optimize_positions
void optimize_positions()
Optimizes the positions of the vertices using the Nelder-Mead Simplex method.
Definition: jade.svg_tree.hpp:49