Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
Parsing an Extended Newick string

Extended Newick format expands beyond the traditional Newick notation by accommodating explicit phylogenetic networks. This extension enables the encoding of complex relationships that go beyond the simple hierarchical structure of phylogenetic trees.

In phylogenetic networks, nodes can signify either divergence events (cladogenesis) or reticulation events, such as hybridization, introgression, horizontal gene transfer, or recombination.

To represent reticulation events, the nodes are duplicated and annotated by appending the # symbol within the Newick format. These duplicated nodes are sequentially numbered, starting from 1, to maintain clarity and organization within the representation.

Input

1#include "quetzal/quetzal.hpp"
2#include <cassert>
3
4// Define a namespace alias to shorten notation
6
7int main()
8{
9 // std::string s1 = "((1, ((2, (3, (4)Y#H1)g)e, (((Y#H1, 5)h, 6)f)X#H2)c)a, ((X#H2, 7)d, 8)b)r;";
10 // std::string s2 = "((,((,(,()#H1)),(((#H1,),))#H2)),((#H2,),));";
11
12 // // For default graph properties, leave <> empty
13 // auto [network1, root1] = newick::extended::to_network<>(s1);
14 // auto [network2, root2] = newick::extended::to_network<>(s2);
15
16 // std::cout << "These graphs are "
17 // << (network1.is_isomorphic(network2) ? "toootally" : "not")
18 // << " isomorphic!" << std::endl;
19
20 // return 0;
21}
Generic components for parsing or generating Newick strings.
Definition io.hpp:28

Output