Code to reproduce the analyses in:
Cellpin enables reference-based imputation and denoising of spatial transcriptomes Putze, Lucarelli, et al. bioRxiv (2026). https://doi.org/10.64898/2026.06.02.729566
The cellpin package itself is developed in a separate repository (see the manuscript's Code and data availability section); this repository contains the analysis code used to produce the manuscript's figures and supplementary figures.
Dataset sources for all analyses below are listed in Supplementary Table 1 of the manuscript / supplement.
Each top-level directory corresponds to one part of the manuscript.
Figure 2, Supplementary Figures 1–3, Supplementary Tables 1–3: the five-dataset, five-fold held-out gene imputation benchmark against SpaGE, gimVI, Tangram, scENVI, stDiff, and scConcept/scConcept+, plus the reference-gene-count scaling ablation, runtime/memory profiling, and the 10X Flex vs. 10X 5' Chromium reference comparison.
environments/— conda environment specs for the benchmarked baseline methods (Benchmarking.yamlis the original SpatialBenchmarking framework env;spatial-benchmarking-holdout.yamlis the environment used to run gimVI/SpaGE/Tangram;stDiff.yamlis stDiff's own env;spatial.yamlis the general scanpy/squidpy/spatialdata environment used for data prep and downstream analysis notebooks throughout this repo).prepare_data/— builds all spatial + scRNA-seq reference datasets used in the benchmark.scripts/— the benchmark runner (run_5_fold_extended.py) and its per-method subprocess helpers, the scConcept result integration scripts, the reference-gene-count scaling benchmark (Supplementary Table 3), and the runtime/memory benchmark (Supplementary Table 2). scConcept and scConcept+ predictions themselves were generated separately by scConcept's first author using default parameters; only the integration of those results into the benchmark is included here.notebooks/— figure-generation notebooks: per-dataset and cross-dataset benchmark metric plots (Fig. 2b–f, Supplementary Fig. 2), representative held-out gene spatial maps (Fig. 2g–i), and the full-vs-panel-encoder embedding/augmentation validation (Supplementary Fig. 1).
Figure 3, Supplementary Figure 4: cellpin trained on the Human Lung Cell Atlas and applied to 45 Xenium pulmonary fibrosis samples — recovery of held-out marker genes (SPP1, FABP4, KRT5, KRT17) and sample-level pseudobulk/pseudotime disease trajectory (SFTPA1, IGKC).
Figure 4, Supplementary Figure 5: cellpin trained on the Salcher et al. lung cancer scRNA-seq atlas and applied to a Xenium lung cancer sample — atlas-guided cell type label transfer, denoising of contaminated marker expression (MS4A1), and marker gene concordance between the reference and imputed spatial profiles.
Figure 5, Supplementary Figure 6: cellpin trained on an independent breast cancer scRNA-seq atlas and applied to a 10x Genomics Atera whole-transcriptome breast cancer spatial dataset — endothelial and lymphocyte subtype resolution, cancer-associated fibroblast signature scoring, and the noisy-gene-fraction comparison against ResolVI.
- Notebooks are stored with outputs cleared. Data paths in scripts/notebooks reference the original compute environment and will need to be adapted to your own paths.
- No raw data, model checkpoints, or benchmark result outputs are included in this repository; see Supplementary Table 1 for links to all source datasets.
