Inferensys

Glossary

Spatial Domain Detection

The unsupervised identification of tissue regions with coherent gene expression profiles and histology, often achieved through graph-based clustering or hidden Markov models.
ML engineer managing model training cluster on laptop, GPU utilization visible, technical deep learning setup.
TISSUE ARCHITECTURE ANALYSIS

What is Spatial Domain Detection?

Spatial domain detection is the unsupervised computational process of partitioning a tissue section into distinct, biologically meaningful regions based on coherent gene expression profiles and histological features.

Spatial domain detection is an unsupervised machine learning task that identifies contiguous tissue regions with homogeneous molecular signatures. By integrating spatial transcriptomics data with histology images, algorithms such as spatial graph neural networks and spatial hidden Markov models cluster spots or cells that share similar gene expression patterns while respecting physical proximity, revealing functional anatomical structures without relying on prior manual annotations.

These methods construct a spatial neighborhood graph where nodes represent capture locations and edges encode adjacency, enabling the model to enforce spatial smoothness in its clustering. The output is a tissue segmentation map that directly links molecular identity to tissue architecture, serving as a critical foundation for downstream analyses like spatial differential expression, ligand-receptor co-localization, and spatial niche analysis.

UNSUPERVISED TISSUE REGION IDENTIFICATION

Key Characteristics of Spatial Domain Detection

Spatial domain detection algorithms partition tissue into functionally coherent regions by jointly modeling gene expression and spatial adjacency, revealing anatomical structures without prior histological annotation.

01

Graph-Based Clustering Foundations

The core mechanism constructs a spatial neighborhood graph where nodes represent capture locations (spots or cells) and edges connect k-nearest spatial neighbors. Clustering algorithms like Leiden or Louvain then partition this graph to maximize intra-domain expression similarity while respecting spatial contiguity. This approach enforces that domains are not just transcriptionally similar but also physically connected, preventing fragmented or biologically implausible regions.

02

Hidden Markov Random Field Modeling

A probabilistic framework that assumes each spatial location has an unobserved hidden state (the domain label) and that the observed gene expression depends on this state. Crucially, the model incorporates a Markov assumption: the domain label at one location depends only on its immediate neighbors. Methods like SpaGCN and BayesSpace use this to smooth noisy expression data, enhancing domain boundaries that align with histological structures while suppressing technical artifacts.

03

Multi-Modal Feature Integration

Advanced detectors fuse heterogeneous data streams to improve domain accuracy:

  • Gene expression: Normalized count matrices from spatial transcriptomics
  • Histology images: Pixel-level features extracted via pre-trained convolutional neural networks
  • Spatial coordinates: Physical x,y positions encoding tissue architecture Joint latent space models learn shared representations where domains are defined by both molecular and morphological coherence, critical for identifying boundaries invisible to expression data alone.
04

Deep Graph Neural Network Approaches

Methods like STAGATE and SpaceFlow employ graph attention autoencoders that learn low-dimensional embeddings capturing both gene expression and spatial context. The network aggregates information from neighboring nodes through message-passing layers, producing spatially-aware latent representations. These embeddings are then clustered to identify domains. The deep learning advantage lies in capturing non-linear spatial dependencies and complex tissue architectures that linear methods miss.

05

Spatial Autocorrelation Metrics for Validation

Domain quality is quantitatively assessed using spatial statistics:

  • Moran's I: Measures whether domain assignments exhibit significant spatial clustering versus random distribution
  • Geary's C: Evaluates local spatial autocorrelation, sensitive to sharp boundaries
  • Adjusted Rand Index: Compares detected domains against expert histological annotations when ground truth exists High Moran's I values confirm that domains are not merely transcriptional clusters but genuinely spatially coherent structures.
06

Resolution and Scale Sensitivity

Domain detection is fundamentally scale-dependent. The number of domains identified is controlled by clustering resolution parameters or the number of hidden states in probabilistic models. Fine resolutions reveal subtle sub-domains like cortical layers, while coarse resolutions identify major anatomical divisions. Multi-scale approaches iteratively detect domains at varying granularities, building hierarchical tissue atlases that capture both broad regions and fine-grained functional units.

SPATIAL DOMAIN DETECTION

Frequently Asked Questions

Clear answers to common questions about the computational identification of tissue regions with coherent gene expression and histological features.

Spatial domain detection is the unsupervised computational process of partitioning a tissue section into distinct, biologically meaningful regions based on coherent gene expression profiles and histological features. It works by constructing a spatial neighborhood graph where each node represents a capture spot or cell, and edges encode physical proximity. Algorithms then apply graph-based clustering (such as Leiden or Louvain community detection) or spatial hidden Markov models to group locations that share similar transcriptomic signatures while respecting spatial continuity. Unlike non-spatial clustering, these methods explicitly penalize spatially fragmented assignments, ensuring that identified domains are contiguous tissue structures like cortical layers, tumor microenvironments, or developmental zones. The output is a spatial map where each location is assigned a domain label, enabling downstream analyses such as differential expression between regions or ligand-receptor interaction mapping across domain boundaries.

Unsupervised Tissue Architecture Discovery

Computational Methods for Spatial Domain Detection

Computational methods for spatial domain detection identify tissue regions with coherent gene expression profiles and histological features. These unsupervised algorithms partition spatial transcriptomics data into anatomically meaningful compartments without prior annotation.

01

Graph-Based Clustering

Constructs a spatial neighborhood graph where nodes represent spots or cells and edges connect spatial neighbors. Algorithms like Louvain or Leiden community detection then partition this graph to identify domains with similar transcriptomic profiles.

  • Leverages both gene expression similarity and physical adjacency
  • Scales efficiently to datasets with hundreds of thousands of spatial locations
  • Commonly used in tools like Seurat, Scanpy, and Squidpy
  • Graph construction parameters (k-nearest neighbors, distance thresholds) critically influence domain granularity
Leiden
Preferred Algorithm
k-NN
Graph Construction
02

Spatial Hidden Markov Models

Probabilistic models that assume observed gene expression at each location depends on an unobserved hidden state representing a spatial domain. Transitions between states follow a Markov random field, enforcing spatial smoothness.

  • Models spatial dependencies explicitly through transition probability matrices
  • BayesSpace uses a t-distributed error model with spatial priors for subspot resolution enhancement
  • Naturally handles uncertainty quantification for domain assignments
  • Particularly effective when tissue architecture follows smooth anatomical gradients
BayesSpace
Key Implementation
Subspot
Resolution Enhancement
03

Spatial Deep Learning

Neural network architectures that learn domain representations by integrating spatial context directly into the model. Spatial graph neural networks and convolutional autoencoders capture complex, non-linear relationships between gene expression and tissue architecture.

  • SpaGCN combines graph convolution with attention mechanisms to identify domains
  • STAGATE uses graph attention autoencoders for spatially aware dimensionality reduction
  • Can incorporate histological image features alongside transcriptomic data
  • Requires careful regularization to avoid overfitting to technical noise
SpaGCN
Graph Convolution
STAGATE
Attention Autoencoder
04

Non-Negative Matrix Factorization

Decomposes the spatial expression matrix into metagenes or factors that capture co-expression signatures associated with specific tissue domains. Each spatial location is represented as a weighted combination of these factors.

  • Spatial NMF variants incorporate spatial smoothness penalties on factor loadings
  • Produces interpretable factors that often correspond to known cell types or tissue structures
  • Giotto implements spatial-aware NMF with HMRF priors
  • Enables soft domain assignments where spots can belong partially to multiple regions
Giotto
Implementation
Soft
Assignment Type
05

Gaussian Process Models

Bayesian non-parametric models that place Gaussian process priors over spatial coordinates to model smoothly varying gene expression patterns. Domains emerge from shared latent spatial functions.

  • SpatialDE uses Gaussian process regression to identify spatially variable genes as a precursor to domain detection
  • GPcounts models discrete count data with Gaussian process likelihoods
  • Provides rigorous uncertainty quantification through posterior distributions
  • Computationally intensive for large-scale datasets but highly statistically principled
SpatialDE
Key Method
Bayesian
Framework
06

Multi-Modal Integration Methods

Algorithms that jointly analyze spatial transcriptomics with histology images, immunofluorescence, or spatial proteomics to define domains. These methods learn shared latent representations across modalities.

  • MUSE integrates morphology features from H&E images with gene expression
  • Spatial-MultiOmics frameworks align multiple spatial assays to a common coordinate system
  • Deep learning fusion layers combine image embeddings with transcriptomic features
  • Improves domain boundary detection where transcriptomic signals are subtle but histological transitions are sharp
MUSE
Morphology Integration
H&E + RNA
Common Modalities
COMPARATIVE ANALYSIS

Spatial Domain Detection vs. Related Concepts

Distinguishing spatial domain detection from adjacent analytical tasks in spatial transcriptomics

FeatureSpatial Domain DetectionTissue SegmentationSpatial Autocorrelation

Primary objective

Identify tissue regions with coherent gene expression profiles

Partition tissue image into anatomical regions based on pixel features

Measure statistical dependence of a variable across spatial locations

Input data type

Gene expression matrix + spatial coordinates

Histology image (H&E, IF)

Single gene expression vector + coordinates

Core methodology

Graph-based clustering, hidden Markov models

Convolutional neural networks, pixel classification

Moran's I, Geary's C, variograms

Output

Discrete spatial domains with transcriptomic signatures

Labeled tissue compartments (e.g., tumor, stroma, necrosis)

Scalar statistic quantifying clustering strength

Unsupervised learning

Multi-gene integration

Identifies novel regions

Requires spatial neighborhood graph

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.