Diversity_16S: Diversity function for 16S amplicon data

Description Usage Arguments Examples

View source: R/Diversity_16S.R

Description

This function calculates Hill diversity metrics from 16S amplicon data (in phyloseq format). D0 (richness) is calculated with three methods: 1) Observed richness, 2) Chao1 estimator 3) breakaway method (Willis and Bunge 2016). D1 (exponential of Shannon entropy) and D2 (inverse Simpson index) are respectively Hill order 1 and 2. Errors for D1 and D2 are calculated by bootstrapping.

Usage

1
2
3
4
5
6
7
8
Diversity_16S(
  x,
  R = 999,
  brea = TRUE,
  thresh = 200,
  parallel = FALSE,
  ncores = 2
)

Arguments

x

phyloseq object generated by the phyloseq package

R

Number of bootstraps to conduct. Defaults to 999

brea

TRUE/FALSE if breakaway method for D0 estimation should be used. Defaults to TRUE. This method fails easily if you don't have atleast 6 contiguous frequencies.

thresh

Minimum sample size required to perform Chao1 estimation.

parallel

Should the calculation be parallelized? Defaults to FALSE

ncores

How many cores should be used in case of parallel computation? Defaults to 2.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# First install phyloseq if you haven't yet
if(requireNamespace("phyloseq",quietly=TRUE)){
library(phyloseq)
} else {
source("https://bioconductor.org/biocLite.R")
biocLite("phyloseq")
library(phyloseq)
}
# Load data (V3-V4 amplicon data from doi: 10.1111/2041-210X.12607)
data(physeq_test)
# Opting for three bootstraps, because this can take some time.
Diversity_16S(phyloseq::prune_samples(phyloseq::sample_names(physeq_test) == "1", physeq_test), R=3)

rprops/Phenoflow_package documentation built on Sept. 22, 2020, 5:43 p.m.