writeTree: Write a Newick tree

Description Usage Arguments Details See Also Examples

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

Description

Creates a Newick tree from a TreeMan object.

Usage

1
2
3
4
5
6
7
8
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

1
2
3
4
5
6
7
8
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')

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