Skip to main content

Microbiome and metagenomics

A microbiome is the set of microbes living in one place, like the gut, the mouth or soil. In a note you can load microbiome data, look at it and test it, and the R code runs for you.

Prompts to try

Copy a prompt into a new note and send it. When the result is back, send the follow-up.

  1. Check how many false finds a method makes. Send:

    Load HMP_2012_16S_gingival_V13 from MicrobiomeBenchmarkData. Keep the supragingival samples from the first visit.

    Then:

    If I split these samples into two random groups, how many genera should come out as differentially abundant?
  2. Find microbes that differ between patients and healthy people. Send:

    Load BedarfJR_2017 from curatedMetagenomicData. It compares people with early Parkinson's disease and controls in Germany.

    Then:

    Agglomerate to genus, keep genera present in at least 10% of samples, and run ANCOM-BC2 for Parkinson's versus control with age and sex as covariates.
  3. Look at a study from MGnify, a public library of microbiome studies:

    Use MGnifyR to list the analyses in MGnify study MGYS00006110. It's 16S data from twelve French cheese varieties. Don't fetch any results yet.
  4. Read QIIME 2 files from Zenodo, a public site for research data. Send:

    Download Zenodo record 5762485. It has QIIME 2 files from a study of the brown bear gut microbiome.

    Then:

    Import the feature table, the taxonomy and the rooted tree .qza files into one TreeSummarizedExperiment.
  5. Check for something that could mislead the result. Send:

    Load KarlssonFH_2013 from curatedMetagenomicData. It's 70-year-old European women with normal, impaired or diabetic glucose control.

    Then:

    Which treatments are recorded? How many women take metformin?

What a note can do

Notes keep your data in a TreeSummarizedExperiment, one R object that holds the counts, the sample information and the names of the microbes together. They work on it with mia, a package for microbiome data, and follow the book Orchestrating Microbiome Analysis (OMA).

  • Get data. Load public studies from curatedMetagenomicData, HMP16SData, microbiomeDataSets, MGnify or HoloFood, or download a Zenodo record. Bring your own tables, BIOM files, QIIME 2 files, DADA2 output, phyloseq objects, or MetaPhlAn and Kraken 2/Bracken profiles. See Add your own data.
  • Clean and group. Drop rare microbes, and add up counts at a level such as genus.
  • Diversity. Alpha diversity tells you how many kinds of microbes one sample has. Beta diversity tells you how different two samples are.
  • Ordination. A plot that puts similar samples close together.
  • Group tests. PERMANOVA and RDA test whether groups of samples differ as a whole.
  • Differential abundance. Find which microbes are more common in one group than another, with LimROTS, MaAsLin3, ANCOM-BC2, ALDEx2 or lefser.
  • More. Community types (DirichletMultinomial), networks of microbes that rise and fall together (NetCoMi, SpiecEasi, SPRING), changes over time (miaTime), removing differences between batches or studies (MMUPHin) and predicting a group from the microbes (SIAMCAT, mikropml).

Notes start from tables and profiles, not from raw reads. Raw reads are trimmed, classified and profiled in Reports on Roihu, with CSC tools such as fastp, Kraken 2, Bracken, MetaPhlAn and HUMAnN. The profiles can then go into a note.

Plots come from miaViz, the plotting package that goes with mia.

Example notes

Open one to see every question, the code and the figures.

A finished figure in the 'Parkinson's disease and the gut with ANCOM-BC2' note, with the code cell above it.

Tips

  • If you ask to compare groups and do not name a method, the note follows the differential abundance chapter of the OMA book. It uses MaAsLin2 to compare two groups, also when you add covariates or interactions. It uses MaAsLin3 to look at two things apart: how often a microbe is present (prevalence), and how much there is of it where it is present (non-zero abundance). It shows the results with plotBoxplot and reports adjusted q-values. A method you name always comes first.
  • Notes plot with miaViz. Ask for ggplot2 if you want to style a figure yourself.