The 16S visualization pipeline runs automatically at the end of Nephele's 16S amplicon pipelines and produces some basic plots for rarefaction, alpha and beta diversity and heatmaps of taxonomic composition. For additional visualizations and more fine-grained diversity analysis, please see our separate downstream analysis (DA) pipeline.
Nephele uses the ampvis2 R package for statistical computation. We also make use of the Plotly R interface for the plotly.js charting library. The plots can be minimally edited interactively. However, they also have a link to export the data to the Plotly Chart Studio which allows for making a variety of charts. We have a tutorial for making simple edits to the plots here.
The rarefaction curves are made with the amp_rarecurve function. The table is written to rarecurve.txt and the plot to rarecurve.html.
rarecurve <- amp_rarecurve(amp, color_by = "TreatmentGroup")
sampling depth is used to filter out samples with few counts. Samples with counts which fall below the
sampling depth are removed from the OTU table using amp_subset_samples. The names of samples that are removed are output to samples_being_ignored.txt.
sampling depth is used to rarefy the counts for the Bray-Curtis PCoA and the alpha diversity plots. The OTU table is rarefied using rrarefy from the vegan R package. The table of the filtered, rarefied counts is saved as rarefied_OTU_table.txt.
If you do not provide a
sampling depth, the default value is 10000.
ampsub <- amp_subset_samples(amp, minreads = sampdepth) otu <- rrarefy(t(ampsub$abund), sampdepth) amprare$abund <- t(otu)
The heatmap, seq_heatmap.html, is made from the raw OTU table with the counts normalized to 100 to represent the relative abundances using amp_subset_samples before the heatmap is made with morpheus. If there are too many OTUs or sequence variants, then the heatmap is made at the species level instead. A heatmap is also made from the rarefied counts, seq_heatmap_rarefied.html.
amptax <- amp_subset_samples(amp, normalise = TRUE) heatmap <- morpheus(amp$abund, columns = columns, rows = rows, columnColorModel = list(type = as.list(colors)), colorScheme = list(scalingMode = "fixed", stepped = FALSE), columnAnnotations = amptax$metadata, rowAnnotations = amptax$tax)
The binomial distance is able to handle varying sample sizes, so the raw counts from the OTU table are used. For the Bray-Curtis distance, the rarefied counts are used. The coordinates from the plots are written to pcoa_binomial.txt and pcoa_bray.txt and the plots to pcoa_binomial.html and pcoa_bray.html. At least 3 samples are needed for these plots.
pcoa_binomial <- amp_ordinate(amp, filter_species = 0.01, type = "PCOA", distmeasure = "binomial", sample_color_by = "TreatmentGroup", detailed_output = TRUE, transform = "none") pcoa_bray <- amp_ordinate(amprare, filter_species = 0.01, type = "PCOA", distmeasure = "bray", sample_color_by = "TreatmentGroup", detailed_output = TRUE, transform = "none")
The Shannon diversity and Chao species richness are computed using amp_alphadiv. The rarefied counts are used for this computation. The diversity values are saved in alphadiv.txt, and boxplots are output to alphadiv.html. At least 3 samples are needed to produce these plots.
alphadiv <- amp_alphadiv(amprare, measure = "shannon", richness = TRUE, rarefy = sampdepth)
Gould J (2019). morpheus: Interactive heat maps using 'morpheus.js' and 'htmlwidgets'. R package version 0.1.1.1, https://github.com/cmap/morpheus.R.
McMurdie PJ and Paulson JN (2016). biomformat: An interface package for the BIOM file format. https://github.com/joey711/biomformat/.
Oksanen J, Blanchet FG, Friendly M, Kindt R, Legendre P, McGlinn D, Minchin PR, O'Hara RB, Simpson GL, Solymos P, Stevens MHH, Szoecs E, Wagner H (2019). vegan: Community Ecology Package. R package version 2.5-4, https://CRAN.R-project.org/package=vegan.
Sievert C (2020). Interactive Web-Based Data Visualization with R, plotly, and shiny. Chapman and Hall/CRC. ISBN 9781138331457, https://plotly-r.com.