Learn R Programming

BAMMtools (version 2.1.12)

subtreeBAMM: Pulls out a subtree from bammdata object

Description

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)

Value

An object of class bammdata.

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.

Author

Huateng Huang

Details

This function allows users to extract a subtree from a big bammdata object, and examine the subset using plot.bammdata

See Also

getmrca, plot.bammdata

Examples

Run this code
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)

Run the code above in your browser using DataLab