Analysis code archive for the manuscript "path2path: directional pathway--pathway interaction maps from genome-scale Perturb-seq" (Jun Li, University of Notre Dame).
This archive contains the code that actually produced every number,
figure, and table in the manuscript and its supplementary material: the
frozen research library (R/), the analysis and reproduction scripts
(scripts/), the data-export scripts (scripts/ingest/), and the
figure-generation scripts (figures/).
Relation to the path2path R package. The Bioconductor package
(https://github.com/jli-stat/path2path) is the maintained distribution
of the method. The manuscript's analyses were run with the frozen
library archived here, which parallelizes with parallel::mclapply
under RNGkind("L'Ecuyer-CMRG") and fixed seeds; the package uses
BiocParallel, whose worker random streams differ, so borderline map
entries can differ from the archived runs at Monte-Carlo noise level
(strong entries and all conclusions are unaffected). Exact reproduction
of the manuscript requires this archive.
R/, source_all.R frozen research library (sourced, not installed)
scripts/ analysis + reproduction scripts (see map below)
scripts/ingest/ raw public data -> input z-score matrices
figures/ main and supplementary figure generation (Python)
environment/ R/Python/platform version snapshots
- R >= 4.4 with fgsea, msigdbr, data.table, BiocParallel, jsonlite
(versions used:
environment/R_package_versions.tsv); Python >= 3.12 with numpy, pandas, scipy, matplotlib, anndata, h5py (environment/python_versions.tsv). - Create a data root directory and set the environment variable
P2P_BASEto it. All scripts read and write under$P2P_BASE/{Marson2025,Replogle2022,Feng2026}.
Create $P2P_BASE/Marson2025, $P2P_BASE/Replogle2022,
$P2P_BASE/Feng2026 and download into them:
- Marson2025 (primary CD4 T cells; Zhu et al., Cell 2026,
doi:10.1016/j.cell.2026.08.002):
GWCD4i.DE_stats.h5adfrom the CZI Virtual Cells Platform release. Then runpython scripts/ingest/export_conditions.pyto producezscore_{rest,stim8hr,stim48hr}.csv.gzandperturbation_metadata.csv. - Replogle2022 (K562 GWPS/essential, RPE1; Replogle et al., Cell
2022): the gemgroup z-normalized pseudobulk releases from the study's
Figshare. Then
python scripts/ingest/export_zscore.py <dataset>fork562_gwps,k562_essential,rpe1. - Feng2026 (iPSC village; Feng et al., Cell Genomics 2026): the
mean-LFC long-format release and the targeted per-line table
(
TargetedScreen_LFC_byGene-perLine.tsv.gz) from the study's Figshare. Thenpython scripts/ingest/export_zscore_feng.py.
Each ingest script's docstring states its exact input filename(s) and the filters applied (which match the manuscript's Methods).
Everything is seeded; reruns are exactly reproducible on the archived software versions (see the seed registry below).
-
Maps + within-dataset analyses + figures (the canonical driver; supports
--resume):Rscript scripts/reproduce_all.R -
Route B calibration pools, all count-bearing maps (B = 20; resumable; ~10 h on an Apple M1 Max):
zsh scripts/calibrate_all_B20.shThe primary CD4 48-hour Hallmark calibration (B = 50) is run by
reproduce_all.Rstep "calibration CD4-48h hallmark". -
Post-processing behind the calibration figures/tables:
python scripts/realized_fdr_diagnostics.py # Fig 3d,e; Table S4 Rscript scripts/deep_tail_bootstrap.R # bootstrap CI in Results -
Figure-input CSV export (per-entry subsampling matrices for the supplementary subsampling figure):
Rscript scripts/export_subsampling_csv.R -
Regression tests over the reported numbers:
Rscript scripts/verify_numbers.R -
Figures (also invoked by the driver):
cd figures && python make_figures.py && python make_supp_figures.py
| Item | Producing script(s) |
|---|---|
| Maps (M/pval/padj matrices, 7 datasets) | run_path2path.R via reproduce_all.R |
| Fig 1 (schematic) | figures/make_figures.py::fig1 |
| Fig 2 (maps), Figs 5-6 (biology) | figures/make_figures.py (computed from matrices at draw time) |
| Fig 3 (calibration) | run_calibration.R, negative_control_test.R, realized_fdr_diagnostics.py, deep_tail_bootstrap.R |
| Fig 4 (replication + direction) | matrices + baseline_comparison.py |
| Fig S7 inputs (subs_sign/subs_ratio CSVs) | subsampling_sensitivity.R -> export_subsampling_csv.R |
| Rewiring quotes (Results) | calibrate_all_B20.sh Reactome pools; condition_contrast_reactome.py |
| Table 1 | dataset matrices (dimensions) |
| Table S1 / Fig S8 (transposed order) | legacy_transposed_pipeline.R |
| Table S2 | negative_control_test.R, k562_extra_validation.R, subsampling_sensitivity.R |
| Table S3 | 48-h Reactome padj matrix |
| Table S4 / Fig 3d,e | realized_fdr_diagnostics.py |
| Fig S2 (tautology) | with/without-target maps + tautology_stats.R |
| Figs S3-S7 | figures/make_supp_figures.py |
Provenance note (supplementary subsampling figure). The per-entry
CSVs in the original research tree were exported 2026-08-28 from
subsampling runs predating a library bug-fix pass; every published
summary number comes from the 2026-08-30 reruns whose .rds files
export_subsampling_csv.R reads (201 CD4 / 363 K562 strong entries).
Regenerating the figure from this archive changes the histograms
imperceptibly and no reported number.
- Raw downloads and all pipeline outputs (large; regenerable from the scripts above).
- The
path2pathR package (distributed separately via Bioconductor and https://github.com/jli-stat/path2path). - Internal reviewer-readiness scripts whose results are not reported in
the manuscript (parameter-sensitivity checks, threshold curves,
runtime benchmark, the overnight batch driver, and legacy per-dataset
drivers superseded by
reproduce_all.R). Their outputs informed robustness statements only qualitatively; everything quoted in the paper is reproduced by the scripts archived here.
RNGkind("L'Ecuyer-CMRG") throughout; set.seed values are hard-coded
in each script or passed by the drivers:
| Seeds | Use |
|---|---|
| 20260821-20260833 | reproduction-era scripts (per-script, see headers) |
20260831 (+ per-permutation seed_base + b) |
run_calibration.R runs |
| 20260901-20260911 | B = 20 calibration sweep (calibrate_all_B20.sh) |
| 20260932-20260933 | deep-tail bootstrap |
MIT (see LICENSE).