Skip to content

The workflow and the datasets

Microbiome analysis has two distinct starting points. Amplicon reads measure a selected marker, while shotgun reads sample DNA across genomes. Both routes produce feature tables, but an ASV count, a classified read count, and a marker based abundance estimate have different meanings.

Dataset Role Limit
mothur MiSeq SOP Demonstrate nf-core/ampliseq on public mouse 16S reads and a mock sample Repeated samples from one mouse do not provide independent animals
SRR12324253 Demonstrate nf-core/taxprofiler on a declared subset of Zymo mock reads A mock sample supports a technical comparison, not a clinical group comparison
Kostic colorectal study Compare tumor tissue with matched normal tissue Adjacent normal tissue comes from cancer patients, not independent healthy controls
IBDMDB, PRJNA398089 Compare archived human shotgun profiles across diagnoses One selected sample per participant supports a small cross sectional teaching comparison

The cohort tables come from the phyloseq example archive. Its metadata identify each patient and tissue. The preparation script retains patients with exactly one normal sample and one tumor sample, each with at least 1,000 reads. This is a teaching selection rule, not a universal quality threshold. The original archive and the prepared subset have recorded checksums.

The cohort contains older reference OTUs from 16S pyrosequencing. The section does not describe them as newly inferred ASVs or as results from taxprofiler.

The human shotgun case study uses a separate set of archived Bracken and MetaPhlAn profiles. It verifies diagnoses against official IBDMDB metadata and selects independent participants. Its R and Python analyses rerun locally; the archived primary AWS pipeline does not run again in this case study.

The code below inspects the prepared Kostic colorectal cohort. Counts, taxonomy, and metadata come from the same public archive. The original features are reference OTUs, separate from the ampliseq demonstration.

The companion repository is private and requires access. Its microbiome:0.1.0 container provides the packages, and the runner mounts the prepared tables at /fixtures. Run each language’s blocks in order. The container runs without network access.

The checks align sample identifiers before any arithmetic. A matching number of rows alone cannot establish that metadata and counts describe the same samples. The histogram shows sequencing effort, and the pair table checks the experimental unit.

The paired counts and metadata come from Kostic and colleagues, distributed in the pinned phyloseq example archive. McMurdie and Holmes distribute that package under AGPL-3. The source notice records the exact archive, the 76-subject selection, and the applicable package terms.

library(ggplot2)
library(jsonlite)
counts <- read.delim(
"/fixtures/cohort_counts.tsv", row.names = 1, check.names = FALSE
)
counts <- t(as.matrix(counts))
metadata <- read.delim("/fixtures/cohort_metadata.tsv")
metadata <- metadata[match(rownames(counts), metadata$sample_id), ]
stopifnot(identical(rownames(counts), metadata$sample_id))
stopifnot(all(counts >= 0), all(counts == floor(counts)))
dir.create("outputs", showWarnings = FALSE)
pair_table <- table(metadata$subject_id, metadata$tissue)
stopifnot(all(pair_table == 1), ncol(pair_table) == 2)
library_size <- rowSums(counts)
cat("Samples:", nrow(counts), "\n")
cat("Patients:", nrow(pair_table), "\n")
cat("Reference OTUs:", ncol(counts), "\n")
cat("Read count range:", min(library_size), max(library_size), "\n")
plot_data <- data.frame(reads = library_size, tissue = metadata$tissue)
figure <- ggplot(plot_data, aes(reads, fill = tissue)) +
geom_histogram(bins = 20, alpha = 0.65, position = "identity") +
scale_x_log10() + theme_minimal(base_size = 12) +
labs(x = "Reads per sample, log10 scale", y = "Samples", fill = "Tissue")
ggsave("outputs/overview_r.png", figure, width = 6, height = 4, dpi = 160)
write_json(list(samples = nrow(counts), patients = nrow(pair_table),
features = ncol(counts), reads = sum(counts)),
"outputs/metrics_r.json", auto_unbox = TRUE, digits = 16)
Samples: 152
Patients: 76
Reference OTUs: 2505
Read count range: 1018 11187

The workflow and the datasets from the R example.

The patient provides the independent biological unit for the tissue comparison. Both tissues contribute information, and their shared patient identity belongs in the model. Splitting paired tissues into unrelated groups loses that design.

Continue with QC and contamination. The experimental design page explains the controls and metadata a new study should collect.

  • Pinned phyloseq Kostic archive

    The archive contains the reference OTU table and sample mapping file used for the paired cohort. Its metadata support patient and tissue alignment before the teaching selection.

  • DADA2 pipeline tutorial

    The tutorial follows mouse MiSeq SOP libraries through inference and read retention. It explains the separate amplicon source rather than the older colorectal reference OTUs.

  • Lloyd-Price and colleagues, IBDMDB study

    The original study explains the separate longitudinal human cohort and its public data deposits. Its study design differs from the matched colorectal tissues.