Learn R Programming

rphast (version 1.6.9)

rename.tree: Tree Node Renaming

Description

Rename nodes of trees

Usage

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

Examples

Run this code
# NOT RUN {
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"))
# }

Run the code above in your browser using DataLab