Orchestrating microbiome multi-omics
Bioconductor conference, 2023
August 2023
Orchestrating microbiome multi-omics with R and Bioconductor
Leo Lahti @antagomir | Department of Computing, University of Turku, Finland
What to say.
Introduce yourself and the conference.
State the topic: how Bioconductor data structures and packages support microbiome and multi-omics analysis.
Idea of the slide. The opening slide of the talk, with the full title “Orchestrating microbiome multi-omics with R and Bioconductor”. It gives the speaker (Leo Lahti, handle (antagomir? ) ) and affiliation (Department of Computing, University of Turku, Finland), and shows the banner of the Bioconductor conference, August 2-4, 2023, with the BioC2023 logo. The HTML comment in the source is about printing to PDF and is not visible.
Teaching cues. About 1 min. Transition: “Let us begin with how we organise microbiome data.”
Fig. by Domenick Braccia (EuroBioC 2020)
What to say.
Standardised data containers support collaborative development of analysis methods and workflows: every package reads and writes the same object, so tools can be chained.
Walk through import, the TreeSE object, the mia pipeline and miaViz.
Idea of the slide. A slide with no title, showing a workflow figure by Domenick Braccia (EuroBioC 2020) titled “Standardized data containers support collaborative development of analysis methods and workflows”. Read it top to bottom. Import data: raw data (counts table, metadata, taxa tree) or existing data objects from widely used software (phyloseq, BIOM, DADA2) go in. The TreeSE object: the central container with taxonomic tree, row links and row data (taxa as rows), assays and column data (samples as columns) and metadata. The mia pipeline: accessing taxonomic information (adding a tree and aggregating by it), quality control (adding quality metrics to the sample data), and visualising with miaViz (a taxonomic tree plot coloured by prevalence).
Teaching cues. About 1.5 min. There is no slide title, so explain what the figure shows. The function names in the figure are as of 2020. Transition: “Next, how to integrate several experiments.”
Integrating multiple experiments
Combine taxonomic, metagenomic & functional profiling, and host measurements
by extending the Bioconductor MultiAssayExperiment class.
What to say.
To combine taxonomic, metagenomic, functional and host data, we extend MultiAssayExperiment.
Rule of thumb: assays for transformations of the same table, altExp for alternative views of the same samples, MultiAssay for different omics with a sample mapping.
Idea of the slide. It explains how multiple data types are combined. The text: combine taxonomic, metagenomic and functional profiling and host measurements by extending the Bioconductor MultiAssayExperiment class. Three images: left, a figure comparing TreeSE (taxonomic profiles, multiple assays, alternative experiments, hierarchies, sequence information, experiment metadata) with MultiAssayExperiment (Ramos et al. 2017, “integrating multiple omics”) with schematic structures; top right, a small table comparing the three options for storing several tables: assays (rows match, columns match; recommended for data transformations), altExp (rows free, columns match; recommended for alternative experiments), MultiAssay (rows free, columns free via a mapping; recommended for multi-omic experiments); bottom right, the title of the MultiAssayExperiment paper, “Software for the Integration of Multiomics Experiments in Bioconductor”.
Teaching cues. About 2 min. Likely question: “When do I use altExp and when MultiAssay?” Answer: altExp when all experiments are measured on the same samples; MultiAssay when samples differ across experiments, such as some samples missing from one omic, or several measurements per subject. Transition: “What do we gain?”
Benefits for microbiome data science
Extended
enhances multi-assay analyses in microbiome studies
Optimized
speed, memory & scale (sample sizes, datasets, cohorts)
Integrated
with other applications & frameworks (e.g. Single Cell, Spatial transcriptomics)
What to say.
Extended: more kinds of data can live in one object.
Optimized: the framework handles large cohorts and meta-analyses efficiently.
Integrated: because it is part of Bioconductor, methods developed for other fields such as single-cell and spatial transcriptomics can be reused for microbiome data.
Idea of the slide. It presents three benefits, as bold keywords with one line each, next to the same TreeSE vs MultiAssayExperiment figure as on the previous slide. Extended: enhances multi-assay analyses in microbiome studies. Optimized: speed, memory and scale (sample sizes, datasets, cohorts). Integrated: with other applications and frameworks (for example single cell and spatial transcriptomics).
Teaching cues. About 1.5 min. Transition: “Which packages and data sit on top of this framework?”
Package and data ecosystem
Bioconductor methods & packages supporting the framework.
Basic wrangling: transformations, agglomeration, split/merge etc.
Alpha & beta diversity
Dimension reduction (scater)
Differential abundance (ANCOMBC, ALDEx2, benchdamic)
Visualization (miaViz)
Time series manipulation (miaTime)
Ecological simulations (miaSim)
What to say.
Bioconductor methods and packages built around the framework cover the standard microbiome analysis steps.
Some are microbiome-specific (mia, miaViz, miaTime, miaSim), others come from general Bioconductor (scater for dimension reduction) or from the statistics community (ANCOMBC, ALDEx2, benchdamic).
Idea of the slide. An overview of the package ecosystem. On the left is a figure with an overview of the plot functions in miaViz. On the right is a list of methods and packages: basic wrangling (transformations, agglomeration, split and merge); alpha and beta diversity; dimension reduction (scater); differential abundance (ANCOMBC, ALDEx2, benchdamic); visualisation (miaViz); time series manipulation (miaTime); ecological simulations (miaSim). The old mia logo and the Bioconductor logo are at the bottom.
Teaching cues. About 2 min. Do not explain each method here. Transition: “How do we get data in, and where do we find data?”
Linking with other common formats and microbiome data science frameworks.
Open data resources
Open microbiome data sets readily available in TreeSummarizedExperiment format via curatedMetagenomicData , EBI MGnify , Bioconductor ExperimentHub , and packages.
What to say.
You do not need to start from scratch: existing pipelines’ outputs can be imported, and many public data sets are already available as TreeSE objects.
Point out that this makes examples and tutorials easy to reproduce.
Idea of the slide. A slide with no title but two subheadings. Importers for other common formats: logos of QIIME 2, mothur, BIOM and phyloseq, meaning that data produced by these tools can be imported into the TreeSE. Open data resources: open microbiome data sets are readily available in TreeSummarizedExperiment format via curatedMetagenomicData, EBI MGnify, Bioconductor ExperimentHub and packages. The three screenshots are, from left, the paper title “Accessible, curated metagenomic data through ExperimentHub”, the EBI MGnify homepage, and the Bioconductor page of the microbiomeDataSets package.
Teaching cues. About 2 min. Transition: “Let us see a minimal example.”
Minimal example
Cross-correlating taxonomic and metabolomic profiles from a dietary intervention study in mice (Hintikka et al. 2021).
library (mia)
# Import data and rename
data ("HintikkaXOData" )
mae <- HintikkaXOData
# Agglomerate rare taxa by prevalence at the Family level & log10-transform read counts
mae[["microbiota" ]] <- agglomerateByPrevalence (mae[["microbiota" ]], rank = "Family" )
mae[["microbiota" ]] <- transformAssay (mae[["microbiota" ]], method = "clr" , pseudocount = 1 )
# Get cross-correlation between taxa & metabolites
x <- testExperimentCrossAssociation (mae, experiment1 = "microbiota" , experiment2 = "metabolites" ,
assay.type1 = "clr" , assay.type2 = "nmr" ,
mode = "matrix" , sort = TRUE )$ cor
# Visualize taxa-metabolite associations on heatmap
ComplexHeatmap:: Heatmap (x)
What to say.
Within a few lines we go from the data to a taxa-metabolite correlation heatmap, because both data types sit in one MultiAssayExperiment.
The code is echoed and runs when the slides are built.
Idea of the slide. A short, runnable example with a result figure. The task, from Hintikka et al. 2021: cross-correlate taxonomic and metabolomic profiles from a dietary intervention study in mice. The code, line by line: library(mia) loads the package; data("HintikkaXOData") loads a MultiAssayExperiment with a microbiota experiment and a metabolites experiment, saved as mae; agglomerateByPrevalence(..., rank = "Family") merges rare taxa up to Family level, keeping only prevalent ones; transformAssay(..., method = "clr", pseudocount = 1) computes the centered log-ratio transformation, a standard transformation for compositional data, after adding a pseudocount of 1 to avoid log of zero; testExperimentCrossAssociation(...) calculates the correlation between every taxon (CLR assay) and every metabolite (the nmr assay) and returns the correlation matrix (mode = "matrix", $cor), sorted; ComplexHeatmap::Heatmap(x) draws it.
Expected output: a clustered heatmap of correlations between microbial families and metabolites, where hierarchical clustering groups rows and columns with similar profiles; colours show the strength and sign of correlation.
Teaching cues. About 3 min. Heads-up for the teacher: the comment in the code says “log10-transform read counts” but the code applies CLR; and testExperimentCrossAssociation has since been renamed in mia (current versions use getCrossAssociation), the old name still works in the version used to build these slides. Transition: “Where can you learn more?”
Documentation: OMA Gitbook (beta)
Complements other Bioconductor Gitbooks; overlapping methods and analysis strategies: microbiome.github.io/OMA
What to say.
OMA is the Bioconductor-style online book for microbiome analysis, with worked examples and best practices.
OSCA and OSTA follow the same style for single-cell and spatial data.
Idea of the slide. It introduces the documentation, the OMA (Orchestrating Microbiome Analysis) online book, marked “beta” in 2023, which complements other Bioconductor books with overlapping methods and analysis strategies. The text gives the address microbiome.github.io/OMA. On the left, a screenshot of the table of contents and title page of the OMA book; on the right, the homepages of the OSCA (single-cell analysis) and OSTA (spatially resolved transcriptomics) books.
Teaching cues. About 1.5 min. Show the table of contents. Transition: “The people behind the project.”
What to say. Nothing; click through it quickly.
Idea of the slide. A blank slide that exists in the source (an empty slide heading). It has no content.
Teaching cues. About 5 s. Transition: “Bioconductor books.”
Bioconductor books
What to say. The books follow a common style of orchestrating analysis in Bioconductor, with OSCA for single cell, OSTA for spatial transcriptomics and OMA for microbiome.
Idea of the slide. An optional slide that shows the homepages of the three Bioconductor books side by side: OSCA and OSTA on the left, OMA on the right.
Teaching cues. About 1 min. Skip if you are short of time. Transition: “More resources.”
Resources
Microbiome R package listing:
github.com/microsud/Tools-Microbiome-Analysis
What to say. If students want an overview of what R tools exist for microbiome analysis, start from the package list; the article gives the background.
Idea of the slide. An optional resources slide. A link to a list of microbiome R packages maintained on GitHub (microsud/Tools-Microbiome-Analysis); the old mia logo; and the title of the article “Microbiome data science” by Shetty and Lahti (Journal of Biosciences, 2019), which describes the area and the package list.
Teaching cues. About 1 min. The link on the slide works. Transition: “A recap of the workflow.”
Microbiome data science workflow
Data containers:
TreeSummarizedExperiment
MultiAssayExperiment
R/Bioc packages:
mia, miaViz
What to say.
Data come in through importers into a TreeSE, mia does the processing, miaViz visualises.
The containers are the common interface; the packages are interchangeable parts.
Idea of the slide. A recap of the workflow. The left column names the data containers (TreeSummarizedExperiment, MultiAssayExperiment) and the R/Bioconductor packages (mia, miaViz). The figure is a workflow figure by Domenick Braccia (EuroBioC 2020), the same content as the earlier workflow figure but without a title: import data, the TreeSE object (taxonomic tree, row links and data, assays, column data, metadata), then the mia pipeline (taxonomic information, quality control) and visualisation with miaViz (a tree plot coloured by prevalence).
Teaching cues. About 1.5 min. The following slides are backup slides. Transition: “Backup material.”
Misc
Figure source: Moreno-Indias et al. (2021) Statistical and Machine Learning Techniques in Human Microbiome Studies: Contemporary Challenges and Solutions. Frontiers in Microbiology 12:11.
What to say. Use only if asked about the broader field of statistical and machine learning methods for microbiome data.
Idea of the slide. An optional backup slide with a small figure from Moreno-Indias et al. (2021), “Statistical and Machine Learning Techniques in Human Microbiome Studies: Contemporary Challenges and Solutions” (Frontiers in Microbiology 12), on data and methods in microbiome machine learning. The figure is small and its source is given in the caption.
Teaching cues. About 30 s; skip otherwise.
TreeSummarizedExperiment
What to say. Use it if the audience asks about details of the class: which part stores what, for example that taxonomy sits in row data and sample information in column data.
Idea of the slide. A backup slide that shows the structure of the TreeSummarizedExperiment class again (the same figure as in “Organizing microbiome data”): assays, row and column data, row and column trees, reference sequences and metadata.
Teaching cues. About 1 min; optional.
Data integration in microbiomics
Scaling up sample size (cohorts & meta-analyses)
Complementary pipelines
Alternative experiments (e.g. 16S, metagenome, phylogenetic microarrays)
Multiple assays (e.g. counts, relative abundances, clr, phILR)
Hierarchies in feature & sample space (phylogenies, nested designs)
Cross-kingdom analyses (bacteriome, virome, mykobiome, eukaryome)
Multi-omics (taxonomy, function, host)
What to say.
Microbiome studies today combine many sources of data: bigger cohorts, several pipelines, several omic layers.
Each need maps to a feature of the container: multiple assays, alternative experiments, hierarchies, MultiAssayExperiment.
Idea of the slide. A list of seven needs of data integration in microbiomics: scaling up sample size (cohorts and meta-analyses); complementary pipelines; alternative experiments (for example 16S, metagenome, phylogenetic microarrays); multiple assays (counts, relative abundances, clr, phILR); hierarchies in feature and sample space (phylogenies, nested designs); cross-kingdom analyses (bacteriome, virome, mycobiome, eukaryome); and multi-omics (taxonomy, function, host).
Teaching cues. About 2 min. Ask the audience which of the needs they encounter. Transition: “Back to the optimal container.”
Linking multiple omics
Taxonomic, metagenomic & functional profiling, host measurements
What to say.
Taxonomic, metagenomic and functional profiling and host measurements are linked by the MultiAssayExperiment, where each experiment can itself be a TreeSE.
In the MAE schematic, subjects and observations are mapped by the sample map.
Idea of the slide. The headline “Taxonomic, metagenomic and functional profiling, host measurements” with the figure comparing TreeSummarizedExperiment (taxonomic profiles, multiple assays, alternative experiments, hierarchies, sequence information, experiment metadata) and MultiAssayExperiment (Ramos et al. 2017, integrating multiple omics), with schematic structures of both.
Teaching cues. About 1.5 min. Transition: “Open data resources to try it out.”
Open data resources
curatedMetagenomicData (Pasolli et al. 2017)
EBI MGnify (Mitchell et al. 2020)
microbiomeDataSets (Ernst et al. 2020);
R package demo data sets
Import functions for common formats (Biom, QIIME2, Mothur, phyloseq)
What to say.
There are plenty of open data sets to practise on and to use in your own analysis.
Encourage the audience to try the examples from the OMA book with them.
Idea of the slide. The closing list of open data resources: curatedMetagenomicData (Pasolli et al. 2017), EBI MGnify (Mitchell et al. 2020), microbiomeDataSets (Ernst et al. 2020), demo data sets of R packages, and import functions for common formats (BIOM, QIIME 2, mothur, phyloseq).
Teaching cues. About 1 min. Invite questions. This is the last slide.