Drawing explicit phylogenetic networks and their integration into SplitsTree

Background SplitsTree provides a framework for the calculation of phylogenetic trees and networks. It contains a wide variety of methods for the import/export, calculation and visualization of phylogenetic information. The software is developed in Java and implements a command line tool as well as a graphical user interface. Results In this article, we present solutions to two important problems in the field of phylogenetic networks. The first problem is the visualization of explicit phylogenetic networks. To solve this, we present a modified version of the equal angle algorithm that naturally integrates reticulations into the layout process and thus leads to an appealing visualization of these networks. The second problem is the availability of explicit phylogenetic network methods for the general user. To advance the usage of explicit phylogenetic networks by biologists further, we present an extension to the SplitsTree framework that integrates these networks. By addressing these two problems, SplitsTree is among the first programs that incorporates implicit and explicit network methods together with standard phylogenetic tree methods in a graphical user interface environment. Conclusion In this article, we presented an extension of SplitsTree 4 that incorporates explicit phylogenetic networks. The extension provides a set of core classes to handle explicit phylogenetic networks and a visualization of these networks.

The software currently available for the calculation and analysis of explicit phylogenetic networks consists of a spread of basic implementations of algorithms developed to solve the computational task [6,14,[16][17][18]20]. Most of the software is command line driven and an appealing visualization of the results is often lacking. It is essential to have a tool that allows both broad usage of the methods available to biologists, and better and further development of new methods.
SplitsTree is an application developed in our research group, originally aiming at the phylogenetic analysis of sets of splits. The newest version of SplitsTree [2] incorporates a variety of methods for the calculation, visualization and interpretation of phylogenetic trees and implicit phylogenetic networks. Two main advantages of Split-sTree are the graphical user interface (GUI) and the integration of algorithms via an interface driven class loader (plugins). In this article we present an extension to Split-sTree that enables the program to handle explicit phylogenetic networks. The extension solves two important problems: an efficient integration of explicit phylogenetic networks, and visualizing these networks.

Results and Discussion
A tree T = (V, E) is a connected acyclic graph with vertex set V and edge set E. A vertex of degree one is called a leaf of T and the set of all leaves is called the leaf set of T. A rooted For any edge e, we use α (e) and β(e) to denote the source and target of e. A rooted phylogenetic Xtree is a pair (T, ν), where T = (V, E, ·) is a rooted tree and ν : X → V is a bijection from X to the leaf set of T. See [21] for more details. 2. every vertex v ∈ V is either a tree vertex, v ∈ V T , that has exactly one ancestor, or a reticulation vertex r ∈ V R that has exactly two ancestors; 3. every edge is either a tree edge leading to a vertex of indegree one or a reticulation edge leading to a vertex of indegree two; and 4. the set of leaves L (vertices with no descendants) consists only of tree vertices and is labeled by the set of taxa X, i.e. ν maps X bijectively onto L.
It follows from these definitions that each reticulation vertex (or reticulation, for short) r ∈ V R is contained in one or more cycles of the form C = (r, p(r), w 1 , e 1 , ..., e k-1 , w k , q(r), r), with w i ∈ V and e i ∈ E\{p(r), q(r)} for all i. (Note that additionally, r can also be contained in one or more cycles that do not contain p(r) and q(r)). We say that two reticu-lations r, r' ∈ V R are dependent if a cycle that contains both r and r' exists.
In graph theory, a two-connected component of a graph G is any maximal subgraph G' with the property that any two vertices v and w of G' are connected by two paths p and p' that share no vertices except for v and w. For any reticulation vertex r, let p r and q r denote the two associated reticulation edges.
Furthermore, let and denote the two ancestors of r with respect to p r and q r . The lowest single ancestor lsa(r) of a reticulation r is the minimum of all nodes in V that is connected to r by two paths p and p' that share no vertices except for lsa(r) and r.

Algorithm
One important approach to drawing trees is the equal angle algorithm which was developed by Meacham (see [22]). The equal angle algorithm guarantees that no two edges intersect. Our algorithm for visualizing recombination networks is based on a generalization of the equal angle algorithm. The algorithms adds an ordering step at each vertex, that chooses an optimal ordering of the descending edges, that minimizes the number of crossings between reticulations edges and other edges. It can easily be altered to be used with any drawing algorithm for trees. We will start out with a description of the equal angle algorithm and will then define some basic properties. Finally, we will give solutions to minimize crossing edges in a drawing of a reticulate networks, and the optimal placement of reticulation vertices.
The equal angle algorithm is a recursive algorithm that starts at an internal vertex of a tree. For each subtree connected to the starting vertex, we appoint an angle proportional to the share of leaves it contains. In the next step, we assign to each subtree a sector of the circle of the size of the angle appointed to it and draw the edge to the subtree in the middle of the sector. We place the sector of the subtree in a way that it is centered at the end of the branch and the branch is pointing at the bisector of the angle. We then recurse to the starting vertex of the subtree and assign each newly discovered subtree its proportional share of the angle. Each subtree is than placed in the sector of the starting vertex. The recursion is repeated until we have appointed angles to each branch of the tree. The only modifications for rooted trees are the explicit start point (the root of the tree) and the use of a fraction of the cycle. For a detailed description of the algorithm, see [22].
The rooted equal angle algorithm is not directly applicable to a reticulate network since for each reticulation, we have to decide which of the reticulation edges we want to v p r v q r use for the drawing algorithm and either choice may be suboptimal. The idea behind our approach is to use neither of them. The influence of a reticulation upon the graph structure is bounded by the reticulation and its lowest single ancestor, therefore we decided to define an auxiliary edge between those two vertices and to use the auxiliary edges for the layout of the graph. When the algorithm reaches a node each descending edge is checked for its status (being either a tree-edge, an auxiliary-edge or a reticulation-edge) and only tree-and auxiliary-edges are incorporated into the process.
Through these modifications to the rooted equal angle algorithm, it is possible to visualize reticulate networks, but these visualizations are not very satisfying. To obtain an improved method, we will address two key problems. The first problem is the crossing of reticulation edges: even though it can not always be avoided, the number of such events should be minimized. The second problem is that the auxiliary edges are artifical edges and their optimal edge length must be determined. In the following, we will show solutions to these two problems.

Minimizing crossing edges
An edge crossing another one is an undesirable event in drawing a graph. It is well known that solving this problem is, in general, computationally hard [23]. The equal angle algorithm ensures that we only have to deal with reticulation edges crossing other edges. Furthermore, the construction of the auxiliary edges implies that edges that can be crossed by the reticulation edges are descendent edges of the lowest single ancestor of the reticulation. The optimization starts at the root of the networks and optimizes the arrangement of the directly descending vertices. It then continues the optimization iteratively at each directly descending vertex in the order given and keeps going until it has optimized all placements.
Let be the set of tree vertices directly below a vertex v and let be the set of reticulation vertices connected to v by auxiliary edges. We say that a tree path The optimal linear arrangement problem is known to be hard [24]. Nevertheless, this arrangement problem is in general much smaller than the complexity of minimizing all crossing edges at once. Interestingly, a couple of additional restrictions exist that we may apply to the ordering, leading to a "greedy" solution that works well in most cases. One restriction that we can place upon the structure is that for any reticulation r, the position in the ordering should be between and . Consequently, we should place and before we place r.
Another restriction we can place is a consequence from the dependency of the reticulations upon each other. For , The optimization algorithm iterates through the ordering and at each reticulation r it first places and , if necessary, and then r. If all reticulation are placed, the algorithm places all descending tree edges that have not yet been placed. At each placement, the algorithm positions the vertex at the position that minimizes the score given in Problem 1. After all nodes have been placed in the linear arrangement, the result is returned to the main method. An Example of the optimization procedure can be seen in Figure 1.

Optimal placement for reticulation vertices
Having calculated the angle and optimal arrangement for each edge, we have to place the vertices. Tree vertices can be placed in the same way as in the standard equal angle algorithm. But since auxiliary edges do not come with a given length, we have to calculate an optimal placement for each of the reticulation vertices. Such a placement has to incorporate the conditions of the equal angle algorithm, otherwise we might face unnecessary crossings between edges. Note that there are two cases for which we have to consider different placement methods. In the first case, we have a reticulation r where the nodes and are both different from lsa(r), and in the second case, one of them is equal to lsa(r).
In both cases, we place the reticulation vertex r on the bisector of the sector assigned to its auxiliary edge. In the first case, the distance between r and lsa(r) should be larger than the minimum distance between lsa(r) and the line l(v p , v q ), indicating that r is a descendant of v p and v q .
In other words, we assume the angles v q v p r and v p v q r are positive. In the second case, we assume that v q is equal to lsa(r). We first calculate the point on the bisector r t that has the same distance to lsa(r) as v p and than ensure that the angle between r t v p r is positive. We added an option to the algorithm so that the user can specify the (maximum) value of this angle; the standard value is 15°. An example of the drawing algorithm can be seen in Figure 2.

Implementation
We started to integrate explicit phylogenetic networks into SplitsTree in our RECOMB 2005 article [6]. Originally, such methods were squeezed into the existing data structures within SplitsTree. SplitsTree itself is built around a group of core classes, each one representing a different type of information. The standard file format of SplitsTree Example of the layout optimization The set of easily reachable edges R v of the node v contains the reticulations r1, r2, r3, r4 and r*. The set only contains r* and is equal to . The placement of r* has cost 1 since the reticulation edges only cross the edge that leads to leaf g. The placement of r4 has cost 2, since the reticulation edges to the right crosses r1 and r3.
is the Nexus [25] file format and each core class has its own Nexus representation. Consequently, developing a Nexus representation of explicit phylogenetic networks is essential for the integration of these into SplitsTree.
To build a Nexus representation for an explicit phylogenetic network, one needs to find an efficient way to present it as a string. We decided to use a version of the extended Newick (eNewick) [26] format. In general, the eNewick format allows labels to be present up to two times within the network. A label is allowed to appear once as a leaf and once as an internal label. Whenever a label occurs twice, the leaf is identified with the internal vertex, thus providing a network with vertices of indegree two. A lot of research has lately been focused on proving some interesting decomposition theorems [6,16,20] for explicit phylogenetic networks. The general motivation of these theorems is that the calculation of a reticulate network, with a minimal number of reticulation events, from some given information is hard [27]. The idea is to decompose each network into its two-connected components and to calculate the minimal solutions of each twoconnected component separately.
Following the idea of decomposing explicit phylogenetic networks, each two-connected component may have several solutions and the possible combinations of these solutions grows exponentially, which is a problem if the number of two-connected components is large. Consequently, we decided that the Nexus representation of the network needs to reflect the two-connected components within it.
Note that any reticulate network contains either a twoconnected component or a tree like element, that contains the root. We call this particular element the root component. The two-connected components are called netted components, and for each netted component, a number of solutions may exist. Any connected component that is not a two-connected component is a tree component. Each tree component may appear more than once within the possible configurations. The possible combinations of these three basics elements is left to the user.
We now describe a Nexus notation for explicit phylogenetic networks, the schematic of this notation is shown in Figure 3. In general, one needs to save the components Example of the drawing algorithm Figure 2 Example of the drawing algorithm. The figure shows the drawing of a reticulation network that we recently published [20] which is based on three gene trees described in [28]. The NettedComponents section contains a list of all twoconnected components. Each one must be identified by a unique name and there must be at least one string representation given for each. Any such string must either be formated in eNewick, or in Newick format where any two leaves with the same label are labeled with the name of a tree component.
Finally, the TreeComponents section contains a list of uniquely named strings in Newick format, where leaves can be labeled with the name of netted components.

Conclusion
In this article we presented a new algorithm for the visualization of explicit phylogenetic networks. The algorithm is a generalization of the well known equal angle algorithm and can be used to adapt most known phylogenetic tree drawing algorithm to the task of drawing reticulate networks. Moreover, we have described a datastructure and file format for representing reticulate networks in a way that reflects the structural properties of the networks.
Our implementation of these results in the popular Split-sTree software will make them accessible to biologists and other researchers that are interested in using such networks. The extensions to SplitsTree 4 are freely available for users of the application. SplitsTree 4 can be downloaded from the projects home page. Using the application is free. Figure 3 Reticulate Nexus Block Schematic. Shown is a schematic of the Reticulate nexus block as it is implemented in SplitsTree. The block is divided into three parts: the Dimensions contains all information about the dimensions of the reticulate network; the Format is an optional element that describes the configuration of the reticulate network; and the TreeComponents, NettedComponents and RootComponents contain the string representation of the reticulate network.