getMRCAs: Identify the node that subtends each named clade

View source: R/getMRCAs.R

getMRCAsR Documentation

Identify the node that subtends each named clade

Description

Given a phylogeny and a data frame of species and named clades, identify the nodes that subtend those named clades.

Usage

getMRCAs(tree, clade.membership)

Arguments

tree

An ape-style phylogenetic tree

clade.membership

An optional data frame with first column = "species", second column = "clade". These are named, monophyletic clades to which the species in the input phylogeny can belong. Not every species in the input phylogeny needs to be in the clade membership data frame, but missing species added to species not in this frame will not be included in the output clade membership data frame. They will of course still be included in the output phylogenies.

Details

Given a phylogeny and a data frame of species and named clades, identify the nodes that subtend those named clades. If a clade is composed of a single species it will return the tip number of the clade

Value

A list of named elements. Each element is a single number (a node). Names correspond to the name of the clade.

References

Mast et al. 2015. Paraphyly changes understanding of timing and tempo of diversification in subtribe Hakeinae (Proteaceae), a giant Australian plant radiation. American Journal of Botany.

Examples

#load a molecular tree up
data(bird.families)

#create a data frame of all taxa from the phylogeny, and make up clade memberships
#for each. note that the names on this data frame differ from "groupings" in other
#functions
dummy.frame <- data.frame(species=bird.families$tip.label, 
clade=c(rep("nonPasserine", 95), rep("suboscine", 9), rep("basalOscine", 13), 
rep("oscine", 20)))

#use the function
getMRCAs(bird.families, dummy.frame)

eliotmiller/addTaxa documentation built on Feb. 3, 2024, 12:19 a.m.