Skip to content

A human shotgun cohort

Repeated stool samples do not provide independent participants. This case study starts from archived IBDMDB shotgun profiles and selects one eligible sample per participant before comparing nonIBD, Crohn’s disease, and ulcerative colitis. The abbreviations CD and UC refer to the two disease groups.

The source study is IBDMDB, PRJNA398089, a longitudinal study with repeated samples. This teaching subset is a small selection from that study, not a reproduction of its full cohort analysis. The source selection contains ten samples per diagnosis. Participant identifiers come from ENA’s host_subject_id, and dates come from collection_date.

Diagnoses are checked against the official IBDMDB metadata, dated August 20, 2018. The original selector filled missing disease fields with nonIBD. This preparation instead matches each ENA participant to the official participant record and requires agreement with the archived label. All archived labels agree with that independent source. Missing ENA disease fields alone do not establish that a participant belongs to the nonIBD group.

The profiles come from an archived March 2026 AWS Batch run. Its recorded software includes nf-core/taxprofiler 1.2.6, Kraken2 2.1.5, Bracken 3.0.1, and MetaPhlAn 4.1.1. The Kraken2 database is PlusPF capped at 8 GB, dated June 5, 2024. MetaPhlAn uses mpa_vJan25_CHOCOPhlAnSGB_202503. The parameters enable fastp and BBDuk filtering and disable host removal.

This case study reruns the downstream R and Python analyses. It does not rerun the primary pipeline, verify the original FASTQ files, or recover the missing database archive checksums. Disabled host removal limits interpretation of classification fractions and does not establish that the input lacked human DNA. The separately executed taxprofiler example uses another dataset and a newer pipeline release.

The teaching eligibility rule requires at least 100,000 Kraken2 input fragments. This threshold removes an extreme low depth sample; it is not a validated clinical cutoff. Kraken2 reports paired fragments as units, so this count does not mean the number of individual FASTQ records or the original library size.

Among eligible samples, retain the earliest collection date for each participant. Break date ties by run accession. The earliest archived eligible sample need not be that participant’s baseline visit. A low depth sample can be excluded while a later eligible sample from the same participant remains.

The code recalculates this selection from the committed manifest and verifies that it matches the preparation script. Both languages preserve an exclusion reason for every omitted sample and check participant uniqueness.

The companion repository requires access. It preserves the original reports, ENA XML records, source hashes, and preparation script. Its microbiome:0.1.0 container mounts the checked fixtures at /fixtures and runs without network access. Public study accessions remain available through ENA.

The archived read analyses use 30 public runs from the Lloyd-Price and colleagues IBDMDB study, covered by the INSDC data policy. The original iHMP data-use policy also permits use of the clinical metadata; its publication moratorium ended by fall 2018. These data were supplied by Ramnik Xavier and Curtis Huttenhower through the HMP program with NIH Common Fund grant 8U54DK102557.

library(ggplot2)
library(jsonlite)
metadata <- read.delim("/fixtures/ibdmdb_metadata.tsv",
colClasses = "character", check.names = FALSE)
metadata$kraken_fragments <- as.numeric(metadata$kraken_fragments)
metadata$selected <- metadata$selected == "True"
stopifnot(!anyDuplicated(metadata$sample_id))
eligible <- metadata[metadata$kraken_fragments >= 100000, ]
eligible <- eligible[order(eligible$collection_date, eligible$sample_id), ]
selected <- eligible[!duplicated(eligible$subject_id), ]
stopifnot(setequal(selected$sample_id,
metadata$sample_id[metadata$selected]))
stopifnot(!anyDuplicated(selected$subject_id))
groups <- c("nonIBD", "CD", "UC")
cat(sprintf("Archived samples: %d; selected participants: %d\n",
nrow(metadata), nrow(selected)))
for (group in groups) {
cat(sprintf("%s: %d\n", group, sum(selected$diagnosis == group)))
}
excluded <- metadata[!metadata$selected, ]
for (i in seq_len(nrow(excluded))) {
cat(sprintf("Excluded %s: %s; %d fragments\n", excluded$sample_id[i],
excluded$reason[i], excluded$kraken_fragments[i]))
}
cat(sprintf("Selected input fragments: %d to %d\n",
min(selected$kraken_fragments), max(selected$kraken_fragments)))
dir.create("outputs", showWarnings = FALSE)
write.table(selected, "outputs/selected_r.tsv", sep = "\t",
row.names = FALSE, quote = FALSE)
metadata$diagnosis <- factor(metadata$diagnosis, levels = groups)
metadata$position <- ave(seq_len(nrow(metadata)), metadata$diagnosis,
FUN = seq_along)
figure <- ggplot(metadata, aes(position, kraken_fragments,
color = diagnosis, shape = selected)) +
geom_point(size = 2.7) +
geom_hline(yintercept = 100000, linetype = "dashed") +
scale_y_log10() + facet_wrap(~diagnosis, nrow = 1) +
scale_color_manual(values = c("#287d8e", "#c95d35", "#8462ab")) +
theme_bw(base_size = 11) +
labs(x = "Sample order within diagnosis", y = "Kraken2 input fragments",
color = "Diagnosis", shape = "Selected")
ggsave("outputs/human_shotgun_depth_r.png", figure,
width = 8, height = 4.2, dpi = 160)
write_json(list(samples = nrow(metadata), participants = nrow(selected),
nonibd = sum(selected$diagnosis == "nonIBD"),
cd = sum(selected$diagnosis == "CD"),
uc = sum(selected$diagnosis == "UC"),
min_fragments = min(selected$kraken_fragments)),
"outputs/metrics_r.json", auto_unbox = TRUE, digits = 16)
Archived samples: 30; selected participants: 26
nonIBD: 9
CD: 10
UC: 7
Excluded SRR5936190: later_eligible_sample; 915707 fragments
Excluded SRR5946728: below_depth_threshold; 1901 fragments
Excluded SRR5946791: later_eligible_sample; 16280054 fragments
Excluded SRR5950641: later_eligible_sample; 8442926 fragments
Selected input fragments: 791120 to 20363047

The depth plot shows every archived sample and its selection status.

The depth figure includes every archived sample. The dashed line marks the eligibility threshold, and the point shape identifies the final selection. The retained samples still differ in sequencing effort. A depth threshold does not make their detection limits equal.

The next page compares Bracken and MetaPhlAn on these same participants. The cohort statistics lesson uses bacterial and archaeal species estimates from Bracken. These estimates exclude viral, eukaryotic, unclassified, and other unresolved assignments.

The selected cohort supports a cross sectional teaching comparison. Treatment, age, collection site, disease activity, and sequencing effort can confound it. The examples do not estimate a disease effect adjusted for those variables or reproduce the original longitudinal study’s conclusions.