No retraction, correction or concern found when last checked on Oct 24, 2026.
SpatialExperiment: infrastructure for spatially-resolved transcriptomics data in R using Bioconductor
Dario Righelli, Lukas M Weber, Helena L Crowell and 6 more
Bioinformatics · 2022 · CC BY
doi:10.1093/bioinformatics/btac299
Abstract
Summary. SpatialExperiment is a new data infrastructure for storing and accessing spatially-resolved transcriptomics data, implemented within the R/Bioconductor framework, which provides advantages of modularity, interoperability, standardized operations and comprehensive documentation. Here, we demonstrate the structure and user interface with examples from the 10x Genomics Visium and seqFISH platforms, and provide access to example datasets and visualization tools in the STexampleData, TENxVisiumData and ggspavis packages.
Availability and implementation. The SpatialExperiment, STexampleData, TENxVisiumData and ggspavis packages are available from Bioconductor. The package versions described in this manuscript are available in Bioconductor version 3.15 onwards.
Supplementary information. Supplementary data are available at Bioinformatics online.
Full text
From PubMed Central, U.S. National Library of Medicine, as current on Oct 24, 2026. Paragraph numbers are ours, so an answer can point at one.
1 Introduction
Spatially-resolved transcriptomics (SRT) refers to a new set of high-throughput technologies, which measure up to transcriptome-wide gene expression along with the spatial coordinates of the measurements. Technological platforms differ in terms of the number of measured genes (from hundreds to full transcriptome) and spatial resolution (from multiple cells per coordinate to approximately single-cell to sub-cellular). Examples of SRT platforms include Spatial Transcriptomics, 10x Genomics Visium, Slide-seq, Slide-seqV2, sci-Space, seqFISH, seqFISH+, osmFISH and MERFISH. These can be classified into spot-based and molecule-based platforms. Spot-based platforms measure transcriptome-wide gene expression at a series of spatial coordinates (spots) on a tissue slide (Spatial Transcriptomics, 10x Genomics Visium, Slide-seq, Slide-seqV2 and sci-Space), while molecule-based platforms detect large sets of distinct individual messenger RNA (mRNA) molecules in situ at up to sub-cellular resolution (seqFISH, seqFISH+, osmFISH and MERFISH). SRT platforms have been applied to investigate spatial patterns of gene expression in a variety of biological systems, including the human brain, mouse brain, cancer and mouse embryogenesis. By combining molecular and spatial information, these platforms promise to continue to generate new insights about biological processes that manifest with spatial specificity within tissues.
However, to effectively analyze these data, specialized and robust data infrastructures are required, to facilitate storage, retrieval, subsetting and interfacing with downstream tools. Here, we describe SpatialExperiment, a new data infrastructure developed within the R/Bioconductor framework, which extends the popular SingleCellExperiment class for single-cell RNA sequencing (scRNA-seq) data to the spatial context, with observations taking place at the level of spots or molecules instead of cells. Several recent studies have reused or extended existing single-cell infrastructure to store additional spatial information. In addition, several comprehensive analysis workflows have been developed using modified single-cell infrastructure adapted for spatial data, including Seurat, Giotto and Squidpy. However, while each of these workflows enables powerful analyses, it remains difficult for users to combine elements in a modular way, since each workflow relies on a separate infrastructure. There does not yet exist a common, standardized infrastructure for storing and accessing SRT data in R, which would allow users to easily build workflows combining methods and software developed by different groups. A well-designed independent data infrastructure simplifies the work of various users, including developers of downstream analysis methods who can reuse the structure to store inputs and outputs, and analysts who can rely on the structure to connect packages from different developers into analysis pipelines. By working within the Bioconductor framework, we take advantage of long-standing Bioconductor principles of modularity, interoperability, continuous testing and comprehensive documentation. Furthermore, we can ensure compatibility with existing analysis packages designed for the SingleCellExperiment structure for single-cell data, providing a robust, flexible and user-friendly resource for the research community. In addition to the SpatialExperiment package, we provide the STexampleData and TENxVisiumData packages (example datasets) and ggspavis package (visualization tools) for use in examples, tutorials, demonstrations and teaching.
2 Results
The SpatialExperiment package provides access to the core data infrastructure (referred to as a class), as well as functions to create, modify and access instances of the class (objects). Objects contain the following components adapted from the existing SingleCellExperiment class: (i) assays, tables of measurement values such as raw and transformed transcript counts (note that within the Bioconductor framework, rows usually correspond to features and columns to observations); (ii) rowData, additional information (metadata) describing the features (e.g. gene IDs and names); (iii) colData, metadata describing the observations (e.g. barcode IDs or cell IDs); and (iv) reducedDims, reduced dimension representations (e.g. principal component analysis) of the measurements. SpatialExperiment objects also contain the following further components to store spatial information: (v) additional metadata stored in colData describing spatial characteristics of the spatial coordinates (spots) or cells (e.g. indicators for whether spots are located within the region overlapping with tissue); (vi) spatialCoords, spatial coordinates associated with each observation (e.g. x and y coordinates on the tissue slide); and, (vii) imgData, image files (e.g. histology images) and information related to the images (e.g. resolution in pixels) (Fig. 1).
Accessor and replacement functions allow each of these components to be extracted or modified. Since SpatialExperiment extends SingleCellExperiment, methods developed for single-cell analyses [e.g. preprocessing and normalization methods from scater, downstream methods from scran and visualization tools from iSEE] can be applied to SpatialExperiment objects, treating spots as single cells. Spatial coordinates are stored in spatialCoords as a numeric matrix, allowing these to be provided easily to downstream spatial analysis packages in R outside Bioconductor [e.g. packages from geostatistics such as sp and sf], consistent with reducedDims in SingleCellExperiment. For spot-based data, assays contains a table named counts containing the gene counts, while for molecule-based data, assays may contain two tables named counts and molecules containing total gene counts per cell as well as molecule-level information such as spatial coordinates per molecule [formatted as a BumpyMatrix]. For datasets that are too large to store in-memory, SpatialExperiment can reuse existing Bioconductor infrastructure for sparse matrices and on-disk data representations through the DelayedArray framework. Image information is stored in imgData as a table containing sample IDs, image IDs, any other information such as scaling factors, and the underlying image data. The image data can be stored as either a fully realized in-memory object (for small images), a path to a local file that is loaded into memory on demand (for large images) or a URL to a remotely hosted image that is retrieved on demand. SpatialExperiment objects can be created with a general constructor function, SpatialExperiment or alternatively with a dedicated constructor function for the 10x Genomics Visium platform, read10xVisium, which creates an object from the raw input files from the 10x Genomics Visium Space Ranger software. For Visium data, colData includes the columns in_tissue, array_row and array_col. Measurements from multiple biological samples can be stored within a single object, and linked across the components by providing unique sample IDs. In addition, we provide the associated data packages STexampleData (example datasets from several platforms) and TENxVisiumData (publicly available Visium datasets provided by 10x Genomics), and the ggspavis package providing visualization functions designed for SpatialExperiment objects (Supplementary Fig. S1 and Supplementary Tables S1 and S2).
3 Discussion
Standardized data infrastructure for scRNA-seq data [e.g. SingleCellExperiment within the R/Bioconductor framework] has greatly streamlined the work of data analysts and downstream method developers. For example, relying on common formats for inputs and outputs from individual packages allows users to connect packages into complete analysis pipelines, and operations such as subsetting by row (gene) or column (barcode or cell) across the entire object helps avoid errors. For single-cell data, this has enabled the development of comprehensive workflows and tutorials, which are an invaluable resource for new users. Here, we provide a new data infrastructure for SRT data, extending the existing SingleCellExperiment class within the Bioconductor framework. In addition, we provide associated packages containing example datasets (STexampleData and TENxVisiumData) and visualization functions (ggspavis), for use in examples, tutorials, demonstrations and teaching.
Existing alternative infrastructure for SRT data includes object classes provided in the Seurat and Giotto packages in R, and Squidpy/AnnData in Python, which provide similar underlying functionality such as storing annotated tables of measurement values and related spatial and image information. Compared to these alternatives, a key advantage of SpatialExperiment is that it has been developed independently of any individual analysis workflow and is compatible with any downstream analysis packages that use the SpatialExperiment or SingleCellExperiment class within Bioconductor. This allows analysts to easily build customized, modular workflows consisting of packages developed by various research groups, including the latest methods (which may not yet have been integrated into published workflows) as well as any of the wide variety of methods for single-cell data that have been released through Bioconductor.
SRT technologies are still in their infancy, and the coming years are likely to see ongoing development of existing platforms as well as the emergence of novel experimental approaches. SpatialExperiment is ideally positioned to be extended to accommodate data from new platforms in the future, e.g. through extensions of the more general underlying SummarizedExperiment or by integrating with MultiAssayExperiment to store measurements from further assay types (transcriptomics, proteomics or spatial immunofluorescence, or epigenomics) or multiple assays from the same spatial coordinates. For example, the SingleCellMultiModal package stores MultiAssayExperiment objects containing scRNA-seq and SRT data as SingleCellExperiment and SpatialExperiment objects, respectively. Three-dimensional spatial data or data from multiple timepoints could be accommodated within SpatialExperiment by storing additional spatial or temporal coordinates. Datasets that are too large to store in-memory can be stored using existing Bioconductor infrastructure for sparse matrices and on-disk data representations through the DelayedArray framework. The ability to store image files within the objects (in-memory, locally or remotely) will assist with correctly keeping track of images in datasets with large numbers of samples, e.g. from consortium efforts. Interoperability between SpatialExperiment and other data formats (e.g. in Python) can also be ensured through the use of existing conversion packages such as zellkonverter and LoomExperiment. SpatialExperiment provides the research community with a robust, flexible and extendable core data infrastructure for SRT data, assisting both method developers and analysts to generate reliable and reproducible biological insights from these platforms.
References 42
- 1.
10x Genomics. (2020 ) Space Ranger: Spatial Gene Expression. https://support.10xgenomics.com/spatial-gene-expression/software/pipelines/latest/what-is-space-ranger (2 May 2022, date last accessed).
Not in our library
- 2.
10x Genomics. (2021a ) 10x Genomics Visium Spatial Gene Expression Solution (Website). https://www.10xgenomics.com/products/spatial-gene-expression (2 May 2022, date last accessed).
Not in our library
- 3.
10x Genomics. (2021b ) Mouse Brain Section Coronal (Website). https://www.10xgenomics.com/resources/datasets/mouse-brain-section-coronal-1-standard-1-1-0 (2 May 2022, date last accessed).
Not in our library
- 4.
10x Genomics. (2021c ) Spatial Gene Expression Datasets. https://support.10xgenomics.com/spatial-Gene-Expression/datasets (2 May 2022, date last accessed).
Not in our library
- 5.
Amezquita R.A. et al (2020 ) Orchestrating single-cell analysis with Bioconductor. Nat. Methods, 17, 137–145.
Not in our library10.1038/s41592-019-0654-x
- 6.
- 7.
Cable D.M. et al (2021 ) Robust decomposition of cell type mixtures in spatial transcriptomics. Nat. Biotechnol., 1, 1.
Not in our library10.1038/s41587-021-00830-w
- 8.
Chen K.H. et al (2015 ) Spatially resolved, highly multiplexed RNA profiling in single cells. Science, 348, aaa6090.
Not in our library10.1126/science.aaa6090
- 9.
Codeluppi S. et al (2018 ) Spatial organization of the somatosensory cortex revealed by osmFISH. Nat. Methods, 15, 932–935.
Not in our library10.1038/s41592-018-0175-z
- 10.
- 11.
Eckenrode K.B. et al (2021 ) Curated Single Cell Multimodal Landmark Datasets for R/Bioconductor. bioRxiv (preprint).
Not in our library10.1371/journal.pcbi.1011324
- 12.
Eng C.-H.L. et al (2019 ) Transcriptome-scale super-resolved imaging in tissues by RNA seqFISH+. Nature, 568, 235–239.
Not in our library10.1038/s41586-019-1049-y
- 13.
- 14.
Huber W. et al (2015 ) Orchestrating high-throughput genomic analysis with Bioconductor. Nat. Methods, 12, 115–121.
Not in our library10.1038/nmeth.3252
- 15.
- 16.
- 17.
Lubeck E. et al (2014 ) Single-cell in situ RNA profiling by sequential hybridization. Nat. Methods, 11, 360–361.
Not in our library10.1038/nmeth.2892
- 18.
Lun A.T.L. (2021 ) BumpyMatrix; Version 1.2.0. R/Bioconductor Package..
Not in our library10.18129/b9.bioc.bumpymatrix
- 19.
- 20.
Lun A.T.L. et al (2021 ) Orchestrating Single-Cell Analysis with Bioconductor (Online Book). https://bioconductor.org/books/release/OSCA/
Not in our library
- 21.
Maynard K.R. et al (2021 ) Transcriptome-scale spatial gene expression in the human dorsolateral prefrontal cortex. Nat. Neurosci., 24, 425–436.
Not in our library10.1038/s41593-020-00787-0
- 22.
- 23.
Moffitt J.R. et al (2016 ) High-throughput single-cell gene-expression profiling with multiplexed error-robust fluorescence in situ hybridization. Proc. Natl. Acad. Sci. USA, 113, 11046–11051.
Not in our library10.1073/pnas.1612826113
- 24.
Morgan M., Van Twisk D. (2021 ) LoomExperiment; Version 1.12.0. R/Bioconductor Package..
Not in our library10.18129/b9.bioc.loomexperiment
- 25.
Morgan M. et al (2021 ) SummarizedExperiment: SummarizedExperiment Container; R Package Version 1.24.0. R/Bioconductor Package..
Not in our library10.18129/b9.bioc.summarizedexperiment
- 26.
Ortiz C. et al (2020 ) Molecular atlas of the adult mouse brain. Sci. Adv., 6, eabb3446.
Not in our library10.1126/sciadv.abb3446
- 27.
Pagès H. et al (2021 ) DelayedArray: A Unified Framework for Working Transparently with On-disk and In-memory Array-like Datasets; Version 0.20.0. R/Bioconductor Package..
Not in our library10.18129/b9.bioc.delayedarray
- 28.
- 29.
- 30.
Pebesma E. (2018 ) Simple features for R: standardized support for spatial vector data. R J., 10, 439–446.
Not in our library
- 31.
Pebesma E.J., Bivand R.S. (2005 ) Classes and methods for spatial data in R. R News, 5, 9–13.
Not in our library
- 32.
Ramos M. et al (2017 ) Software for the integration of multi-omics experiments in Bioconductor. Cancer Res., 77, e39–e42.
Not in our library10.1158/0008-5472.can-17-0344
- 33.
Rodriques S.G. et al (2019 ) Slide-seq: a scalable technology for measuring genome-wide expression at high spatial resolution. Science, 363, 1463–1467.
Not in our library10.1126/science.aaw1219
- 34.
- 35.
Shah S. et al (2016 ) In situ transcription profiling of single cells reveals spatial organization of cells in the mouse hippocampus. Neuron, 92, 342–357.
Not in our library10.1016/j.neuron.2016.10.001
- 36.
Srivatsan S.R. et al (2021 ) Embryo-scale, single-cell spatial transcriptomics. Science, 373, 111–117.
Not in our library10.1126/science.abb9536
- 37.
Ståhl P.L. et al (2016 ) Visualization and analysis of gene expression in tissue sections by spatial transcriptomics. Science, 353, 78–82.
Not in our library10.1126/science.aaf2403
- 38.
Stickels R.R. et al (2021 ) Highly sensitive spatial transcriptomics at near-cellular resolution with slide-seqV2. Nat. Biotechnol., 39, 313–319.
Not in our library10.1038/s41587-020-0739-1
- 39.
Virshup I. et al (2021 ) anndata: Annotated data. bioRxiv (preprint).
Not in our library
- 40.
Wang X. et al (2018 ) Three-dimensional intact-tissue sequencing of single-cell transcriptional states. Science, 361, 6400.
Not in our library10.1126/science.aat5691
Cited by papers we hold 6
- SpatialData: an open and universal data framework for spatial omics · 2024No notice
- nnSVG for the scalable identification of spatially variable genes using nearest-neighbor Gaussian processes · 2023No notice
- Spatial analysis with SPIAT and spaSim to characterize and simulate tissue microenvironments · 2023No notice
- Squidpy: a scalable framework for spatial omics analysis · 2022No notice
- spatialLIBD: an R/Bioconductor package to visualize spatially-resolved transcriptomics data · 2022No notice
- Advances in spatial transcriptomic data analysis · 2021No notice
Reads
Read by people on this page
None yet.
Checked or read by AI through naulon
None yet.
A person counts once a day per paper. We keep no cookie and no address: a reader is a hash that changes every day. Any month under five reads shows no number.
Are you an author?
Is this your paper?
Claim it to add your note and be paid when agents cite it. Free.