Help - Rerooting
TreeGraph 2 allows you to reroot your tree at any position. Rooting in this case means defining the node which is located at the leftmost position of the tree and is parent to all other nodes in the document (no matter if the root node is displayed or not).
There are two ways of rerooting a tree. The first is selecting a branch which defines the position of the new root and clicking on "Root here" in the edit menu or the context menu. The second way is selecting a set of terminal nodes (leaves) and clicking "Root by leaves" in the edit or the context menu (see below for details on that variant.). Alternatively you can use the keyboard shortcut Ctrl + R for both ways (depending on the current selection). (Note that the second alternative was not available before version 2.0.52.)
Contents
Rooted and unrooted trees
To avoid confusion we will first have a look at what it means to have a document with an unrooted tree (e.g. from a Nexus file with the [&U]
option). In that case a root node is used internally anyway but is displayed without a branch which would define the rooting point. Whether the root branch is displayed or not influences the topology of the represented tree but (for technical reasons) not the internal representation in the TreeGraph 2 data structure. Because of that the displaying of the root branch is a document format. The following examples illustrate this further.
Displayed unrooted
All examples shown here represent the same tree topology but differ in the internal representation in TreeGraph 2. (The network representation in the left shows the topology more clearly.)
= | = | = | = |
Displayed rooted
All trees shown below can be created from the corresponding tree representation in the unrooted example above by changing the document formats to display the root branch although they do all represent different tree topologies.
= | ≠ | = | ≠ | = | ≠ | = |
Using the reroot function
You can use the reroot function no matter if the root branch is displayed or not. To do so select a branch and click "Root here" in the edit menu or the context menu. A new root node will be inserted in the middle of this branch and the two nodes currently connected by it will become the child nodes of the new root (see examples below).
Rerooting in priciple
The tree in the following examples is rerooted at the branch B4 (blue). Deleted elements are shown in red and newly inserted elements in green. As you can see after the rerooting B4 is leading to the same node as is did before the operation but is now also connected to the newly inserted root node (which would not displayed as a real node if you chose the unrooted representation). Additionally a second branch was inserted which is leading to the second subtree under the root which was previously connected to the other side of B4. You could consider it in the way that the old B4 was split into the new B4 and the additional branch by the insertion of the new root.
The former root as well as its afferent branch and one of its subbranches (not necessarily the upper one) are deleted in the following examples where we assume that there is no node/branch data attached to any of the nodes and branches in the tree. Which elements are deleted and what happens to their node/branch data is described further below.
Rooted representation
→ |
Unrooted representation
If you use the unrooted representation B4 together with the inserted branch and the root node look as if they were one branch that connects the subtree of N7, N8 and N9 with the subtree of N3 and N5 .
→ |
Treatment of node/branch data near the former root
The following examples show what happens to the root node, its direct subbranches and their attached node/branch data in all possible cases. The text labels shown in the examples are exemplary for all node/branch data-lines as well as icon labels.
Upper subbranch is labeled
→ |
The label Top has moved to another branch. If the tree would be displayed unrooted its position would be topologically identical.
Lower subbranch is labeled
→ |
Both subbranches are labeled
→ |
The label Top has moved to another branch. If the tree would be displayed unrooted its position would be topologically identical. B3 contains two labels with the same ID now.
Rerooting by leaf nodes
Instead of selecting the branch that shall become the new root directly, TreeGraph also offers the alternative to select a set of terminal nodes (leaves). The new root will be localted along the branch that leads to the root of the subtree containing the least number of terminals, but including all selected leaves (similar to the most recent common ancester). Rerooting on that branch is than done in the same way as described above. This feature can e.g. be used to reroot the tree by selecting all taxa in it that belong to a outgroup of a phylogenetic tree reconstruction.
Note that the this function was not available before version 2.0.52.
Example with alternatives
In the following example whe select the taxa Out1 and Out2 to define the new root.
In this special example there are two ways of rerooting this tree so that Out1 and Out2 are in a subtree under the root containg the minimal number of taxa. The first alternative is shown below. In that case TreeGraph will display a message telling you about the alternative(s) and select the alternative branches after the operation.
The following tree is the result of the alternative rerooting operation. (Note that it is undefined which alternative is chosen by TreeGraph and this behaviour might differ every time you use this function.)