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.
Glossary
Spatial Differential Expression

What is Spatial Differential Expression?
A computational method for identifying genes with statistically significant expression changes between user-defined spatial regions or tissue annotations.
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.
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.
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.
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
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
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
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
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.
Spatial vs. Conventional Differential Expression
Key distinctions between spatially-aware and traditional differential expression analysis frameworks
| Feature | Spatial DE | Conventional DE | Single-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 |
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.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Core statistical and computational concepts that form the foundation for identifying spatially variable expression patterns in tissue architecture.
Spatially Variable Genes (SVG)
Genes whose expression exhibits non-random spatial patterning across tissue. These are the primary output of spatial differential expression analysis.
- Detection methods: Gaussian process regression, spatial autocorrelation statistics, or marked point processes
- Biological significance: Often mark tissue boundaries, signaling centers, or disease-specific microenvironments
- Example: A gene highly expressed only at the invasive front of a tumor but not in the core
Spatial Permutation Test
A non-parametric significance test that generates an empirical null distribution by randomly shuffling spatial coordinates while preserving gene expression values.
- Process: Permute labels 1,000–10,000 times, recalculate the test statistic each iteration
- Advantage: No assumption of normality in the underlying expression data
- Output: An empirical p-value indicating how extreme the observed spatial pattern is compared to random chance
Tissue Segmentation
The computational partitioning of tissue images into anatomically or functionally distinct regions that define the spatial domains for differential comparison.
- Input: H&E stained images, immunofluorescence, or spatial transcriptomics data
- Methods: Deep learning architectures like U-Net, graph-based clustering, or manual annotation
- Role in SDE: Defines the categorical spatial regions between which differential expression is tested
Spatial Neighborhood Graph
A graph data structure where nodes represent spatial measurement locations and edges encode proximity relationships.
- Construction: k-nearest neighbors (k-NN) or distance-thresholded Delaunay triangulation
- Utility: Enables graph neural networks and spatial smoothing operations
- Edge weights: Often incorporate physical distance, enabling distance-weighted statistical models
Multiple Testing Correction
Statistical adjustment required when testing thousands of genes simultaneously across spatial regions to control false discovery rates.
- Benjamini-Hochberg: Controls the expected proportion of false positives among all discoveries
- Bonferroni: More conservative, controls family-wise error rate
- Spatial FDR: Specialized methods that account for spatial dependency between tests, reducing overcorrection

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us