Learn R Programming

treeman (version 1.1.4)

writeTree: Write a Newick tree

Description

Creates a Newick tree from a TreeMan object.

Usage

writeTree(
  tree,
  file,
  append = FALSE,
  ndLabels = function(nd) {     return(NULL) },
  parallel = FALSE,
  progress = "none"
)

Arguments

tree

TreeMan object

file

file path

append

T/F append tree to already existing file

ndLabels

node label function

parallel

logical, make parallel?

progress

name of the progress bar to use, see create_progress_bar

Details

The ndLabels argument can be used to add a user defined node label in the Newick tree. It should take only 1 argument, nd, the node represented as a list. It should only return a single character value that can be added to a newick string.

See Also

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

Examples

Run this code
# NOT RUN {
library(treeman)
tree <- randTree(10)
# write out the tree with node labels as IDs
ndLabels <- function(n) {
n[['id']]
}
writeTree(tree, file='example.tre', ndLabels=ndLabels)
file.remove('example.tre')
# }

Run the code above in your browser using DataLab