MyNixOS website logo
Description

Comparison of Trees using a Tree Defining Polynomial.

Provides functionality for creation and comparison of polynomials that uniquely describe trees as introduced in Liu (2019, <arXiv:1904.03332>). The core method converts rooted unlabeled phylo objects from 'ape' to the tree defining polynomials described with coefficient matrices. Additionally, a conversion for rooted binary trees with binary trait labels is also provided. Once the polynomials of trees are calculated there are functions to calculate distances, distance matrices and plot different distance trees from a target tree. Manipulation and conversion to the tree defining polynomials is implemented in C++ with 'Rcpp' and 'RcppArmadillo'. Furthermore, parallel programming with 'RcppThread' is used to improve performance converting to polynomials and calculating distances.

treenomial

CRANstatus

Overview

The package treenomial is an application of polynomials that uniquely describe trees. It provides tools for tree analysis and comparison based on polynomials. The core functions are:

  • treeToPoly(): convert rooted unlabeled binary trees to tree distinguishing polynomials described with coefficient matrices

  • polyToDistMat(): construct a distance matrix from multiple coefficient matrices using a distance measure

For the mathematical description of the tree defining polynomial see:

Liu, Pengyu. “A tree distinguishing polynomial.” arXiv preprint arXiv:1904.03332 (2019).

Installation

To install using CRAN:

install.packages("treenomial")

For the development version:

library(devtools)
install_github("mattgou1d/treenomial")

Example tree and polynomial

Consider a three tip tree:

library(ape)
library(treenomial)

threeTipTree <- rtree(3, rooted = T)
plot.phylo(threeTipTree, use.edge.length = F, show.tip.label = F, direction = "downwards")

It’s polynomial is x^3+xy+y which can equivalently be described with a coefficient matrix where the element in the ith row, jth column represents the y^(i-1) * x^(j-1) coefficient:

treeToPoly(threeTipTree, varLabels = T)
#>     x^0 x^1 x^2 x^3
#> y^0   0   0   0   1
#> y^1   1   1   0   0
#> y^2   0   0   0   0

Using the coefficients of the polynomials, distances between trees can be compared, below the two closest trees to a random target tree are found from a random sample:

# random 12 tip target tree 
target <- rtree(12)

# random sample of 100 trees
sample <- rmtree(100,12)

minInfo <- plotExtremeTrees(target,sample, n = 2, comparison = "min", type = "d")

Metadata

Version

1.1.4

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows