rename.tree: Tree Node Renaming

Description Usage Arguments Value Author(s) Examples

View source: R/trees.R

Description

Rename nodes of trees

Usage

1
rename.tree(tree, old.names, new.names)

Arguments

tree

A vector of character strings, each containing a newick tree

old.names

A vector of current names to be substituted

new.names

A vector of equal length to old.names giving the substitutions

Value

A vector of character strings, in which all nodes with names given in old.names are replaced with values from new.names

Author(s)

Melissa J. Hubisz and Adam Siepel

Examples

1
2
3
4
5
6
trees <- c("((hg18:1.0, panTro2:2.0):3.0, mm9:4.0);",
           "((hg18:0.142679,(mm9:0.083220,rn4:0.090564):0.269385):
                0.020666,canFam2:0.193569);")
rename.tree(trees,
            old.names=c("hg18", "panTro2", "mm9", "rn4", "canFam2"),
            new.names=c("human", "chimp", "mouse", "rat", "dog"))

Example output

[1] "((human:1,chimp:2):3,mouse:4);"                                                 
[2] "((human:0.142679,(mouse:0.08322,rat:0.090564):0.269385):0.020666,dog:0.193569);"

rphast documentation built on May 1, 2019, 9:26 p.m.