The function is to calculate alpha diversity estimates.

NOTE: You must use untrimmed datasets for meaningful results, as these estimates (and even the "observed" richness) are highly dependent on the number of singletons. You can always trim the data later on if needed, just not before using this function.

get_alphaindex(
    ps,
    level = c(NULL, "Kingdom", "Phylum", "Class",
           "Order", "Family", "Genus",
           "Species", "Strain", "unique"),
    indices = c("all",
      "Observed", "Chao1", "ACE", "Shannon",
      "Simpson", "InvSimpson", "Fisher",
      "Evenness", "TaxaNumber"),
    mindepth = NULL,
    force = FALSE
   )

Arguments

ps

(Required). a phyloseq::phyloseq object.

level

(Optional). character. taxonomic level to summarize, default the top level rank of the ps. taxonomic level(Kingdom, Phylum, Class, Order, Family, Genus, Species, Strains; default: NULL).

indices

(Optional). character, meaning that all available alpha-diversity indices will be included. Alternatively, you can specify one or more indices as a character vector of measure names (default: all). Values must be among those supported: c("Observed", "Chao1", "ACE", "Shannon", "Simpson", "InvSimpson", "Fisher", "Evenness", "TaxaNumber"). "Chao1", "ACE" and "Fisher" only supported by counts matrix (integers).

mindepth

(Optional). numeric, Subsample size for rarefying community (default: all).

force

(Optional). logical, whether to rarefy samples (default: FASLE).

Value

A data.frame of alpha index with metadata.

References

https://scienceparkstudygroup.github.io/microbiome-lesson/04-alpha-diversity/index.html

Author

Created by Hua Zou (12/02/2022 Shenzhen China)

Examples


if (FALSE) {

# relative abundance
data("enterotypes_arumugam")
get_alphaindex(
  ps = enterotypes_arumugam,
  level = "Genus",
  indices = c("Shannon", "Observed"))

# absolute abundance
data("caporaso")
get_alphaindex(
  ps = caporaso,
  level = "Genus",
  indices = c("Shannon", "Chao1"))
}