tips_from_node: tips_from_node

View source: R/tips_from_node.r

tips_from_nodeR Documentation

tips_from_node

Description

Determines which tip indices in a phylogeny descend from a given node. Called by make_nested_set(), not intended for use otherwise, but some may find it handy. Data should come from a rooted phylogeny, but this function doesn't check that so be careful.

Usage

tips_from_node(nodes, anc, des)

Arguments

nodes

integer vector or scalar. The node index or indices for which tip indices are desired.

anc

integer vector. "ancestor" column vector from an adjacency matrix. For an ape::phylo object phy, anc=phy$edge[,1].

des

integer vector. "descendant" column vector from an adjacency matrix. For an ape::phylo object phy, des=phy$edge[,2].

Value

integer vector of tip indices, in no particular order.

Author(s)

John L. Darcy

See Also

ape::phylo

Examples

# library(specificity)
# library(ape)
# phy <- get(data(endophyte))$supertree
# # check if tree is rooted:
# ape::is.rooted(phy)
# # which tips are in the Cucurbitales?
# plot(phy) # need to stretch out the plot to see...
# nodelabels(adj=c(0,-1), bg="yellow") # node numbers
# nodelabels(phy$node.label, adj=c(0,1), bg="lightblue") # node names
# # we can see that Cucurbitales is node 107  
# cuc_tips <- tips_from_node( nodes=107, anc=phy$edge[,1], des=phy$edge[,2] )
# cuc_tips
# phy$tip.label[cuc_tips]


darcyj/specificity documentation built on Aug. 1, 2023, 8 a.m.