Zubair Khalid

Virologist/Molecular Biologist | Veterinarian | Bioinformatician

Conventional & Molecular Virology • Vaccine Development • Computational Biology

Dr. Zubair Khalid is a veterinarian and virologist specializing in conventional and molecular virology, vaccine development, and computational biology. Dedicated to advancing animal health through innovative research and multi-omics approaches.

Dr. Zubair Khalid - Veterinarian, Virologist, and Vaccine Development Researcher specializing in Computational Biology, Multi-omics, Animal Health, and Infectious Disease Research

Section: Infrastructure, Cloud & Policy

Spatial Transcriptomics Differential Expression: Methods and Best Practices

Spatial transcriptomics differential expression analysis identifies genes whose expression differs between spatial regions, anatomical structures, or experimental conditions while accounting for the spatial dependencies inherent in tissue data. This article explains the core challenges of differential expression testing in spatial transcriptomics, reviews established methods including SpatialDE, SPARK, and C-SIDE, and provides a practical workflow for researchers analyzing spatial gene expression data.

The Problem of Differential Expression in Spatially Structured Data

Differential expression analysis in spatial transcriptomics asks a deceptively simple question: which genes change expression between defined spatial contexts? The answer requires statistical methods that respect the physical structure of tissue. Unlike bulk RNA sequencing where each sample is an independent measurement, spatial transcriptomics data consist of spots or cells arranged across a tissue section with known coordinates. Adjacent spots share expression programs because they come from the same tissue microenvironment, creating spatial autocorrelation that violates the independence assumption of standard statistical tests.

The EMBL-EBI Training resources describe spatial transcriptomics as a technology that measures gene expression while retaining positional information within tissue. This positional context creates both opportunity and statistical complication. A gene may show elevated expression in one tissue region not because of a biological program unique to that region but because that region contains a particular cell type at higher density. Disentangling genuine regional expression differences from cell type composition effects requires methods designed for spatial data.

Standard differential expression tools developed for bulk RNA-seq assume each observation is independent. When applied to spatial data, these tools produce inflated significance because neighboring spots are not independent replicates. A gene with smooth spatial variation across a tissue section will appear significantly different between any two arbitrary regions even when the difference reflects continuous gradients instead of discrete biological states.

Core Statistical Challenges in Spatial Differential Expression

Spatial Autocorrelation

Spatial autocorrelation describes the tendency of nearby locations to have similar values. In tissue, this arises from shared cellular neighborhoods, local signaling gradients, and the physical continuity of anatomical structures. The sci-Space study applied to developing mouse embryos captured approximately 120,000 nuclei with spatial coordinates and identified thousands of genes with anatomically patterned expression. This scale of spatial patterning demonstrates that autocorrelation is the rule instead of the exception in tissue transcriptomes.

When testing for differential expression between spatial regions, autocorrelation means that the effective number of independent samples is far lower than the number of spots. A tissue section with 5,000 spots might provide only dozens of independent observations for a smoothly varying gene. Methods that ignore this structure report false positives because they treat each spot as an independent replicate.

Cell Type Composition Effects

Spatial spots often contain multiple cells, and the cellular composition varies across tissue regions. A differential expression test comparing tumor boundary to tumor interior may detect genes that differ simply because the boundary contains more fibroblasts or immune cells. The hepatocellular carcinoma study integrating single-cell and spatial transcriptomics identified three fibroblast subpopulations with distinct spatial distributions: HLA-DRB1+ CAFs primarily in normal tissue, MMP11+ CAFs at tumor boundaries, and VEGFA+ CAFs in tumor interiors. Any differential expression analysis comparing these regions would detect fibroblast marker genes, yet these differences reflect composition instead of cell-intrinsic expression changes.

Multiple Testing Burden

Spatial transcriptomics assays measure thousands of genes simultaneously. Testing each gene for differential expression across spatial regions generates a massive multiple testing problem. The comparative review of differential expression methods notes that RNA-seq analysis comprises a multi-phase workflow including normalization and differential expression testing, with numerous computational tools developed across bulk, single-cell, and spatial datasets. Controlling false discovery rate is essential, but spatial correlation makes standard FDR procedures conservative or anticonservative depending on the method.

Small Sample Sizes Across Biological Replicates

Many spatial transcriptomics studies analyze a handful of tissue sections, often from a single or few biological specimens. The Alzheimer's disease study integrating spatial transcriptomics with single-nucleus RNA-seq explicitly notes that power is limited for spatially informed differential expression of complex diseases due to small sample sizes of spatial data. The authors addressed this by integrating approximately 1.5 million cells from 436 postmortem brains profiled by snRNA-seq, using the CeLEry tool to infer cortical layers, then conducting layer- and cell-type-specific differential expression with a linear mixed model.

Methods for Identifying Spatially Variable Genes

Spatially variable gene detection asks which genes show expression patterns that depend on spatial location. This question differs from comparing predefined regions and serves as a foundation for many spatial analyses.

SpatialDE

SpatialDE models gene expression as a Gaussian process with a spatial covariance structure. The method decomposes expression variation into spatial and nonspatial components, testing whether the spatial component explains significant variance. SpatialDE requires spot coordinates and expression counts, fits a covariance model, and reports a Q-value for each gene indicating whether spatial patterning is significant.

The method works well for detecting genes with smooth spatial gradients and broad regional patterns. It is less sensitive to genes expressed in rare or isolated spots because the Gaussian process covariance assumes smoothness. SpatialDE also does not directly handle cell type composition, so detected spatially variable genes may reflect cellular density differences.

SPARK

SPARK extends the SpatialDE framework by using multiple spatial kernels to capture patterns at different length scales. This allows detection of both broad regional patterns and fine-grained local structures. SPARK fits a generalized linear spatial model and combines evidence across kernels using a Cauchy combination test.

SPARK generally provides better statistical power than SpatialDE for genes with localized expression patterns. The method remains sensitive to spot-level technical variation and benefits from careful normalization before testing.

COVARE

The COVARE method addresses a limitation of earlier approaches by modeling latent random effect correlations to detect genes with specific spatial expression patterns. COVARE uses a linear mixed-effects model framework that incorporates multiple predefined biological covariates and considers potential interaction relationships among covariates. This enables analysis of multifactorial coregulation in gene spatial expression, which is not achievable with methods assuming covariate independence.

The method provides unbiased estimation of gene expression spatial effects that aligns with the actual characteristics of the cellular microenvironment. COVARE is appropriate when researchers have prior biological information about covariates that may interact in shaping spatial expression, such as cell type markers, histological annotations, or ligand-receptor pairs.

Methods for Differential Expression Between Conditions or Regions

C-SIDE

C-SIDE (Cell-type-Specific Inclusive Differential Expression) models gene expression as a function of cell type composition and spatial location. The method estimates cell type proportions at each spot, then tests whether expression within a given cell type differs between spatial regions or experimental conditions. This addresses the composition confound directly.

C-SIDE requires cell type marker genes or reference-based deconvolution to estimate proportions. The method is particularly useful for cancer studies where tumor and stroma regions have dramatically different cellular compositions. The non-small cell lung cancer study profiling approximately 900,000 cells from 25 treatment-naive patients demonstrates the value of distinguishing cell type composition from expression changes, revealing transcriptional reprogramming of macrophages toward cholesterol export and iron efflux within tumors.

Niche-DE

Niche-DE performs niche-differential gene expression analysis to identify context-dependent cell-cell interactions. The method defines cellular niches based on local composition and tests whether gene expression within a cell type changes depending on the niche context. This moves beyond simple region comparisons to ask how the local microenvironment shapes expression.

Niche-DE is appropriate when the research question concerns cell-cell communication and how neighboring cells influence each other's transcriptional programs. The nasopharyngeal carcinoma study using spatial metabolomics and transcriptomics highlighted the critical role of interactions between precursor T cells and malignant epithelial cells in modulating therapeutic response, demonstrating the biological importance of niche-dependent expression.

Cell Type-Specific Inference

The cell type-specific inference method published in Nature Methods provides a framework for testing differential expression within specific cell types across spatial contexts. This approach integrates cell type deconvolution with differential testing to separate composition effects from cell-intrinsic expression changes.

TissueMosaic

TissueMosaic uses self-supervised learning of tissue representations to enable differential spatial transcriptomics across samples. The method learns embeddings of tissue regions that capture spatial context, then tests for expression differences associated with these representations. This approach is useful when comparing spatial patterns across multiple tissue sections or experimental conditions where predefined regions are not available.

Practical Workflow for Spatial Differential Expression Analysis

Step 1: Define the Biological Question and Comparison Groups

Before running any analysis, specify the exact comparison. Are you comparing anatomical regions within a single tissue section? Are you comparing the same region across treatment conditions? Are you asking which genes vary across the entire tissue without predefined regions? Each question requires different methods and interpretations.

For region-based comparisons, define regions using histological annotation, marker gene expression, or unsupervised clustering of spatial expression profiles. Document the criteria used for region assignment. The spatiotemporal embryo atlas generated spatial transcriptomic profiles across 77 sagittal sections of 13 whole-human embryos and established regulatory profiles for 50 organs and 198 substructures, demonstrating how careful anatomical annotation enables meaningful regional comparisons.

Step 2: Quality Control and Preprocessing

Apply standard spatial transcriptomics quality control before differential testing. Filter spots with low total counts, high mitochondrial fraction, or outlier gene counts. Normalize expression using methods appropriate for spatial data, typically library size normalization followed by log transformation.

Check for batch effects if comparing across tissue sections or sequencing runs. The FAIR Guiding Principles emphasize that data should be Findable, Accessible, Interoperable, and Reusable, which includes documenting preprocessing steps so analyses can be reproduced.

Step 3: Assess Spatial Autocorrelation

Before selecting a differential expression method, quantify the degree of spatial autocorrelation in your data. Compute Moran's I or Geary's C for highly expressed genes to understand the spatial structure. High autocorrelation indicates that standard nonspatial tests will produce inflated significance.

Step 4: Estimate Cell Type Composition

For most spatial platforms, each spot contains multiple cells. Estimate cell type proportions using reference-based deconvolution with single-cell or single-nucleus RNA-seq data from the same tissue type. The retinal organoid study sequenced 285,441 single cells from organoids and adult retinas, demonstrating how matched single-cell references enable cell type annotation in spatial data.

If a matched single-cell reference is unavailable, use marker-based scoring or unsupervised approaches. Document the limitations of your composition estimates, as inaccurate deconvolution propagates errors into downstream differential testing.

Step 5: Select the Statistical Method

Choose the method based on your biological question and data structure:

  • For detecting spatially variable genes without predefined regions, use SPARK or SpatialDE. SPARK generally provides better power for localized patterns.
  • For comparing predefined regions while accounting for cell type composition, use C-SIDE or cell type-specific inference methods.
  • For testing how local microenvironment shapes expression, use Niche-DE.
  • For incorporating multiple covariates and their interactions, use COVARE.
  • For comparing across many samples with learned tissue representations, consider TissueMosaic.

Step 6: Run Differential Testing and Apply Multiple Testing Correction

Run the selected method and collect per-gene test statistics and p-values. Apply false discovery rate control appropriate for the number of tests performed. Report both adjusted p-values and effect sizes, as statistical significance alone does not indicate biological importance.

Step 7: Validate Results

Validate candidate genes using independent approaches. Check whether detected genes are known markers of the regions or conditions being compared. Examine spatial expression maps to confirm that significant genes show visually coherent patterns. The Alzheimer's disease study applied spatial transcriptomics and immunohistochemistry to 78 postmortem brain sections from 21 individuals, stratifying spots into plaque-glia niches based on amyloid-beta, GFAP, and IBA1 intensity, then validated neuronal and glial changes by immunohistochemistry and quantitative analyses.

Step 8: Interpret Results in Biological Context

Interpret differential expression results within the tissue architecture. A gene significant between tumor and stroma may reflect differences in cell type composition, cell-intrinsic expression programs, or both. The hepatocellular carcinoma SPP1 study found that tumor cells with high SPP1 expression were preferentially localized adjacent to hepatic stellate cells, with SPP1 interacting with CD44 receptors to activate PI3K/AKT signaling and promote fibroblast differentiation. This type of spatial relationship requires interpretation beyond simple differential expression lists.

At a Glance: Method Selection for Spatial Differential Expression

Method Primary Question Input Requirements Key Strength Key Limitation
SpatialDE Which genes show spatial patterning? Spot coordinates, expression counts Detects smooth regional gradients Misses localized patterns in rare spots
SPARK Which genes show spatial patterning at multiple scales? Spot coordinates, expression counts Multiple kernels capture varied pattern scales Computationally intensive on large datasets
C-SIDE Which genes differ between regions within specific cell types? Spot coordinates, expression, cell type proportions Separates composition from expression changes Requires reliable deconvolution
COVARE Which genes show spatial patterns influenced by covariate interactions? Spot coordinates, expression, biological covariates Models multifactorial coregulation Requires prior covariate knowledge
Niche-DE Which genes change expression based on local cellular context? Spot coordinates, expression, cell type annotations Identifies context-dependent interactions Complex interpretation of niche definitions
TissueMosaic Which genes differ across samples using learned tissue representations? Multiple tissue sections, expression Handles cross-sample comparisons Requires sufficient sample numbers

Records and Measurements for Reproducible Analysis

Maintain detailed records of every analysis decision. Record the software versions of all tools used, including the spatial analysis package, deconvolution reference, and statistical method. Document parameter settings, particularly any thresholds for spot filtering, normalization choices, and multiple testing correction methods.

Record the number of spots passing quality control, the number of genes retained after filtering, and the distribution of library sizes. These measurements allow other researchers to assess whether your analysis was appropriately powered. The NCBI Data Resources provide repositories for depositing raw and processed spatial transcriptomics data, enabling independent verification of results.

Document the cell type deconvolution approach, including the reference dataset used and the quality metrics for deconvolution accuracy. If deconvolution was performed with multiple references, record the concordance between approaches.

Store all analysis scripts in version control and include them with published results. The Genomic Data Sharing Policy from the National Institutes of Health outlines expectations for data sharing and reproducibility in genomic research, which applies to spatial transcriptomics studies.

Common Failure Patterns in Spatial Differential Expression

Treating Spots as Independent Replicates

The most common error is applying standard differential expression tools designed for bulk RNA-seq to spatial data without accounting for spatial autocorrelation. This produces thousands of false positives because neighboring spots share expression programs. Always assess spatial autocorrelation before analysis and use methods that model spatial covariance.

Ignoring Cell Type Composition

Comparing regions with different cellular compositions without deconvolution detects composition differences instead of expression changes. A gene may appear upregulated in tumor tissue simply because tumor tissue contains more malignant cells expressing that gene. Use composition-aware methods or explicitly interpret results as reflecting both composition and expression changes.

Overinterpreting Results from Single Tissue Sections

A single tissue section represents one biological sample. Differential expression findings from one section may reflect individual variation instead of general biological differences. The nucleus pulposus progenitor cell study generated a spatially resolved transcriptional atlas of the mouse intervertebral disc using the 10x Genomics Visium platform, dividing nucleus pulposus spots into two clusters and using lineage tracing to validate findings. This combination of spatial data with functional validation provides stronger evidence than spatial data alone.

Inadequate Multiple Testing Control

Testing thousands of genes without appropriate multiple testing correction generates unacceptable false discovery rates. Apply FDR control and report adjusted p-values. Be aware that spatial correlation can make standard FDR procedures either too liberal or too conservative depending on the correlation structure.

Using Inappropriate Normalization

Spatial data have unique technical artifacts including spot-to-spot variation in capture efficiency and tissue permeabilization. Normalization methods developed for single-cell data may not fully correct for spatial artifacts. Evaluate normalization by examining whether known housekeeping genes show uniform expression across the tissue.

Circular Analysis

Using the same data to define regions and test for differential expression between those regions creates circularity. If regions are defined by clustering gene expression, then testing for genes that differ between clusters will trivially find the clustering genes. Use independent information such as histology or marker genes to define regions, or use methods designed to account for this circularity.

Limitations of Current Methods

Resolution Constraints

Most spatial transcriptomics platforms measure expression in spots containing multiple cells. The scResolve method addresses this limitation by recovering single-cell expression profiles from spatial transcriptomics data, but the recovery is computational and depends on the quality of reference data. Differential expression results reflect the resolution of the platform and the accuracy of computational deconvolution.

Limited Biological Replicates

Spatial transcriptomics experiments are expensive, and many studies analyze few biological replicates. Statistical power for detecting subtle expression differences is correspondingly limited. The integration study for Alzheimer's disease demonstrates one solution: integrating spatial data with larger single-nucleus datasets to enhance power while retaining spatial information.

Technical Artifacts

Spatial platforms have platform-specific artifacts including capture efficiency variation, tissue distortion, and batch effects across sections. These artifacts can masquerade as biological spatial patterns. Include appropriate controls and replicate sections to distinguish technical from biological variation.

Interpretation Challenges

Even with statistically rigorous methods, interpreting spatial differential expression results requires biological knowledge. A gene significant in a spatial comparison may be a downstream consequence instead of a driver of regional differences. The deep learning multimodal analysis chapter describes how integrating genomic, proteomic, imaging, and clinical data offers a more holistic understanding of cancer biology, suggesting that spatial transcriptomics results should be interpreted alongside other data modalities.

Safety and Regulatory Context for Data Handling

Spatial transcriptomics data from human tissues involve protected health information and genomic data. The Genomic Data Sharing Policy from the National Institutes of Health specifies expectations for data sharing, including protecting research participant privacy and ensuring appropriate data use. Researchers working with human spatial transcriptomics data must obtain appropriate consent, de-identify samples, and follow institutional review board requirements.

The FAIR Guiding Principles published in Scientific Data provide a framework for making research data Findable, Accessible, Interoperable, and Reusable. Applying these principles to spatial transcriptomics data includes depositing raw data in public repositories, providing detailed metadata about tissue origin and processing, and documenting analysis workflows.

When publishing spatial transcriptomics results, include the data availability statement with accession numbers for raw and processed data. The NCBI Data Resources host spatial transcriptomics datasets and provide tools for accessing and analyzing deposited data.

Professional Escalation Criteria

Seek additional expertise or escalate to specialized support when encountering these situations:

  • Deconvolution results are highly unstable across reference datasets, suggesting that cell type estimates are unreliable and downstream differential results may be compromised.
  • Spatial autocorrelation metrics indicate extreme spatial structure that violates the assumptions of your chosen statistical method.
  • Batch effects between tissue sections overwhelm biological signal, requiring specialized batch correction methods beyond standard approaches.
  • Results differ dramatically between analysis methods, indicating that findings are method-dependent instead of robust biological signals.
  • The biological interpretation requires domain expertise beyond your team, such as pathology review of tissue regions or clinical knowledge of disease mechanisms.
  • Data volumes exceed available computational resources, requiring specialized infrastructure or algorithm optimization.

Frequently Asked Questions

What is the difference between spatially variable gene detection and differential expression analysis?

Spatially variable gene detection asks which genes show expression patterns that depend on spatial location across the entire tissue, without requiring predefined regions. Differential expression analysis compares gene expression between defined groups, such as anatomical regions or experimental conditions. Spatially variable gene detection is often a first step that identifies genes worth investigating further, while differential expression tests specific hypotheses about regional or conditional differences.

Why cannot I use standard bulk RNA-seq differential expression tools on spatial data?

Standard tools assume each sample is an independent measurement. Spatial transcriptomics spots are not independent because neighboring spots share tissue microenvironments and exhibit spatial autocorrelation. Using independence-assuming tools inflates significance and produces false positives. Spatial methods model the covariance structure between spots to provide valid statistical inference.

How do I account for cell type composition in spatial differential expression?

Estimate cell type proportions at each spot using reference-based deconvolution with matched single-cell or single-nucleus RNA-seq data. Then use methods such as C-SIDE that model expression as a function of both cell type composition and spatial location. Alternatively, interpret differential expression results as reflecting both composition differences and cell-intrinsic expression changes, acknowledging this limitation explicitly.

What is the minimum number of biological replicates needed for spatial differential expression?

There is no universal minimum, but statistical power increases with the number of independent biological samples. A single tissue section provides no biological replication and cannot support claims about general biological differences. Most published studies use at least three to five biological replicates per condition, though the Alzheimer's disease integration study demonstrates that integrating spatial data with larger single-nucleus datasets can enhance power when spatial sample sizes are limited.

How do I choose between SpatialDE and SPARK?

Both methods detect spatially variable genes, but SPARK uses multiple spatial kernels to capture patterns at different length scales, providing better power for localized expression patterns. SpatialDE assumes smoother spatial covariance and may miss genes expressed in small or isolated regions. For most applications, SPARK is the preferred choice, though SpatialDE may be sufficient for tissues with predominantly broad regional patterns.

How should I validate spatial differential expression results?

Validate using independent methods such as immunohistochemistry, in situ hybridization, or quantitative PCR on adjacent tissue sections. Check whether candidate genes are known markers of the regions or conditions being compared. Examine spatial expression maps to confirm coherent patterns. The Alzheimer's disease study validated spatial transcriptomics findings with immunohistochemistry and quantitative analyses, confirming elevated neuronal apoptosis near low-amyloid plaques.

What are the main sources of false positives in spatial differential expression?

The main sources are spatial autocorrelation ignored by independence-assuming tests, cell type composition differences between regions, batch effects across tissue sections, and inadequate multiple testing correction. Circular analysis where regions are defined by the same data used for testing also produces false positives.

How do I report spatial differential expression results for publication?

Report the software versions, parameter settings, quality control metrics, normalization approach, deconvolution reference, and statistical methods used. Include the number of spots and genes analyzed, the multiple testing correction applied, and both adjusted p-values and effect sizes. Deposit raw and processed data in public repositories such as NCBI and provide accession numbers. Follow the FAIR Guiding Principles for data sharing and documentation.

Related Bioinformatics Guides

References and Further Reading

This article is educational and does not replace validated analysis plans, institutional policy, clinical interpretation, or specialist review.