readTree: Read a Newick tree

Description Usage Arguments Details See Also Examples

View source: R/read-write-methods.R

Description

Return a TreeMan or TreeMen object from a Newick treefile

Usage

1
2
3
4
5
6
7
8
readTree(
  file = NULL,
  text = NULL,
  spcl_slt_nm = "Unknown",
  wndmtrx = FALSE,
  parallel = FALSE,
  progress = "none"
)

Arguments

file

file path

text

Newick character string

spcl_slt_nm

name of special slot for internal node labels, default 'Unknown'.

wndmtrx

T/F add node matrix? Default FALSE.

parallel

logical, make parallel?

progress

name of the progress bar to use, see create_progress_bar

Details

Read a single or multiple trees from a file, or a text string. Parallelizable when reading multiple trees. The function will add any internal node labels in the Newick tree as a user-defined data slots. The name of this slot is defined with the spcl_slt_nm. These data can be accessed/manipulated with the `getNdsSlt()` function. Trees are always read as rooted. (Unrooted trees have polytomous root nodes.)

See Also

https://en.wikipedia.org/wiki/Newick_format, addNdmtrx, writeTree, randTree, readTrmn, writeTrmn, saveTreeMan, loadTreeMan

Examples

1
2
3
4
5
6
library(treeman)
# tree string with internal node labels as bootstrap results
tree <- readTree(text="((A:1.0,B:1.0)0.9:1.0,(C:1.0,D:1.0)0.8:1.0)0.7:1.0;",
spcl_slt_nm='bootstrap')
# retrieve bootstrap values by node
tree['bootstrap']

Example output

    A     B    n3     C     D    n6    n7 
   NA    NA "0.9"    NA    NA "0.8" "0.7" 

treeman documentation built on July 8, 2020, 7:28 p.m.