Spatial trajectory inference is a computational framework that orders individual cells or spatial spots along a pseudotemporal path by simultaneously modeling gene expression similarity and physical proximity in a tissue section. Unlike traditional trajectory inference, which relies solely on transcriptomic similarity to reconstruct differentiation, this method constrains the ordering with spatial coordinates to ensure the inferred process respects anatomical boundaries and migratory patterns.
Glossary
Spatial Trajectory Inference

What is Spatial Trajectory Inference?
Spatial trajectory inference is a computational method that reconstructs dynamic biological processes by ordering cells based on their gene expression profiles and physical coordinates within a tissue.
The core algorithm typically constructs a spatial neighborhood graph where edges connect physically adjacent cells, then applies a dimensionality reduction or graph-learning technique to identify smooth transcriptional transitions across this spatial manifold. This enables the identification of origin and terminal states in situ, revealing how stem cells differentiate into specialized cell types while migrating through distinct tissue niches.
Core Characteristics of Spatial Trajectory Inference
Spatial trajectory inference reconstructs dynamic biological processes by ordering cells based on both their gene expression profiles and their physical coordinates within a tissue. These core characteristics define how the computational models capture differentiation, migration, and signaling in situ.
Pseudotime Ordering with Spatial Constraints
The foundational algorithm assigns each cell a pseudotime value representing its progress along a biological continuum. Unlike non-spatial methods, the ordering is constrained by a spatial neighborhood graph, ensuring that transitions between states are physically proximal. This prevents biologically implausible leaps across tissue compartments. The process typically involves constructing a graph where edges connect spatially adjacent cells, then finding a minimum spanning tree or principal curve through the high-dimensional expression space that respects these spatial adjacencies.
Vector Field Reconstruction
Instead of a static ordering, this approach learns a velocity vector for each cell, predicting its future transcriptional state. Techniques like RNA velocity are adapted to the spatial context, modeling the rate of change in gene expression as a function of both the cell's current state and its local neighborhood. The resulting vector field visualizes the flow of differentiation across the tissue, identifying sources (progenitor zones), sinks (terminally differentiated regions), and potential attractor states.
Optimal Transport for Cellular Transitions
This probabilistic framework models the coupling between cells in different spatial regions or time points. Optimal transport calculates the most efficient way to map the distribution of cells from an earlier state to a later state, minimizing a cost function that incorporates both transcriptional dissimilarity and physical distance. The resulting transition matrix quantifies the probability of a cell at location x differentiating into a cell type at location y, providing a rigorous, mass-preserving model of spatiotemporal dynamics.
Spatial Differential Geometry for Curvature Analysis
Advanced methods borrow concepts from differential geometry to analyze the shape of the inferred trajectory manifold. By calculating the curvature and torsion of the principal curve through the spatial-expression space, researchers can identify sharp bends that represent critical fate decision points. High curvature regions often correspond to branching points where a progenitor population diverges into two distinct lineages, providing a quantitative geometric signature of cell fate commitment within the tissue architecture.
Ligand-Receptor Driven Trajectory Bias
This characteristic integrates cell-cell communication directly into the trajectory model. The algorithm weights the probability of a differentiation transition based on the co-expression of cognate ligand-receptor pairs between neighboring cells. A cell's pseudotime progression is thus influenced by the signaling molecules it receives from its niche. This moves beyond descriptive trajectory inference to a mechanistic model where the tissue microenvironment actively shapes the differentiation path.
Topological Feature Extraction
Persistent homology, a tool from topological data analysis, is used to identify robust, multiscale features of the spatial trajectory. This method tracks the birth and death of connected components, loops, and voids in the spatial-expression data as a resolution parameter changes. It can detect cyclic trajectories (e.g., the cell cycle in a germinal center) or bifurcating structures that are invariant to noise, providing a coordinate-free summary of the dynamic process's global architecture.
Frequently Asked Questions
Addressing common questions about the computational reconstruction of dynamic biological processes from static spatial transcriptomics data.
Spatial trajectory inference is a computational method that orders individual cells or tissue spots into a continuous developmental path based on their gene expression profiles and physical spatial coordinates. Unlike traditional pseudotime algorithms that rely solely on transcriptomic similarity, this technique integrates spatial context to reconstruct dynamic processes like differentiation, migration, or tumor invasion directly in situ. The process typically involves constructing a spatial neighborhood graph where nodes represent cells and edges represent physical proximity. Algorithms then find a path through this graph that minimizes transcriptional change between adjacent steps, often using optimal transport or minimum spanning tree approaches. The output is a spatially constrained pseudotime ordering that reveals how cells transition through states while respecting tissue architecture. Key implementations include SpaceFlow, which uses a graph neural network to learn a low-dimensional embedding that encodes both expression and spatial similarity, and stLearn's PSTS (pseudo-space-time) module, which leverages diffusion pseudotime on a spatially regularized manifold.
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 algorithms and statistical frameworks that underpin spatial trajectory inference, enabling the reconstruction of dynamic biological processes from static tissue snapshots.
Spatial Autocorrelation
A foundational statistical measure quantifying the degree to which a gene's expression at one location depends on values at neighboring locations. Positive autocorrelation indicates clustering of similar expression levels, while negative autocorrelation suggests a chessboard-like pattern. Moran's I is the canonical metric, ranging from -1 (dispersion) to +1 (clustering). Trajectory inference algorithms exploit autocorrelation to identify smooth expression gradients along developmental paths.
Spatial Neighborhood Graph
A graph data structure where nodes represent cells or spatial spots, and edges connect proximate neighbors based on a distance threshold or k-nearest neighbors (k-NN). This graph is the computational backbone for trajectory inference, enabling message passing in spatial graph neural networks and defining the topology over which pseudotime is computed. Edge weights often encode inverse distance or similarity.
Pseudotime Ordering
A computational assignment of a scalar value to each cell representing its position along a continuous biological process, such as differentiation or cell cycle progression. Unlike real time, pseudotime is inferred from transcriptomic similarity and, in spatial contexts, constrained by physical proximity. Algorithms like Monocle and Slingshot use minimum spanning trees or principal curves to order cells, with spatial variants adding a distance penalty to prevent discontinuous jumps.
Spatial Hidden Markov Model
A probabilistic framework that models tissue organization as a sequence of hidden states (e.g., anatomical zones) with spatial dependencies. Each state emits gene expression values according to a state-specific distribution. The Viterbi algorithm decodes the most likely state path across the tissue. Trajectory inference can be framed as a state-transition problem where cells move through a defined sequence of spatial domains.
Spatial Deconvolution
A computational method that disentangles mixed gene expression signals from multi-cellular spots into constituent cell-type proportions. This is critical preprocessing for trajectory inference on lower-resolution technologies like Visium, where a single spot may contain 1-10 cells. Algorithms like RCTD and SPOTlight use reference single-cell data to estimate cell-type composition, enabling trajectory reconstruction on deconvolved cell-type maps.
Spatial Registration
The computational alignment of multiple tissue sections or spatial datasets into a common coordinate system. This enables cross-modality integration—for example, aligning spatial transcriptomics with histological images or serial sections. Rigid, affine, and non-linear transformations are applied to correct for tissue deformation. Registered data allows trajectory inference to span multiple sections, reconstructing 3D developmental gradients.

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