TreeUtils: Utils to manipulate or visualise phylogenetic tree

Description Usage Arguments Details Examples

Description

The tree object here is ape tree.

Usage

1
2
3
4
annotateRAXMLTree(tree, taxa.map, anno.tree.file = "annotated-tree.nex",
  no.match = "unknown")

renameTips(tree, pattern, replacement, ...)

Arguments

tree

The ape tree object required.

taxa.map

The data.frame to map tree tips to traits. It must have at least 2 columns, where the 1st column is tree tip label.

For example,

tip.label trait1 trait2 ...
tip1 x a ...
tip2 x b ...
... y a ...
anno.tree.file

The file path to load a tree that can be imported into FigTree including annotations. If NA, as default, to overwrite the tree.file.

pattern, replacement, ...

Arguments of gsub.

tree.file

The file path to load a tree generated by RAxML.

Details

annotateRAXMLTree annotates a RAxML tree to visualise in FigTree.

renameTips renames tree tips. It also can be used to insert annotations using regular expression.

Examples

1
2
3
4
5
6
7
8
tree <- read.tree("RAxML_bestTree.16s.txt")
tree1 <- renameTips(tree, taxa.map, "16s_RAxML.nex")

# remove "_Viridiplantae" postfix from tips
tree2 <- renameTips(tree, "_Viridiplantae", "")

# AB1_Soil.123_Metazoa:0.016 => AB1_Soil.123_Metazoa[&taxon=Metazoa]:0.016
tree2 <- renameTips(tree, "([a-zA-Z0-9\\_\\.]+)_([[a-zA-Z]+):", "\\1_\\2[\\&taxon=\\2]:")

walterxie/ComMA documentation built on May 3, 2019, 11:51 p.m.