BD_shift: Assessing the magnitude of BD shifts with 16S rRNA community...

Description Usage Arguments Details Value Examples

View source: R/BD_shift.R View source: R/BD_shift.R

Description

This function is meant to compare 16S rRNA sequence communities of gradient fractions from 2 gradients: a labeled treatment (eg., 13C-labeled DNA) and its corresponding unlabeled control. First, the beta-diversity (e.g, weighted-Unifrac) is calculated pairwise between fraction communities.

Usage

1
2
3
BD_shift(physeq, method = "unifrac", weighted = TRUE, fast = TRUE,
  normalized = FALSE, ex = "Substrate=='12C-Con'", nperm = 100, a = 0.2,
  parallel_perm = FALSE, parallel_dist = FALSE)

Arguments

physeq

phyloseq object

method

See phyloseq::distance

weighted

Weighted Unifrac (if calculating Unifrac)

fast

Fast calculation method

normalized

Normalized abundances

ex

Expression for selecting controls based on metadata

nperm

Number of bootstrap permutations

a

The alpha for calculating confidence intervals

parallel_perm

Calculate bootstrap permutations in parallel

parallel_dist

Calculate beta-diveristy distances in parallel

Details

The sample_data table of the user-provided phyloseq object MUST contain the buoyant density (BD) of each sample (a "Buoyant_density" column in the sample_data table). The BD information is used to identify overlapping gradient fractions (gradient fractions usually only partially overlap in BD between gradients) between the labeled treatment gradient and the control gradient. Beta diversity between overlapping fractions is calculated. Then, to standardize the values relative to the unlabeled control (1 beta-diversity value for each control gradient fraction), the mean beta diversity of overlapping labeled treatment gradients is calculated for each unlabeled control, and the percent overlap of each labeled treatment fraction is used to weight the mean.

A permutation test is used to determine 'BD shift windows'. The permutation test consists of permuting OTU abundances in the treatments and calculating beta-diversity. A boostrap confidence interval is calculated from the replicates.

Value

a data.frame object of weighted mean distances

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(physeq_S2D2)
## Not run: 
# Subsetting phyloseq by Substrate and Day
params = get_treatment_params(physeq_S2D2, c('Substrate', 'Day'))
params = dplyr::filter(params, Substrate!='12C-Con')
ex = "(Substrate=='12C-Con' & Day=='${Day}') | (Substrate=='${Substrate}' & Day == '${Day}')"
physeq_S2D2_l = phyloseq_subset(physeq_S2D2, params, ex)

# Calculating BD_shift on 1 subset (use lapply function to process full list)
wmean1 = BD_shift(physeq_S2D2_l[[1]], nperm=5)

ggplot(wmean1, aes(BD_min.x, wmean_dist)) +
   geom_point()

# Calculating BD_shift on all subsets; using just 5 permutations to speed up analysis
lapply(physeq_S2D2_l, BD_shift, nperm=5)

## End(Not run)

HTSSIP documentation built on July 25, 2017, 1:01 a.m.