get_alphaindex: Calculating index of Alpha diversity on microbiota data

View source: R/gv_diversity.R

get_alphaindexR Documentation

Calculating index of Alpha diversity on microbiota data

Description

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.

Usage

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.

Author(s)

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

References

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

Examples


## Not run: 

# 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"))

## End(Not run)



HuaZou/MicrobiomeAnalysis documentation built on Dec. 12, 2023, 10:37 a.m.