subtreeBAMM {BAMMtools}R Documentation

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)

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)

[Package BAMMtools version 2.1.11 Index]