Given a set of tips or a node, this function extracts the
corresponding subtree from the bammdata object. User should
specify either a set of tips or a node, and the node will overwrite
the tips if both are given.
Usage
subtreeBAMM(ephy, tips = NULL, node = NULL)
Arguments
ephy
An object of class bammdata.
tips
An integer or character vector indicating which tips (more
than one) to be included in the subtree.
node
An integer indicating the root of the subtree to be extracted,
and it must correspond to an innernode on the tree.
Details
This function allows users to extract a subtree from a big
bammdata object, and examine the subset using
plot.bammdata
Value
An object of class bammdata.
Author(s)
Huateng Huang
See Also
getmrca, plot.bammdata
Examples
data(whales, events.whales)
ephy <- getEventData(whales, events.whales, burnin=0.25, nsamples=500)
# specify a set of tips for the subtree
tips <- sample(ephy$tip.label,size=20,replace=FALSE)
subphy <- subtreeBAMM(ephy,tips=tips)
# specify a innernode for subsetting
subphy <- subtreeBAMM(ephy,node=103)
# plot the subtree
plot(subphy)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(BAMMtools)
Loading required package: ape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BAMMtools/subtreeBAMM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: subtreeBAMM
> ### Title: Pulls out a subtree from 'bammdata' object
> ### Aliases: subtreeBAMM
> ### Keywords: graphics
>
> ### ** Examples
>
> data(whales, events.whales)
> ephy <- getEventData(whales, events.whales, burnin=0.25, nsamples=500)
Processing event data from data.frame
Discarded as burnin: GENERATIONS < 2495000
Analyzing 500 samples from posterior
Setting recursive sequence on tree...
Done with recursive sequence
>
> # specify a set of tips for the subtree
> tips <- sample(ephy$tip.label,size=20,replace=FALSE)
> subphy <- subtreeBAMM(ephy,tips=tips)
>
> # specify a innernode for subsetting
> subphy <- subtreeBAMM(ephy,node=103)
>
> # plot the subtree
> plot(subphy)
>
>
>
>
>
> dev.off()
null device
1
>