Integrative Spatial Modelling of Cellular Plasticity using Graph Neural Networks and Geostatistics
Authors/Creators
Description
SPiCe-paper-analyses
This repository contains the analysis code accompanying the [SPiCe](https://github.com/secrierlab/SPiCe) manuscript.
It has four components:
(i) `merfish_analysis` implements the graph neural network (GNN) framework. For each sample of the MERFISH mouse cortex dataset, it builds a spatial k-nearest-neighbour cell graph (k = 20, Euclidean-distance edge weights). It then holds out one cell type at a time and trains a three-layer graph convolutional network (`PyTorch` Geometric) on one-hot cell-type features to predict which remaining cells sit next to the removed type. Evaluation is inductive, on held-out tissue sections, and performance is measured by ROC-AUC. Predictions are interpreted with Integrated Gradients (Captum) for node-level (cell-type) importance, tested against a permutation baseline with Mann–Whitney U tests and multiple-testing correction. `GNNExplainer` is used for edge-level (cell-type-pair) importance.
(ii) `spatial_regression` contains Python and R notebooks that model spatially varying relationships in Xenium breast cancer data. They regress an EMT hallmark score on tumour-microenvironment and CNV-derived predictors, such as distances to neighbouring cell populations and principal components. The notebooks fit spatial error models (spreg), geographically weighted regression (`mgwr`) and multiscale `GWR` (`GWmodel` in R), with VIF/correlation filtering and variable-specific bandwidth selection.
(iii) `figure_plotting` holds the notebook and conda environment that reproduce the paper’s GNN performance, node/edge importance and network figures from the saved outputs. Conda environment files (`base_env_gnn.yml`, `figures_paper_gnn.yml`) specify the dependencies. The other notebooks show analyses regarding the generalisability, contender frameworks, etc.
(iv) `supplementary_analyses` holds the notebooks behind the supplementary results: simulations and a simVI archetype comparison (`00`, `01`, `06`), and Xenium processing, EMT plasticity hallmark scoring, CNA inputs and spatial regression for the breast (`YY_*`), lung (`ZZ_*`) and Xenium v1 (`AA_*`) datasets.
The scripts can also been found at [GitHub](https://github.com/secrierlab/SPiCe-paper-analyses).
Citation
Withnell E, Celik C, Secrier M. SPiCe: integrative spatial modelling of cellular plasticity using graph neural networks and geostatistics. Genome Biology (2026).
Files
spice-paper-analyses.zip
Additional details
Funding
- UK Research and Innovation
- FLF MR/T042184/1
- UK Research and Innovation
- FLF MR/Y034031/1
- UK Research and Innovation
- BBSRC BB/R01356X/1
- Health Data Research UK
- Wellcome PhD Programme 218529/Z/19/Z
Software
- Repository URL
- https://github.com/secrierlab/spice
- Programming language
- Python , R