Learn R Programming

rbiom (version 1.0.3)

read.tree: Read a newick formatted phylogenetic tree.

Description

A phylogenetic tree is required for computing UniFrac distance matrices. You can load a tree either from a file or by providing the tree string directly. This tree must be in Newick format, also known as parenthetic format and New Hampshire format.

Usage

read.tree(src)

Value

A phylo class object representing the tree.

Arguments

src

Input data as either a file path, URL, or Newick string. URLs must begin with http://, https://, ftp://, or ftps://. Newick strings must have ( as their first non-whitespace character. Compressed (gzip or bzip2) Newick files are also supported.

Examples

Run this code
    library(rbiom)
    
    infile <- system.file("extdata", "newick.tre", package = "rbiom")
    tree <- read.tree(infile)
    
    tree <- read.tree("
        (t9:0.99,((t5:0.87,t2:0.89):0.51,(((t10:0.16,(t7:0.83,t4:0.96)
        :0.94):0.69,(t6:0.92,(t3:0.62,t1:0.85):0.54):0.23):0.74,t8:0.1
        2):0.43):0.67);")

Run the code above in your browser using DataLab