alpha_div: Alpha Diversity Calculations for tidy_micro

Description Usage Arguments Details Value Note Examples

View source: R/alpha_div.R

Description

A wrapper function to calculate Sobs, Choa1, Goods, Shannon's diversity and evenness, and Simpson's diversity and evenness alpha diversities for your micro_set. Estimates are calculated based on rarefied bootstrapped samples

Usage

1
alpha_div(micro_set, table = NULL, iter = 100, min_depth = 0, min_goods = 0)

Arguments

micro_set

A tidy_micro data set

table

OTU table of interest

iter

The number of bootstrap resamples used for estimation

min_depth

Filter out libraries with sequencing depth (Total) below min_depth

min_goods

Filter out libraries Good's coverage below min_goods

Details

If you have multiple otu tables, you can specify the table you'd like to use to calculate your alpha diversities using the table option. We highly recommend using the lowest taxonomic rank available to calculate your alpha diversity. If you would like to calculate alpha diversities for each otu table in your micro_set, you can leave the table option as NULL and the function will calculate the alpha diversity for each table. The function will append the estimated alpha diversities to the tidy_micro supplied. The alpha diversity columns will be just before your clinical data. Since alpha diversity is estimated for each individual library (Lib), it will be repeated within each taxa block.

Value

A tidy_micro set with alpha diversity columns added in to the left of clinical data

Note

Be aware of your minimal sequencing depth as this will be the size of all bootstrapped resamples (rarefied).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(bpd_phy); data(bpd_cla); data(bpd_ord); data(bpd_fam); data(bpd_clin)
otu_tabs = list(Phylum = bpd_phy, Class = bpd_cla,
Order = bpd_ord, Family = bpd_fam)

set <- tidy_micro(otu_tabs = otu_tabs, clinical = bpd_clin) %>%
filter(day == 7) ## Only including the first week


## calculate alpha diversity for every table
set_alpha <- set %>% alpha_div(min_depth = 5000, min_goods = 90)

## calculate alpha diversity for a specific table
set_fam_alpha <- set %>% alpha_div(table = "Family", min_depth = 5000, min_goods = 90)

CharlieCarpenter/tidyMicro documentation built on April 25, 2021, 4:09 p.m.