Code for "Learned Immune Architectures of High Antibody Response Across Vaccines".
ImmPrint is an interpretable machine-learning framework that predicts high vs. low antibody responders from post-vaccination blood transcriptomic fold changes. It covers three HIPC / Immune Signatures Data Resource (ISDR) cohorts: influenza (n = 776), hepatitis B (n = 160) and yellow fever (n = 96). Genes are aggregated into Blood Transcriptional Modules (BTMs) with GSVA, and a random forest is trained for each pathogen. Predictions are then interpreted with bootstrapped permutation importance, surrogate decision trees, limma differential expression and a cross-pathogen concordance test.
ImmPrint/
├── config.R # all paths (data, pipeline outputs, figures)
├── install_packages.R # CRAN + Bioconductor dependencies
├── data/gene_sets/ # BTM_Plus and ImmPort gene sets (+ how they were built)
├── R/ # function libraries (sourced, no side effects)
│ ├── filter_by_pathogen_variance.R
│ ├── btm_gene_filtering.R
│ ├── btm_pathway_scores.R
│ ├── immport_gene_filtering.R
│ └── immport_pathway_scores.R
├── scripts/ # run in numeric order
│ ├── 00_prepare_isdr_data.R
│ ├── 01_residualize_age_fc.qmd
│ ├── 02_feature_engineering.qmd
│ ├── 03_list_datasets.sh
│ ├── 03_model_training.R
│ ├── 04_xai_model_interpretation.qmd
│ ├── 05_differential_expression.R
│ ├── 06_power_analysis.R
│ └── figures/ # stand-alone figure/table scripts
└── docs/FIGURES.md # figure/table → script map
-
Install R (≥ 4.4) and Quarto, then run
Rscript install_packages.R. -
Get the ISDR data (see Data) and place the derived CSVs in
data/. -
Paths default to
data/andoutput/inside the repo. To use other locations, set environment variables, for example in~/.Renviron:IMMPRINT_DATA_DIR=/path/to/data IMMPRINT_GENESET_DIR=/path/to/gene_sets IMMPRINT_PIPELINE_DIR=/path/to/fc_btm_pipeline IMMPRINT_FIG_DIR=/path/to/figures
Open ImmPrint.Rproj (or run from the repo root) so that here::here() resolves correctly.
Run the scripts in scripts/ in numeric order:
- Split the ISDR eset into timepoint tables
- Age residualization and fold change
- Feature engineering (variance filter → BTM genes → GSVA)
- Model training
- Model interpretation (XAI): permutation importance, surrogate trees and cross-pathogen concordance
- Differential expression analysis of all predictive BTMs
- Power analysis
See scripts/README.md for inputs and outputs of each step.
See docs/FIGURES.md for which script produces each figure and table.
Expression and antibody data come from the HIPC Immune Signatures Data Resource (Diray-Arce et al., Sci Data 2022, https://doi.org/10.1038/s41597-022-01714-7). Raw data are not included in this repository.
-
Download
all_noNorm_withResponse_eset.rdsfrom the ISDR and place it inDATA_DIR(or pointIMMPRINT_ESETto it). -
Run
scripts/00_prepare_isdr_data.R. It writes the timepoint tables that step 1 reads:filtered_expression_data_timepoint_0_with_meta.csv: baseline samplesfiltered_expression_data_minimum_timepoint_with_meta.csv: earliest post-vaccination sample per participant
Each table holds every sample in the eset. Metadata (35 columns) is filled only for the samples in that subset, and step 1 keeps those with
filter(!is.na(age_imputed)).
Gene sets:
gene_sets/BTM_plus/BTM_Plus_Longform.csv: BTM membership in long format. Included in this repo; it comes from the MIT-licensed BTM package (seedata/gene_sets/BTM_plus/README.md).gene_sets/Immport/immport_all_genes_expanded_wide.csv: ImmPort immune gene lists (153 GO/Reactome terms). Included in this repo, along with the scripts that downloaded and parsed them (seedata/gene_sets/Immport/README.md). Used for the ImmPort feature comparison in Supp Table 2; downstream analyses use BTM features.
R 4.4.3 (ML on BU SCC) and R 4.5.2 (downstream analyses). Main packages: caret, randomForest, glmnet, kernlab, dbarts, pROC, PRROC, GSVA 2.4.5, limma 3.66.0, rpart 4.1.24, pvca 1.50.0, pwr 1.3-0, ggplot2 4.0.2, tidyverse 2.0.0.
MIT. See LICENSE.