Spatial Transcriptomics Data Analysis Workflow: From Sequencing Reads to Biological Interpretation
Figure 1: The spatial transcriptomics data analysis workflow — a structured progression from raw sequencing data to biological interpretation, with key decision points at each stage.
Generating spatial transcriptomics data is increasingly straightforward. Making biological sense of it — identifying which cell types occupy which tissue regions, which genes vary spatially, which signaling pathways operate in which microenvironments, and which patterns are real rather than noise — remains the harder half of any spatial project. This article walks through the full analysis workflow from raw sequencing reads to interpretable biological results: preprocessing and quality control, cell type deconvolution and annotation, spatially variable gene detection, spatial domain and niche identification, cell-cell communication analysis, and functional interpretation. For each stage, it identifies the key methodological choices, the tools researchers are most likely to encounter, and the questions that determine which analytical path to take.
Starting With Raw Spatial Sequencing Data
The analysis pipeline begins before the first gene is counted. Raw spatial transcriptomics data arrives in platform-specific formats — FASTQ files with spatial barcode indices for sequencing-based methods, or image stacks with transcript coordinates for imaging-based methods. The preprocessing goal is the same across platforms: produce a quality-controlled count matrix in which each row is a gene, each column is a spatial location, and each value is a reliable estimate of transcript abundance at that position.
Alignment and counting. For sequencing-based platforms such as Visium and Stereo-seq, Space Ranger and SAW (Stereo-seq Analysis Workflow) handle read alignment, spatial barcode demultiplexing, and tissue-spot assignment. Key QC metrics at this stage include the fraction of reads mapping to the transcriptome, the fraction of valid spatial barcodes recovered, and the saturation of library complexity. For imaging-based platforms such as Xenium, CosMx, and MERFISH, the equivalent preprocessing step is transcript decoding — assigning each fluorescent signal to a specific gene — followed by cell segmentation to assign transcripts to individual cells.
Cell segmentation for single-cell-resolution data. The shift from spot-based to cell-segmented analysis is one of the most consequential developments in spatial transcriptomics preprocessing. Tools such as CellPose, StarDist, and BIDCell use deep learning to delineate cell boundaries from nuclear and membrane stains. Segmentation quality directly determines downstream data quality: under-segmentation merges signals from adjacent cells, while over-segmentation splits single cells into artificial fragments. A 2025 benchmarking study of imaging-based platforms on FFPE tissues found that cell segmentation accuracy was a larger source of cross-platform variability than transcript detection sensitivity.
Filtering and normalization. After counting, standard single-cell QC filters apply: remove spots or cells with very low gene counts, very high mitochondrial read fractions, or anomalously low complexity. Normalization method choice matters for spatial data in ways it does not for dissociated single-cell data: SCTransform and Pearson residuals preserve biological heterogeneity better than log-normalization when spatial neighborhoods contain mixtures of cell types with different total RNA content.
The spatial transcriptomics data analysis introduction covers preprocessing fundamentals. For researchers outsourcing this stage, CD Genomics spatial transcriptomics data analysis provides end-to-end processing from raw data through biological interpretation.
Cell Type Mapping and Deconvolution
Knowing which cells are present at each tissue location is the foundation of spatial transcriptomics interpretation. The analytical strategy depends on spatial resolution.
Deconvolution for spot-based data. Visium spots (55 um diameter) and even Visium HD 8-um bins capture transcripts from multiple cells. Deconvolution methods use a single-cell RNA-seq reference to estimate the proportion of each cell type at each spatial location. cell2location, a Bayesian hierarchical model published in Nature Biotechnology, estimates absolute cell-type abundances per spot by borrowing statistical strength across spatial neighborhoods. RCTD (Robust Cell Type Decomposition) uses a supervised learning approach that is faster but less sensitive to rare cell types. Tangram and SpaGE use deep learning to map single-cell profiles onto spatial coordinates. A practical rule: if your tissue contains cell types absent from the reference — a common scenario in tumors and diseased tissues — cell2location's probabilistic framework handles this uncertainty more gracefully than deterministic methods.
Direct annotation for single-cell-resolution data. When each spatial location corresponds to a single cell — as with Xenium, CosMx, and cell-segmented Visium HD — cell types can be assigned directly from the spatial expression matrix using the same annotation tools developed for scRNA-seq. Seurat's label transfer and Azimuth's neural-network-based classifiers map cell types onto spatial data, though the accuracy depends on how well the reference captures the biology of the tissue under study.
Validation. Regardless of the mapping method, validate computationally assigned cell types against known tissue architecture. If the liver zonation markers CYP1A2 and GLUL appear in anatomically impossible locations, the deconvolution or annotation has failed — regardless of what confidence scores report.
Finding Spatial Patterns That Matter
After establishing which cell types are present where, the next analytical stage identifies genes whose expression varies systematically across tissue space — spatially variable genes, or SVGs. Unlike conventional differential expression, which compares predefined groups, SVG detection asks an open-ended question: which genes show non-random spatial organization?
Gaussian process methods. SpatialDE, the foundational method published in Nature Methods, uses Gaussian process regression to decompose each gene's expression variance into spatial and non-spatial components. Genes with a high fraction of spatial variance — meaning their expression pattern is better explained by position than by random noise — are flagged as SVGs. SpatialDE also classifies genes by pattern type: linear gradients, periodic patterns, or localized hotspots.
Non-parametric alternatives. SPARK-X and trendsceek use rank-based and kernel-based approaches that make fewer distributional assumptions and scale to large datasets. These methods are faster than SpatialDE and often identify a partially overlapping gene set. A practical recommendation: run two SVG methods with different statistical foundations and focus biological interpretation on genes identified by both.
What SVGs do and do not tell you. An SVG is a statistical statement that a gene's spatial pattern is unlikely to arise by chance — not a biological statement that the pattern is functionally important. Many SVGs reflect cell-type distribution rather than spatially regulated gene expression. Distinguishing cell-type-driven spatial variation from position-dependent regulation requires integrating SVG results with cell-type deconvolution: genes that remain spatially variable after accounting for cell-type composition are candidates for true spatial regulation.
Figure 2: Three levels of spatial organization — expression clusters, spatial domains, and tissue niches — each requiring different analytical methods and providing different biological insights.
Spatial Domains, Clusters, and Tissue Niches
The most recognizable output of a spatial transcriptomics analysis is a spatial domain map: a tissue section partitioned into regions with coherent molecular identities. But not all partitions are equally meaningful.
Spatial domains vs. expression clusters. Expression-based clustering (Leiden, Louvain) groups spots or cells by transcriptional similarity regardless of spatial position. A cluster may scatter across the tissue in disconnected islands. Spatial domain methods — BayesSpace, SpaGCN, STAGATE, BANKSY — enforce spatial continuity, grouping locations that are both transcriptionally similar and physically adjacent. The choice between them depends on the biological question: if you are asking "which cell types exist in this tissue," use expression clustering; if you are asking "which anatomical compartments does this tissue contain," use spatial domain detection.
A 2025 benchmarking study of 14 spatial clustering methods across approximately 600 datasets from 10 technologies found that no single method performed best in all scenarios. STAGATE excelled in tissues with high spatial continuity such as brain; PRECAST performed better in tissues with low spatial continuity such as liver. The study's practical recommendation: method choice should be guided by tissue architecture, not by overall benchmark scores.
From domains to niches. A tissue niche is a spatially coherent microenvironment defined not just by similar gene expression but by coordinated function — specific cell-type compositions, active signaling pathways, and histological features that recur across tissue sections. Tools such as CellCharter, NeST, and GASTON build on domain detection to identify functionally interpretable niches. Niche analysis is particularly powerful in cancer, where tumor-immune-stroma interfaces define therapeutic vulnerabilities that are invisible to bulk or dissociated single-cell analysis.
For researchers integrating scRNA-seq references into their spatial analysis, the scRNA-seq and spatial transcriptomics integration guide covers deconvolution strategies and cell-type mapping workflows.
Cell Communication, Pathways, and Functional Interpretation
Spatial transcriptomics uniquely enables the analysis of cell-cell communication in its native tissue context — distinguishing signaling events that occur between adjacent cells from those that could only occur through long-range mechanisms. This is where spatial data moves beyond descriptive cell-type mapping to mechanistic insight.
Ligand-receptor analysis in space. Tools such as CellChat, COMMOT, and NicheCompass infer cell-cell communication by identifying co-expression of ligand-receptor pairs in neighboring cells or spatial regions. The spatial constraint is critical: in dissociated single-cell data, any two cell types can be inferred to communicate if they co-express a ligand-receptor pair. In spatial data, communication is only inferred when the expressing cells are within signaling distance — a far more stringent and biologically plausible filter.
Spatially aware pathway analysis. Standard pathway enrichment tests whether a gene set is over-represented among differentially expressed genes — a spatially naive approach that ignores where in the tissue pathway activity occurs. Spatial gene set enrichment methods overlay pathway activity scores onto tissue coordinates, revealing regionalized pathway activation that bulk enrichment misses. For example, a pathway may appear equally active in two tissue regions when averaged across all cells, but spatial analysis reveals that it is driven by a small subpopulation concentrated at a specific anatomical boundary.
From analysis to deliverable. The output of a complete spatial transcriptomics analysis is not a list of differentially expressed genes — it is a set of spatially resolved biological findings: cell-type maps, spatial domain annotations, SVG catalogs, cell-cell communication networks, and pathway activity landscapes. Each finding should be accompanied by effect sizes, confidence measures, and a clear statement of the analytical choices that produced it.
Figure 3: Representative spatial transcriptomics analysis outputs — from cell-type maps and spatial feature plots to domain annotations and communication networks.
Reproducible Workflows and Deliverables
The difference between an analysis that can be defended in peer review and one that cannot often comes down to infrastructure, not analytical sophistication.
Framework selection. Most spatial transcriptomics analyses are conducted in R or Python. The table below compares the major analysis frameworks.
| Framework | Language | Key Strengths | Best For |
|---|---|---|---|
| Seurat | R | End-to-end spatial workflow; strong visualization; scRNA-seq integration; Azimuth cell typing | Complete analysis pipelines; teams with R expertise |
| Squidpy | Python | Spatial statistics (Moran's I, Ripley's L); neighborhood enrichment; Napari integration | Spatial statistics; ML integration; Python-centric labs |
| SpatialData | Cross-platform | Unified multi-modal format; coordinate alignment; lazy loading for large datasets | Multi-modal projects; cross-platform teams |
| Giotto | R | Comprehensive spatial statistics; flexible data structures; supports most ST platforms | Spatial statistics in R; platform-agnostic workflows |
Seurat provides the most comprehensive end-to-end spatial workflow with strong visualization and cell-type annotation support. Squidpy integrates spatial statistics with Python's machine learning ecosystem. SpatialData, a 2025 framework published in Nature Methods, provides a unified data format that supports both R and Python workflows and handles multi-modal spatial data with aligned coordinate systems.
Containerization and version control. Docker or Singularity containers freeze the computational environment — R version, package versions, system libraries — so that an analysis run today produces the same results next year. Git tracks every change to analysis scripts. Together, they transform a one-off exploration into a reproducible workflow. A 2025 review of best practices in spatial transcriptomics emphasized that containerization and version control are no longer optional for publication-grade spatial analysis.
Deliverables for service-based projects. Researchers working with a spatial transcriptomics service provider should expect a defined set of deliverables: QC reports with molecular barcode and gene count distributions per spatial location, normalized count matrices in standard formats, cell-type proportion or annotation maps, SVG lists with spatial variance statistics, spatial domain or niche maps, cell-cell communication networks, and publication-ready figures. The CD Genomics spatial transcriptomics services include data analysis as an integrated component of the experimental workflow. For platform-specific analysis considerations, see the spatial transcriptomics platform comparison guide. For projects using Stereo-seq, Stereo-seq spatial transcriptomics includes integrated analysis from raw data to biological deliverables. For study planning that precedes data generation, the spatial transcriptomics project design guide covers biological question definition, replicate strategy, and sample planning.
Spatial transcriptomics data analysis requires careful selection of preprocessing methods, cell-type annotation strategies, spatial statistics, and biological interpretation workflows. If you need help designing an analysis strategy or interpreting your spatial transcriptomics data, CD Genomics experts can assist with customized bioinformatics solutions based on your research goals and data type.
FAQ
Q: Should I use R or Python for spatial transcriptomics data analysis?
A: Both ecosystems are mature and well-supported. Seurat (R) offers the most comprehensive end-to-end workflow with strong visualization and integration with single-cell references. Squidpy (Python) provides spatial statistics — Moran's I, Ripley's L, neighborhood enrichment — that are not as accessible in R, and integrates naturally with Python-based machine learning tools. Many labs use both: R for preprocessing and cell-type mapping, Python for spatial statistics and custom analysis. SpatialData provides a cross-platform framework that supports workflows spanning both languages.
Q: How do I know if my spatial domains are real or just noise?
A: Three lines of evidence support a spatial domain: stability across parameter settings (different clustering resolutions produce similar boundaries), recurrence across replicate sections, and correspondence with independent information such as H&E morphology or known marker gene expression. A domain that appears only at one resolution, in one section, and without histological correlation warrants skepticism regardless of its statistical significance.
Q: Which deconvolution method should I use for my Visium data?
A: cell2location provides the most rigorous probabilistic framework and handles rare cell types well, but requires more computational resources. RCTD is faster and performs well for major cell types; it is a practical choice for initial exploration. Tangram and SPOTlight offer intermediate trade-offs. If your tissue contains cell types without a reference profile — common in tumors and diseased samples — use a method that quantifies uncertainty (cell2location or RCTD) rather than one that forces every spot into a predefined composition.
Q: What is the minimum number of replicate sections for a spatial transcriptomics study?
A: At least three biological replicates per condition is the standard for publication-grade spatial transcriptomics, consistent with single-cell and bulk RNA-seq norms. Technical replicates — adjacent sections from the same block — are valuable for assessing within-sample variability but do not substitute for biological replicates. For exploratory or pilot studies, two biological replicates can identify major spatial patterns but will not support statistically rigorous differential spatial analysis.
Q: How do I report spatial transcriptomics analysis methods for publication?
A: The minimum reporting standard includes: preprocessing pipeline and version, normalization method, gene filtering thresholds, cell-type mapping method and reference dataset (with version), SVG detection method, spatial domain or clustering method and parameters, and any batch correction strategy. If deconvolution was used, report the reference scRNA-seq dataset, the deconvolution method and version, and how cell-type proportions were validated. Containerization information (Docker image or Singularity recipe) and code repository access should be included.
References
- Chen R, Yao Y, Qian J, Peng X, Shao X, Fan X. A comprehensive benchmarking for spatially resolved transcriptomics clustering methods across variable technologies, organs, and replicates. iMeta. 2025;4:e70084. doi:10.1002/imt2.70084
- Kang L, Zhang Q, Qian F, Liang J, Wu X. Benchmarking computational methods for detecting spatial domains and domain-specific spatially variable genes from spatial transcriptomics data. Nucleic Acids Research. 2025;53(7):gkaf303. doi:10.1093/nar/gkaf303
- Kleshchevnikov V, Shmatko A, Dann E, et al. Cell2location maps fine-grained cell types in spatial transcriptomics. Nature Biotechnology. 2022;40(5):661-671. doi:10.1038/s41587-021-01139-4
- Marconato L, Palla G, Yamauchi KA, et al. SpatialData: an open and universal data framework for spatial omics. Nature Methods. 2025;22(1):58-62. doi:10.1038/s41592-024-02212-x
- Palla G, Spitzer H, Klein M, et al. Squidpy: a scalable framework for spatial omics analysis. Nature Methods. 2022;19:171-178. doi:10.1038/s41592-021-01358-2
The information provided in this article is for research use only and is not intended for use in diagnostic or therapeutic procedures. CD Genomics provides sequencing and bioinformatics services for research purposes. Researchers should consult the appropriate regulatory guidelines for their specific applications.