R and Qiime2 scripts accompanying the manuscript on fecal microbiota transplantation (FMT) for peanut allergy. The codebase covers two parallel analyses:
- Human cohort. Patients with peanut allergy received FMT from one of three healthy donors (A, B, C). Stool samples were collected at multiple time points (Baseline through Month 12) and 16S rRNA gene amplicons were sequenced. Patients were retrospectively classified as responders (R) or non-responders (NR) based on clinical outcome.
- Germ-free mouse follow-up. Three independent mouse experiments were
carried out, transferring stool from defined sets of human patients into
germ-free mice. Mice were sampled before sensitization (
BS) and at the experimental endpoint after peanut challenge (EP). Donor stool was either the patient's baseline (BL) sample or the post-FMT 4-month (4M) sample.
.
├── README.md <- you are here
├── qiime2/
│ └── preprocessing.sh <- Qiime2 exports (mouse cohort shown;
│ run analogously for the human cohort)
└── R/
├── helpers.R <- shared utility functions
├── 01_human_FMT_analysis.R <- human cohort end-to-end analysis
└── 02_mice_FMT_analysis.R <- mouse cohort end-to-end analysis
The R scripts expect a Qiime2 export directory of the form:
export/
├── otu-feature-table.tsv # ASV-level table (samples × features)
├── strain-feature-table.tsv # species-level collapse (rank 7)
├── genus-feature-table.tsv # genus-level collapse (rank 6)
└── family-feature-table.tsv # family-level collapse (rank 5)
taxonomy.tsv # ASV → taxonomy lineage
dna-sequences.fasta # ASV representative sequences
metadata_single_donors_May2021_ancom.txt # human-cohort metadata
For the mouse cohort the equivalents are feature-table.Mice_FMT*.tsv,
rep-seqs-dada2.Mice_FMT.taxonomy.txt, dna-sequences_Mice_FMT.fasta and
metadata_Mice_FMT_exp_2022.txt. The qiime2/preprocessing.sh script
documents how the .tsv exports are produced from Qiime2 artifacts.
-
Qiime2 ≥ 2019.1 (preprocessing only)
-
R ≥ 4.0 with the following CRAN/Bioconductor packages:
Package Source Used for veganCRAN rarefaction, Bray-Curtis, PERMANOVA apeCRAN PCoA ( pcoa())ggplot2CRAN plotting dplyr,readrCRAN data manipulation, I/O egg,gridCRAN fixed-size ggplot panels RColorBrewerCRAN colour palettes seqinrCRAN FASTA I/O ALDEx2Bioconductor compositional differential abundance Maaslin2Bioconductor per-feature multivariable association
Install Bioconductor packages with:
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install(c("ALDEx2", "Maaslin2"))
From the project root:
# (1) Qiime2 exports conda activate qiime2-2019.1 cd qiime2 && bash preprocessing.sh && cd .. # (2) R analyses Rscript R/01_human_FMT_analysis.R Rscript R/02_mice_FMT_analysis.R
Each R script can also be sourced interactively. The scripts assume the
working directory contains the Qiime2 export folder for the relevant
cohort; edit the setwd() call near the top of each script if needed.
A fixed random seed (set.seed(151)) is used in the human script so the
rarefaction step is reproducible.
Each script writes its outputs into the current working directory:
- PERMANOVA result tables (
adonis_*.txt) - PCoA ordination plots (
pcoa_*.pdf) - Distance trajectories (
bray_curtis_*.pdf) - Maaslin2 output directories (
Maaslin2_*/) - Cleaned, pooled feature tables and matching taxonomy files
Statistical results that were reported in the manuscript (PERMANOVA tables, t-tests, Kruskal-Wallis tests, ALDEx2 minimum BH-corrected p-values) are preserved as inline comments next to the call that produces them, so the expected numerical output can be checked at a glance.
If you use this code, please cite the accompanying publication (reference to be added on acceptance).