rescale.tree: Scale a Tree or Subtree

Description Usage Arguments Value Author(s) Examples

View source: R/trees.R

Description

Rescale a tree

Usage

1
rescale.tree(tree, scale, subtree = NULL, include.leading = FALSE)

Arguments

tree

A vector of character strings, each containing a newick tree

scale

A vector of scale factors for each tree (will be recycled as necessary if shorter than trees)

subtree

If not NULL, scaling will be on subtree defined by the named node. Subtrees will be recycled as necessary if shorter than trees.

include.leading

(Only applicable when subtree used) If TRUE, include the branch leading to the named node in the subtree.

Value

A vector of trees whose branches have been scaled

Author(s)

Melissa J. Hubisz and Adam Siepel

Examples

1
2
3
4
5
6
7
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);")
rescale.tree(trees, 0.5)
rescale.tree(trees, c(0.5, 2.0))
trees <- name.ancestors(trees)
rescale.tree(trees, 0.5, c("hg18-panTro2", "hg18-mm9"))

Example output

[1] "((hg18:0.5,panTro2:1):1.5,mm9:2);"                                                 
[2] "((hg18:0.0713395,(mm9:0.04161,rn4:0.045282):0.134692):0.010333,canFam2:0.0967845);"
[1] "((hg18:0.5,panTro2:1):1.5,mm9:2);"                                              
[2] "((hg18:0.285358,(mm9:0.16644,rn4:0.181128):0.53877):0.041332,canFam2:0.387138);"
[1] "((hg18:0.5,panTro2:1)hg18-panTro2:3,mm9:4);"                                                     
[2] "((hg18:0.0713395,(mm9:0.04161,rn4:0.045282)mm9-rn4:0.134692)hg18-mm9:0.020666,canFam2:0.193569);"

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