Analyzing Spatial Biology Data: Tools, Workflows, and Best Practices
A guide to the computational pipeline for spatial biology data: from raw output to biological insight.
Spatial transcriptomics analysis has become one of the most computationally intensive disciplines in modern life science research. Generating spatially resolved gene expression profiles is now within reach of most well-equipped laboratories; interpreting those profiles is far less straightforward. The bottleneck in spatial biology has shifted from data generation to data analysis, and the choices made at each stage of the computational pipeline, from quality filtering through cell typing to spatial statistics, directly determine what biological insight can ultimately be extracted.
Key takeaways
- Spatial transcriptomics analysis requires a six-stage computational pipeline: raw data processing and coordinate alignment, quality control and normalization, cell segmentation or spot-level processing, cell type annotation and deconvolution, spatial statistics and neighborhood analysis, and biological interpretation, with choices made at each stage shaping what can be concluded downstream.
- Quality control (QC) thresholds developed for single-cell RNA sequencing (scRNA-seq) do not transfer directly to spatial data; platform-specific artifacts such as capture efficiency gradients and tissue edge effects require adapted filtering logic.
- Cell segmentation accuracy sets a hard ceiling on all downstream analysis in imaging-based platforms; errors in boundary detection propagate through every subsequent inference.
- The leading spatial analysis tools span two ecosystems: Python-based frameworks such as Squidpy and Scanpy, and R-based packages such as Seurat and Giotto. Most production workflows draw on tools from both environments because no single package covers the full pipeline equally well.
- Integration of spatial data with scRNA-seq references substantially improves cell type resolution, particularly in spot-based platforms where individual capture spots sample multiple cells simultaneously.
The spatial biology data analysis pipeline
Spatial biology data analysis is the computational process of transforming raw instrument output into spatially resolved biological knowledge, spanning preprocessing, molecular assignment, cell typing, and pattern detection. The spatial biology landscape, surveyed in the spatial biology complete guide, spans a wide range of experimental platforms, each generating data in distinct formats. Sequencing-based platforms such as 10x Genomics' Visium Spatial Platform produce per-spot gene expression count matrices anchored to tissue image coordinates. Imaging-based platforms such as 10x Genomics' Xenium, Vizgen's MERSCOPE, and NanoString/Bruker's CosMx produce per-transcript position tables that must be associated with individual cells before analysis. Multiplexed protein imaging platforms such as CODEX and multiplexed ion beam imaging (MIBI) produce multichannel intensity images that require cell detection and signal quantification as separate preprocessing steps. Each format demands distinct alignment and formatting before standard downstream analysis can begin.
A 2022 review in Nature Methods surveyed computational methods for spatial transcriptomics across literature dating back to 1987, documenting a rapidly expanding ecosystem of tools for spatial gene expression analysis, cell type deconvolution, neighborhood delineation, and tissue organization, and demonstrating the challenge of assembling a coherent analytical stack from this diversity of approaches.
The standard computational workflow for spatial data runs through six sequential stages:
- Raw data processing and coordinate alignment
- Quality control (QC) and normalization
- Cell segmentation and transcript assignment (imaging-based platforms) or spot-level processing (sequencing-based platforms)
- Cell type annotation and deconvolution
- Spatial statistics and neighborhood analysis
- Downstream biological interpretation and visualization

Figure 1: The six-stage computational pipeline for analyzing spatial biology data, from raw data processing through biological interpretation. Credit: AI-generated image created using Google Gemini (2026).
Each stage is discussed in detail in the sections below. The linked articles throughout this guide provide deeper technical treatment of the individual steps that define this workflow.
Preprocessing and quality control in spatial transcriptomics analysis
Raw output from sequencing-based spatial platforms must pass through alignment pipelines before any biological analysis is possible. Space Ranger, the primary pipeline for 10x Genomics' Visium, maps sequencing reads to the reference genome, aligns the resulting expression data to tissue image coordinates, and produces per-spot unique molecular identifier (UMI) count matrices. For Xenium MERFISH data, Xenium Analyzer performs analogous processing, producing per-cell transcript counts alongside cell boundary polygon files. For platforms not served by proprietary pipelines, open-source tools such as STARsolo handle read alignment and quantification.
QC for spatial data draws on conceptual parallels with single-cell RNA sequencing (scRNA-seq) but applies them to a fundamentally different data geometry. A 2024 platform benchmarking study in Nature Methods comparing 11 sequencing-based spatial methods documented substantial variation in sensitivity, resolution, and performance across platforms, establishing that universal QC cutoffs and analysis parameters frequently fail to translate between experimental systems.
Standard per-spot or per-cell QC metrics for spatial experiments include the following:
- Total gene count and UMI count per capture unit, used to flag empty spots and potential doublets
- Mitochondrial transcript fraction, with elevated values indicating compromised membrane integrity or the presence of debris
- Spatial autocorrelation of QC scores across the tissue, identifying systematic edge artifacts or fold regions where capture efficiency deviates from the tissue interior
- Total transcript density per unit area, flagging regions affected by tissue folds, air bubbles, or surface contamination
After filtering, count normalization adjusts for sequencing depth variation across capture locations. Library-size normalization followed by log transformation is a practical default for most workflows. SCTransform, which applies regularized negative binomial regression to model the relationship between sequencing depth and count distributions, is the preferred alternative for spot-based workflows where depth variability is pronounced.
Cell segmentation and transcript assignment
In imaging-based spatial platforms, accurately drawing cell boundaries from tissue images determines which transcripts or protein signals are attributed to which cell, and therefore sets the ceiling for every downstream inference. The guide to cell segmentation in spatial data provides a detailed treatment of this step; the principal considerations are summarized here.
Segmentation strategies divide into two broad categories. Nuclear segmentation identifies cell nuclei from a nuclear stain channel, typically DAPI, and is fast and reproducible but systematically underestimates cytoplasmic extent, particularly for cell types with large cytoplasmic compartments such as macrophages or neurons. Whole-cell segmentation expands nuclear masks using additional membrane or cytoplasmic channel information, capturing fuller cell area at the cost of increased sensitivity to staining heterogeneity and greater computational overhead.
Deep-learning tools have substantially raised the ceiling for segmentation performance. The Cellpose algorithm, published in Nature Methods in 2021, demonstrated generalist boundary prediction across a wide range of cell morphologies and image types without requiring model retraining or parameter adjustment, and has become a reference implementation for imaging-based spatial experiments. StarDist, which models cells as star-convex polygons, performs particularly well in densely packed epithelial and hematopoietic contexts where nuclear boundaries are clearly defined.
Transcript-coordinate platforms such as Xenium, CosMx, and MERSCOPE detect individual RNA molecules at precise subcellular coordinates rather than aggregating expression into capture spots or image pixels. For these platforms, Baysor applies a probabilistic model to assign individual transcript molecules to cells using local transcript density and, optionally, a prior derived from a nuclear segmentation mask. This transcript-first approach can outperform image-driven segmentation in tissue regions where nuclear stain quality is inconsistent or where cell morphology is irregular relative to a standard training distribution.
Cell type annotation and deconvolution in spatial data
Cell type annotation in spatial data is the process of assigning biological cell identities to individual expression profiles, while spatial deconvolution is the separate task of inferring how multiple cell types are mixed within a single low-resolution capture spot. Which problem applies depends on the geometry of the platform: imaging-based instruments producing single-cell profiles require annotation; spot-based platforms capturing multiple cells per measurement unit require deconvolution.
Imaging-based platforms operating at single-cell resolution produce one expression profile per segmented cell, making the annotation problem conceptually similar to scRNA-seq. Standard approaches include unsupervised clustering followed by marker gene scoring, automated label transfer from curated reference atlases using tools such as Azimuth or SingleR, and hybrid strategies that incorporate spatial position as an additional prior. Because many cell types occupy stereotyped tissue compartments, spatial context strengthens annotation confidence for profiles that are ambiguous based on expression alone. The article on cell type annotation in spatial datasets covers these strategies in depth.
Spot-based platforms introduce a distinct analytical challenge. Visium spots typically capture between 1 and 10 cells depending on tissue type, cell size, and section thickness, making single-cell resolution annotation impossible without deconvolution. Spatial deconvolution methods infer the proportional cell type composition of each capture spot by fitting observed expression against a paired scRNA-seq reference. The cell2location model, a Bayesian deconvolution approach published in Nature Biotechnology in 2022, demonstrated substantially higher sensitivity than earlier tools for resolving fine-grained cell types, including rare pre-germinal center B cell populations in the human lymph node, by borrowing statistical strength across spatially adjacent spots. Robust cell-type decomposition (RCTD) applies a Poisson-based probabilistic framework, and SPOTlight uses non-negative matrix factorization to achieve complementary results across diverse tissue contexts. The assumptions, inputs, and performance trade-offs of these methods are covered in the guide to spatial deconvolution methods.
Spatial statistics and neighborhood analysis in spatial data
Spatial statistics in the context of spatial transcriptomics are analytical methods that use the physical coordinates of cells or capture spots as primary variables, enabling questions about expression patterning, cellular proximity, and tissue organization that bulk or single-cell sequencing cannot address. The defining analytical contribution of spatial data is the ability to ask not only which cells are present, but where they reside, what patterns their expression forms across the tissue, and which cells are in physical proximity with which neighbors. These questions require statistical frameworks that treat the spatial coordinate as a primary biological variable rather than an annotation.
Detection of spatially variable genes (SVGs) identifies transcripts whose expression varies systematically across tissue space. Moran's I, a spatial autocorrelation statistic borrowed from geostatistics, provides the most widely used metric: values approaching one indicate that nearby capture units share more similar expression than would be expected by chance, while values near zero indicate expression distributed without spatial structure. Regression-based tools, such as SpatialDE, extend this framework to genome-scale gene sets with improved computational scalability in large experiments.
Neighborhood analysis moves from individual gene patterns to multicellular tissue organization. Neighborhood enrichment tests quantify whether pairs of cell types co-locate in physical space more or less frequently than random expectation, producing signed enrichment scores that reveal tissue segregation and intermixing patterns. Cellular niche identification extends this approach by applying community detection algorithms to spatial neighbor graphs, revealing recurring multicellular assemblages that may correspond to functional tissue units such as follicles, crypts, or perivascular zones.
Ligand-receptor inference overlays expression data from physically adjacent cells onto curated interaction databases to prioritize candidate intercellular signaling events. Methods such as CellChat, CellPhoneDB, and NicheNet produce ranked, cell-type-specific interaction predictions that provide structured hypotheses for experimental follow-up. A detailed technical review of these methods, including their underlying assumptions and common interpretation pitfalls, is available in the article on cell-cell communication and neighborhood analysis.
Spatial analysis tools and software toolkits for spatial bioinformatics
Table 1: Comparison of major open-source software toolkits for spatial biology data analysis, organized by primary language, core analytical capabilities, and optimal use context.
| Toolkit | Language | Core capabilities | Best suited for |
| Squidpy | Python | Neighborhood graph construction, spatially variable gene (SVG) analysis, image feature extraction, interactive visualization | Imaging-based and sequencing-based data; Scanpy/AnnData ecosystem integration |
| Seurat (v5) | R | Preprocessing, clustering, label transfer, spatial vignettes, multimodal integration | Spot-based Visium workflows and MERFISH analysis in R environments |
| Giotto | R | End-to-end analysis, spatial co-expression networks, cell interaction scoring, three-dimensional tissue support | Comprehensive single-framework R analysis across transcriptomic and proteomic data types |
| QuPath | Java/Groovy | Tissue image analysis, cell detection, region annotation, script automation | Image-centric workflows; integration with multiplexed imaging data |
The spatial analysis tools available for spatial bioinformatics divide primarily along language lines, with Python-based options centered on the Scanpy and AnnData framework and R-based options organized around Seurat and Bioconductor conventions. Most production-level workflows draw on both ecosystems, performing image processing and transcript-level operations in Python before shifting to R for visualization and statistical testing, or vice versa.
The Squidpy framework, introduced by Palla and colleagues in Nature Methods in 2022, provides a Python framework built on Scanpy and AnnData that integrates spatial graph construction, SVG analysis, image feature extraction from tissue micrographs, and interactive visualization into a consistent programming interface. The library accepts data from a broad range of platforms without reformatting, making it practical for laboratories that work across multiple instrument types.
The Giotto toolbox, introduced by Dries and colleagues in Genome Biology in 2021, provides a comprehensive R environment for spatial data analysis that spans normalization, spatial pattern detection, cell type annotation, cell interaction analysis, and interactive visualization. It is notable for supporting three-dimensional volumetric tissue datasets and for providing built-in spatial co-expression network analysis alongside standard spatial statistics.
Seurat (v5), maintained by the Satija laboratory, extended its established scRNA-seq analysis framework to spatial data, with dedicated vignettes for Visium and imaging-based platforms and deep integration with Azimuth for reference-based cell type annotation. Its label transfer and deconvolution functions are among the most commonly cited in published spatial transcriptomics analyses. A detailed comparison of these toolkits on feature coverage, ecosystem compatibility, and workflow integration patterns is available in the article on Squidpy, Giotto, and Seurat.
Integrating spatial data with single-cell references
Integrating spatial data with single-cell references means computationally combining spatially resolved expression measurements with paired single-cell RNA sequencing data to transfer high-resolution cell type information onto the tissue map. Spatial and single-cell RNA sequencing data are most powerful in combination: the spatial experiment provides tissue coordinates and intercellular proximity information, while the scRNA-seq experiment provides high-resolution molecular profiles from individual cells. Integration methods transfer the cellular resolution of scRNA-seq onto the spatial map, improving both cell type annotation accuracy and the downstream sensitivity of neighborhood analysis.
Mapping-based integration optimizes an alignment matrix between single-cell profiles and spatial positions. The Tangram method, published in Nature Methods in 2021 by Biancalani and colleagues, learns this alignment by minimizing the divergence between predicted and observed spatial gene expression using a deep-learning objective. Applied to the mouse brain, it reconstructed a genome-wide spatially integrated expression map at single-cell resolution across the visual and somatomotor areas by mapping single-nucleus RNA sequencing profiles onto MERFISH spatial coordinates. The approach is technology-agnostic and can propagate any modality measured in a single-cell experiment, including chromatin accessibility, onto the spatial frame using transcript expression as a scaffold.
Label transfer applies dimensionality reduction and nearest-neighbor classification to assign spatial cell profiles to reference cell types defined in scRNA-seq data. Implemented in both Seurat and Scanpy, it is computationally lighter than mapping-based integration and performs reliably when the single-cell reference is well-matched to the tissue under study. Performance degrades when reference coverage is incomplete, when gene panel overlap between the spatial and scRNA-seq datasets is limited, or when batch effects from differences in tissue dissociation protocol, library preparation, or sequencing chemistry introduce systematic offsets between modalities.
Critical practical factors for a successful integration workflow include confirming biological coherence between reference and query datasets (matched tissue type and experimental condition), assessing gene panel overlap before committing to an integration strategy, and validating integration outputs using marker gene spatial plots and known tissue landmarks. A structured treatment of these challenges and validation approaches is provided in the guide to integrating spatial data with single-cell references.
From spatial data analysis to biological discovery
Spatial transcriptomics analysis reaches its highest value when computational outputs are connected to precise biological questions: Where does a disease-associated cell population reside within tissue architecture? Which ligand-receptor interactions are active at a tumor-stromal interface? How do tissue neighborhood compositions change between healthy and diseased states? Answering these questions requires not only a rigorous and reproducible analysis pipeline but an analytical strategy formulated in conjunction with experimental design, before data generation begins.
Visualization underpins every stage of biological interpretation. Spatial feature plots overlaying gene expression values or cell type probability estimates onto tissue coordinates are the most intuitive first-pass representation. Beyond these, emerging tools for AI and machine learning for spatial data visualization are enabling new forms of representation, including learned tissue embeddings that encode continuous spatial variation, spatially coherent dimensionality reductions that preserve neighborhood structure, and generative models capable of synthesizing expression patterns at resolutions beyond the native platform capture geometry.
As spatial transcriptomics data analysis standards converge around interoperable formats, principally SpatialData, which provides a common on-disk representation for spatial experiments regardless of originating platform, the technical overhead of moving data between tools is decreasing. This convergence will make it progressively easier to apply newly published methods without reformatting or reimplementing data structures. Researchers navigating the full spatial biology landscape, from experimental method selection through data generation, analysis, and application, will find a comprehensive starting point in the spatial biology complete guide linked at the opening of this article.
This content includes text that has been created with the assistance of generative AI and has undergone editorial review before publishing. Technology Networks' AI policy can be found here.