Thursday, July 5, 2012

phylo.endemism: an R function for calculating phylogenetic endemism of ecological samples


Here's a function I have written for the R statistical environment that calculates phylogenetic endemism of multiple samples. I am providing it for free and without warranty under the GNU General Public License. You need to be familiar with R to use this function. The function also requires that the ape package be installed. To load the function, place the file in your working folder and type ‘source(“phyloendemism.R”)’.

Latest version: 2nd December 2010.


Usage
phylo.endemism (x, phy, weighted = T)
Arguments
x is a community data table (as in the vegan package) with species/OTUs as columns and samples/sites as rows. Columns are labelled with the names of the species/OTUs. Rows are labelled with the names of the samples/sites. Data can be either abundance or incidence (0/1).
phy is a rooted phylogenetic tree with branch lengths stored as a phylo object (as in the ape package) with terminal nodes labelled with names matching those of the community data table. Note that the function trims away any terminal taxa not present in the community data table, so it is not necessary to do this beforehand.
weighted is a logical indicating whether weighted endemism (default) or strict endemism should be calculated.
Details
phylo.endemism takes a community data table and a rooted phylogenetic tree (with branch lengths) and calculates either strict or weighted endemism in Phylogenetic Diversity (PD). Strict endemism equates to the total amount of branch length found only in the sample/site and is described by Faith et al. (2004) as PD-endemism. Weighted endemism calculates the "spatial uniqueness" of each branch in the tree by taking the inverse of its range, multiplying by branch length and summing for all branch lengths present at a sample/site. Range is calculated simply as the total number of samples/sites at which the branch is present. This latter approach is described by Rosauer et al. (2009) as Phylogenetic endemism.
Value
phylo.endemism returns a vector object giving the phylogenetic endemism of all sample/sites in x.
References
Faith DP, Reid CAM & Hunter J. 2004. Integrating phylogenetic diversity, complementarity, and endemism for conservation assessment. Conservation Biology 18(1): 255-261.
Rosauer D, Laffan SW, Crisp MD, Donnellan SC & Cook LG. 2009. Phylogenetic endemism: a new approach for identifying geographical concentrations of evolutionary history. Molecular Ecology 18(19): 4061-4072

No comments:

Post a Comment