Learn R Programming

otuSummary (version 0.1.1)

alphaDiversity: Calculate the alpha diversity indices

Description

This function will calculate the alpha diversity indices for the total, abundant and rare biospheres.

Usage

alphaDiversity(otutab, siteInCol = FALSE, taxhead = NULL, threshold = 1,
    percent = FALSE, write = FALSE, ...)

Value

The function will return a list of length 3, including indices of observed, shannon, simpson, invsimpson, chao1, chao2, evenness and Gini.

allBio

The alpha diversity indices for the whole community

abundBio

The alpha diversity indices for the abundant population

rareBio

The alpha diversity indices for the rare biosphere

Arguments

otutab

A OTU table of microbial community, which can contain a taxonomic column (if siteInCol) or row (if site in rows). The OTU table should be given in numeric (integer) counts.

siteInCol

Logical, if "TRUE", the OTU table contains samples in columns and taxa in rows. By default in this function, the siteInCol is FALSE, meaning the samples in rows.

taxhead

Character, specify the header of taxonomy if there is a taxonomic column in your data. By default this argument is NULL.

threshold

Numeric, the threshold of relative abundance upon which the rare biosphere will be subset.

percent

Logical, whether the input OTU table are given in relative abundance. FALSE means that the input OTU table is in numeric counts.

write

Logical, if TRUE, the result will be written out in a Tab separated data frame.

...

arguments to be passed to write.table().

Author

Sizhong Yang <yanglzu@163.com>

Details

The rare biosphere is defined by the relative abundance cutoffs (which is the "threshold" argument in this function) (Lynch and Neufeld, 2015). This function call the functions "specnumber", "diversity" and 'estimateR' from package 'vegan' (Oksanen et al, 2013), and the "gini" function from package 'reldist' (http://www.stat.ucla.edu/~handcock/RelDist). The function 'gini' from the package 'reldist' was extracted and this function can be correctly run without package dependency problem if you did not install this package. However, if you use the 'Gini' index result from this wrapped function, please cite the original package 'reldist'. In addition, please use the OTU table with integers to calculate alpha diversity.

References

Lynch MDJ, Neufeld JD (2015). Ecology and exploration of the rare biosphere. Nature Reviews Microbiology 13: 217-229.

Oksanen J, Blanchet FG, Kindt R, Legendre P, Minchin PR, O'Hara RB et al (2013). vegan: Community Ecology Package. R package version 2.0-7. http://CRAN.R-project.org/package=vegan.

Handcock MS (2016). Relative distribution methods. Version 1.6-6. Project home page at http: //www.stat.ucla.edu/~handcock/RelDist. URL https://CRAN.R-project.org/package=reldist.

Examples

Run this code
data(otumothur)

test1 <- alphaDiversity(otutab = otumothur, siteInCol = TRUE,
    taxhead = "taxonomy", threshold = 1, percent = FALSE, write = FALSE)

test2 <- alphaDiversity(otutab = otumothur[,-454], siteInCol = TRUE,
    taxhead = NULL, threshold = 1, percent = FALSE, write = FALSE)

Run the code above in your browser using DataLab