Learn R Programming

Claddis (version 0.7.0)

find_unique_trees: Finds only the unique topologies amongst a set

Description

Given a set of trees with the same tip labels, returns just the unique topologies present.

Usage

find_unique_trees(trees)

Value

An object of class "multiPhylo".

Arguments

trees

An object of class multiPhylo.

Author

Graeme T. Lloyd graemetlloyd@gmail.com

Details

Where labelled topologies are generated randomly or modified by (e.g.) removing a tip, it may be useful to isolate just those that are truly unique. The ape package already has a function for this (unique.multiPhylo), but it can be slow when the number of trees is large. This function is thus intended as a faster version.

The function works by breaking down a tree into its' component bipartitions and treating the combination of these as the definition of the tree. It thus escapes problems due to the principle of free rotation. Specifically, these two trees are actually identical:

A  B  C   D  E
 \/    \   \/
  \     \  /
   \     \/
    \    /
     \  /
      \/

B A D E C \/ \/ / \ \ / \ \/ \ / \ / \/

This becomes clearer if we decompose them into their bipartitions:

AB, DE, CDE, ABCDE

These correspond to the descendants of each internal node (branching point) and the last one is actually ignored (the root node) as it will be present in any tree.

See Also

unique.multiPhylo

Examples

Run this code

# Make a set of three identical trees (differing only in "rotation" of nodes):
trees <- ape::read.tree(text = c(
  "((A,B),(C,(D,E)));",
  "((C,(D,E)),(A,B));",
  "((B,A),(C,(E,D)));")
)

# Show that there is only one unique tree:
find_unique_trees(trees = trees)

Run the code above in your browser using DataLab