amp_alphadiv: Alpha-diversity analysis

View source: R/amp_alphadiv.R

amp_alphadivR Documentation

Alpha-diversity analysis

Description

Calculate alpha-diversity indices for each sample and combines with the metadata.

Usage

amp_alphadiv(data, measure = NULL, richness = FALSE, rarefy = NULL)

amp_alpha_diversity(data, measure = NULL, richness = FALSE, rarefy = NULL)

Arguments

data

(required) Data list as loaded with amp_load.

measure

Alpha-diversity measure(s) to be included if not all. A vector of one or more of:

  • "observed"

  • "shannon"

  • "simpson"

  • "invsimpson"

richness

(logical) Also calculate sample richness estimates (Chao1 and ACE) as calculated by estimateR. (default: FALSE)

rarefy

Rarefy species richness to this value before calculating alpha diversity and/or richness. Passed directly as the sample argument to rrarefy. (default: NULL)

Details

The alpha-diversity indices are calculated per sample using the vegan function diversity, where the read abundances are first rarefied using rrarefy by the size of the rarefy argument. Refer to the vegan documentation for details about the different indices and how they are calculated. If no measure(s) are chosen, all diversity indices will be returned.

Value

A data frame.

Author(s)

Kasper Skytte Andersen ksa@bio.aau.dk

Mads Albertsen MadsAlbertsen85@gmail.com

References

McMurdie, P.J. & Holmes, S. (2014). Waste not, want not: Why rarefying microbiome data is inadmissible. PLoS Comput Biol 10(4): e1003531. DOI:10.1371/journal.pcbi.1003531

See Also

amp_load

Examples

# Load example data
data("AalborgWWTPs")

# Subsample/rarefy to 20000 reads and then calculate
# Shannon and Simpson alpha-diversity indices
alphadiversityresult <- amp_alphadiv(AalborgWWTPs,
  measure = c("shannon", "simpson"),
  rarefy = 20000
)

# Explore the results in the data frame
# View(alphadiversityresult)

MadsAlbertsen/ampvis2 documentation built on Jan. 28, 2024, 7:12 a.m.