# SpatialRNA: a Python package for easy application of Graph Neural Network models on single-molecule spatial transcriptomics dataset

**Authors:** Ruqian Lyu, Annika Vannan, Jonathan A Kropski, Nicholas E Banovich, Davis J McCarthy

PMC · DOI: 10.1093/bioinformatics/btaf659 · 2025-12-13

## TL;DR

SpatialRNA is a Python package that simplifies applying Graph Neural Networks to spatial transcriptomics data, helping identify molecular and cellular patterns in tissues.

## Contribution

SpatialRNA introduces an accessible and scalable tool for generating subgraphs and applying GNNs to single-molecule spatial transcriptomics data.

## Key findings

- SpatialRNA enables efficient segmentation of tissue into spatial domains for biological interpretation.
- The package provides tutorials and workflows for applying GNNs under the PyG framework.
- It supports comprehensive analysis of complex molecular and cellular phenotypes in iST datasets.

## Abstract

Image-based spatial transcriptomics (iST) deliver gene expression measurements of RNA transcripts in tissue slices with single-molecule resolution and spatial context preserved. Modern Graph Neural Network (GNN) models are promising methods for capturing the complex molecular and cellular phenotypes in tissues at single-transcript and single-cell levels. A key application of GNNs is the detection of spatial domains or niches, that is, groups of molecules and/or cells that collaboratively work together to produce complex phenotypes. Due to the vast number of detected transcripts in (iST) dataset, applying GNNs on RNA molecule graphs is not trivial. We present a Python package, SpatialRNA, for easy (sub)graph generation from tissue samples and provide comprehensive tutorials for convenient and efficient application of Graph Neural Network models under the PyG framework. This highly scalable tool comprehensively segments tissue into spatial domains, aiding in biological interpretation of iST data and its underlying molecular microenvironments.

The SpatialRNA package is freely accessible from online repository https://github.com/ruqianl/spatialrna and can be installed via pip. Comprehensive tutorials, guidance on parameter selection, and complete workflows of case studies are available from the documentation website https://ruqianl.github.io/spatialrna_docs/, and uploaded on Zenodo with a DOI 10.5281/zenodo.17339575.

## Full-text entities

- **Diseases:** pulmonary fibrosis (MESH:D011658), idiopathic pulmonary fibrosis (MESH:D054990), ovarian cancer (MESH:D010051), tumour (MESH:D009369), iST (MESH:C564543)
- **Chemicals:** Xenium (-)
- **Species:** Homo sapiens (human, species) [taxon 9606]

## Figures

1 figure with captions in the complete paper: https://tomesphere.com/paper/PMC12777972/full.md

---
Source: https://tomesphere.com/paper/PMC12777972