Inferensys

Glossary

Spatial Differential Expression

A statistical framework for identifying genes whose expression changes significantly between user-defined spatial regions or tissue annotations within a spatially resolved transcriptomics dataset.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
STATISTICAL FRAMEWORK

What is Spatial Differential Expression?

A computational method for identifying genes with statistically significant expression changes between user-defined spatial regions or tissue annotations.

Spatial Differential Expression is a statistical framework that identifies genes whose expression levels change significantly between distinct, user-defined spatial regions or histological annotations within a tissue section. Unlike traditional differential expression, which compares bulk samples, this method preserves spatial context, testing for localized transcriptional shifts between structures like tumor versus stroma or cortical layers.

The analysis typically employs generalized linear models or non-parametric tests that account for spatial autocorrelation and the inherent zero-inflation of spatial transcriptomic data. By integrating tissue segmentation with statistical testing, it reveals region-specific biomarkers and functional gene programs that are invisible to dissociative single-cell methods.

SPATIAL STATISTICAL FRAMEWORK

Key Characteristics of Spatial Differential Expression

Spatial differential expression extends traditional differential expression analysis by incorporating tissue architecture, enabling the identification of genes whose expression changes significantly between user-defined anatomical regions or histological annotations.

01

Region-of-Interest Contrasts

The core mechanism involves comparing gene expression between pre-annotated spatial regions within a tissue section. Unlike global differential expression, which compares entire samples, this framework tests contrasts such as tumor core vs. invasive margin or cortical layer 2/3 vs. layer 5. The analysis accounts for the spatial covariance structure of the data, ensuring that observed differences reflect true biological variation rather than positional artifacts. Statistical models typically incorporate spatial random effects or Gaussian process kernels to model the correlation between neighboring spots.

02

Spatial-Aware Statistical Models

Standard t-tests and Wilcoxon rank-sum tests assume independent observations, an assumption violated by spatially autocorrelated transcriptomic data. Spatial differential expression frameworks employ specialized models:

  • Spatial Generalized Linear Mixed Models (GLMMs): Incorporate spatial random effects to account for location-based correlation
  • Gaussian Process Regression: Uses kernel functions to model smooth expression gradients across tissue coordinates
  • Moran's I-adjusted tests: Correct test statistics by estimating the effective sample size after accounting for spatial autocorrelation
  • Spatial permutation tests: Shuffle region labels while preserving spatial structure to generate valid null distributions
03

Multiple Testing Correction with Spatial Dependency

When testing thousands of genes across spatial regions, false discovery rate (FDR) control becomes critical. However, the spatial dependency between tests violates the independence assumptions of standard Benjamini-Hochberg correction. Advanced approaches include:

  • Spatial FDR: Estimates the proportion of null hypotheses while modeling the spatial correlation structure
  • Cluster-based permutation: Identifies contiguous spatial clusters of significant expression and assesses their significance as a whole
  • Bayesian hierarchical models: Share information across spatially proximal genes to improve power while controlling false positives
  • Spatial knockoff filters: Generate synthetic null variables that preserve the spatial correlation structure for rigorous FDR control
04

Distance-Based Expression Gradients

Beyond discrete region comparisons, spatial differential expression can identify genes with continuous expression gradients radiating from a reference structure. For example, a gene may show decreasing expression with increasing distance from a blood vessel or increasing expression toward the necrotic core of a tumor. This is modeled using:

  • Distance-based regression: Expression ~ f(distance_to_landmark) with spline or polynomial basis functions
  • Spatial trend tests: Non-parametric tests for monotonic expression changes along a spatial trajectory
  • Boundary detection algorithms: Identify genes whose expression sharply changes at the interface between two tissue compartments
05

Multi-Group and Interaction Designs

Complex experimental designs extend spatial differential expression beyond simple two-region comparisons:

  • Multi-region ANOVA: Identifies genes differentially expressed across three or more anatomical zones simultaneously
  • Spatial interaction effects: Tests whether the difference between two regions depends on a covariate, such as treatment vs. control × tumor vs. stroma
  • Paired spatial designs: Compares matched regions within the same tissue section, controlling for inter-sample variability
  • Spatial case-control contrasts: Compares equivalent anatomical regions across disease and healthy tissues, requiring robust spatial registration before differential testing
06

Integration with Histological Features

Modern spatial differential expression frameworks jointly model gene expression and tissue morphology. By incorporating features extracted from paired H&E or immunofluorescence images—such as cell density, nuclear atypia, or extracellular matrix alignment—the analysis can identify genes whose spatial expression patterns correlate with histological transitions. This multimodal approach distinguishes expression changes driven by cellular composition shifts from those reflecting true transcriptional regulation within a cell type, providing mechanistic insight beyond simple differential lists.

METHODOLOGICAL COMPARISON

Spatial vs. Conventional Differential Expression

Key distinctions between spatially-aware and traditional differential expression analysis frameworks

FeatureSpatial DEConventional DESingle-Cell DE

Primary data structure

Spatial coordinates + expression matrix

Expression matrix only

Expression matrix + cell barcodes

Accounts for tissue context

Null hypothesis basis

No spatial dependence between regions

No difference between condition groups

No difference between cell clusters

Handles within-tissue heterogeneity

Requires spatial permutation testing

Typical statistical framework

Spatial autocorrelation models, GLS

Negative binomial GLM, t-test

Wilcoxon rank-sum, MAST, DESeq2

Preserves anatomical annotation

Minimum replicates required

3-4 tissue sections per condition

3 biological replicates per condition

2 biological replicates per condition

SPATIAL DIFFERENTIAL EXPRESSION

Frequently Asked Questions

Clear, technical answers to the most common questions about identifying genes with statistically significant spatial expression patterns across tissue regions.

Spatial differential expression is a statistical framework for identifying genes whose expression levels change significantly between user-defined spatial regions or tissue annotations, explicitly incorporating the physical coordinates of measurements. Unlike standard differential expression, which compares bulk or single-cell populations without regard to location, spatial differential expression tests whether observed expression differences are attributable to spatial context—the tissue domain, anatomical structure, or microenvironment—rather than random variation. This approach accounts for spatial autocorrelation, the tendency for nearby measurements to be more similar than distant ones, preventing inflated false positives. Methods like SpatialDE, SPARK-X, and Giotto model expression as a function of spatial coordinates, enabling the discovery of genes that define histological boundaries, disease margins, or developmental zones.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.