Load packages

library("ampvis")

Load data

data(DNAext_1.0)

Subset to the relevant dataset

All samples are subset to 25.000 reads and then only OTUs which are seen at least 10 / 25000 times in a single sample is kept for further ordination analysis.

time <- subset_samples(V13, Exp.time == "YES") %>%
  rarefy_even_depth(sample.size = 25000, rngseed = 712) %>%
  filter_taxa(function(x) max(x) >= 10, TRUE)

Figure S1A: PCA colored by Sampling Date

PCA with square root transformed OTU abundances. The effect of sampling from different tanks is tested using the envfit function in vegan (permutation test).

pca <- amp_ordinate(data = time, 
                    plot.color = "Date", 
                    plot.point.size = 3,
                    plot.theme = "clean",
                    envfit.factor = "Date",
                    envfit.show = F,
                    output = "complete")

Plot the data. It looks like there is significant groupings.

pca$plot +
  theme(legend.position = "none")

ggsave("plots/S1A.eps", width = 55, height = 55, units = "mm")

The model reports a p-value of 0.001, hence there is an effect of time.

pca$eff.model
## 
## ***FACTORS:
## 
## Centroids:
##                    PC1     PC2
## Date2012-10-17 -2.5868 -1.7040
## Date2012-10-31 -2.2921 -1.0687
## Date2012-11-14 -1.5441  0.0266
## Date2012-12-12 -0.7073  2.4142
## Date2013-01-16  2.7550  4.0816
## Date2013-03-25  4.3753 -3.7496
## 
## Goodness of fit:
##          r2 Pr(>r)    
## Date 0.9875  0.001 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Permutation: free
## Number of permutations: 999

Figure S1B: Cluster analysis of beta diversity using Bray-Curtis

The Bray-Curtis dissimilarity index is used as an alternative method to test for significant groupings in the dataset.

beta <- amp_test_cluster(data = time, 
                         group = "Date", 
                         method = "bray", 
                         plot.color = "Date", 
                         plot.label = "Date",
                         plot.theme = "clean")

Using adonis we also find a significant effect of time as the p-value is 0.001.

beta$adonis
## 
## Call:
## adonis(formula = test_formula, data = sample) 
## 
## Permutation: free
## Number of permutations: 999
## 
## Terms added sequentially (first to last)
## 
##           Df SumsOfSqs  MeanSqs F.Model    R2 Pr(>F)    
## Date       5   0.26872 0.053744  8.1263 0.772  0.001 ***
## Residuals 12   0.07936 0.006614         0.228           
## Total     17   0.34808                  1.000           
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Clustering the data show a very nice grouping by time. Except the two first time-points two weeks appart all time-points cluster separately.

beta$plot_cluster +
  theme(legend.position = "none")

ggsave("plots/S1B.eps", width = 60, height = 55, units = "mm")

Difference between samples only weeks appart

time_weeks <- subset_samples(time, Date %in% c("2012-10-17", "2012-10-31", "2012-11-14")) %>%
  filter_taxa(function(x) max(x) >= 10, TRUE)
pca_weeks <- amp_ordinate(data = time_weeks, 
             plot.color = "Date", 
             plot.point.size = 3,
             plot.theme = "clean",
             envfit.factor = "Date",
             envfit.show = F,
             output = "complete"
             )

Plot the data. It looks like there is significant groupings even when looking at a time-scale of weeks.

pca_weeks$plot

The model reports a p-value of 0.006, showing there is an significant differnce between samples taken only weeks appart.

pca_weeks$eff.model
## 
## ***FACTORS:
## 
## Centroids:
##                    PC1     PC2
## Date2012-10-17  3.1830 -0.0726
## Date2012-10-31 -0.5669  1.9927
## Date2012-11-14 -2.6161 -1.9201
## 
## Goodness of fit:
##          r2 Pr(>r)   
## Date 0.6672  0.006 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Permutation: free
## Number of permutations: 999

Difference between samples only weeks using beta diversity

The Bray-Curtis dissimilarity index is used as an alternative method to test for significant groupings in the dataset.

beta_weeks <- amp_test_cluster(data = time_weeks, 
                               group = "Date", 
                               method = "bray", 
                               plot.color = "Date", 
                               plot.label = "Date",
                               plot.theme = "clean")

Using adonis we also find a significant effect of weekly sampling as the p-value is 0.006.

beta_weeks$adonis
## 
## Call:
## adonis(formula = test_formula, data = sample) 
## 
## Permutation: free
## Number of permutations: 999
## 
## Terms added sequentially (first to last)
## 
##           Df SumsOfSqs   MeanSqs F.Model      R2 Pr(>F)   
## Date       2  0.029387 0.0146934  2.2223 0.42554  0.006 **
## Residuals  6  0.039670 0.0066117         0.57446          
## Total      8  0.069057                   1.00000          
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Looking at the clustering it seems like the we can’t distinguish between samples from the two first timepoints (2012-10-17 and 2012-10-31). However, they are quite different from the timpoint 2 weeks later.

beta_weeks$plot_cluster

Variation compared to another WWTP

time_plant <- subset_samples(V13, Exp.time == "YES" | Plant == "AAE") %>%
  rarefy_even_depth(sample.size = 25000, rngseed = 712) %>%
  filter_taxa(function(x) max(x) >= 10, TRUE)

The major difference is plants and the second axis explain the differences related to the time-series.

amp_ordinate(data = time_plant, 
             plot.color = "Date", 
             plot.shape = "Plant",
             plot.point.size = 3,
             plot.theme = "clean"
             )

The Bray-Curtis dissimilarity index is used as an alternative method to test for significant groupings in the dataset.

beta_plant <- amp_test_cluster(data = time_plant, 
                               group = "Date", 
                               method = "bray", 
                               plot.color = "Date", 
                               plot.label = c("Date","Plant"),
                               plot.theme = "clean")
beta_plant$plot_cluster