- Spatial data preprocessing and quality control are essential stages in spatial omics and spatial transcriptomics analysis. Spatial technologies generate molecular measurements together with information about the physical locations of genes, transcripts, proteins, or metabolites within tissues. However, raw spatial datasets may contain technical noise, background signals, low-quality measurements, inaccurate spatial coordinates, tissue-processing artefacts, and incomplete molecular detection. Preprocessing transforms these raw measurements into structured datasets suitable for reliable biological interpretation, while quality control identifies technical problems and determines whether individual cells, spots, tissue regions, or molecular observations should be retained for downstream analysis.
- Spatial omics data can originate from sequencing-based, imaging-based, or other spatial molecular technologies. Sequencing-based platforms, such as 10x Genomics Visium, Visium HD, Slide-seq, and related methods, generally produce gene-expression counts associated with spatial capture locations or barcoded areas. Imaging-based platforms, including Xenium, CosMx, MERFISH, and seqFISH, generate images and spatial coordinates of detected RNA molecules, which may subsequently be assigned to individual cells. Spatial proteomics and imaging mass spectrometry produce different types of molecular measurements but also require image processing, signal correction, spatial alignment, and quality assessment. Therefore, preprocessing procedures must be adapted to the technology, tissue type, molecular target, and experimental design.
- The first stage of spatial data preprocessing involves organizing raw data and collecting experimental metadata. Important information includes the organism, tissue type, sample identity, experimental condition, biological replicate, tissue preparation method, platform, sequencing or imaging settings, probe panel, reference genome, and software versions. For sequencing-based spatial transcriptomics, raw data may include FASTQ files, sequencing quality reports, barcode information, spatial coordinates, tissue images, and feature-count matrices. Imaging-based experiments may additionally contain microscopy images, fluorescence channels, segmentation masks, detected molecular coordinates, and image-registration information. Proper metadata organization is important for reproducibility, sample comparison, and the identification of technical differences between experimental batches.
- For sequencing-based spatial transcriptomics, initial quality assessment commonly begins with sequencing read quality. Tools such as FastQC and MultiQC are used to evaluate base quality, sequence composition, adapter contamination, duplication levels, and other sequencing characteristics. Low-quality reads and adapter sequences may be removed using tools such as Cutadapt or fastp. Reads are then processed using platform-specific pipelines or aligned to an appropriate reference genome. For example, Space Ranger is used to process 10x Genomics Visium data, while other platforms may require specialized processing software. The resulting expression matrix contains gene counts associated with spatial locations, together with spatial coordinates and tissue-image information.
- An important component of sequencing-based preprocessing is the accurate identification of spatial barcodes and unique molecular identifiers (UMIs), where used by the technology. Spatial barcodes identify the capture location from which a transcript originated, while UMIs help distinguish original RNA molecules from amplification duplicates. Barcode correction, UMI processing, read alignment, transcript assignment, and gene counting are necessary to generate reliable expression measurements. Incorrect barcode assignment, sequencing errors, incomplete reference annotations, and low mapping rates can introduce inaccuracies into the spatial expression matrix. Quality reports should therefore be examined before downstream analysis.
- For imaging-based spatial transcriptomics, preprocessing begins with the assessment and correction of microscopy images. Images may contain uneven illumination, background fluorescence, optical noise, tissue autofluorescence, out-of-focus signals, and variations between imaging cycles. Background subtraction, illumination correction, denoising, image enhancement, and image registration are used to improve image quality. Image registration aligns images obtained from different channels, fields of view, or hybridization cycles so that the same tissue structures and molecular signals can be compared accurately. Software such as Fiji/ImageJ, CellProfiler, QuPath, OpenCV, and scikit-image can support these procedures. Platform-specific pipelines may also provide automated image processing and molecular signal detection.
- Transcript detection and decoding are particularly important for multiplexed imaging technologies such as MERFISH and seqFISH. Fluorescent signals are detected within microscopy images and interpreted according to the coding scheme used to identify individual RNA targets. Preprocessing may involve identifying fluorescent spots, correcting signal intensity, removing background signals, aligning imaging cycles, and correcting errors in molecular decoding. The resulting molecular observations contain transcript identities and spatial coordinates. Their reliability can be evaluated through detection rates, decoding efficiency, signal-to-background ratios, and the number of successfully identified transcripts.
- Cell segmentation is another major preprocessing step in single-cell-resolution spatial transcriptomics. It involves identifying individual cell boundaries and separating neighbouring cells within tissue images. Nuclear staining, membrane markers, cytoplasmic signals, and computational image-analysis algorithms can be used to define cellular regions. Tools such as Cellpose, StarDist, and CellProfiler support cell and nuclear segmentation, while QuPath and Fiji/ImageJ provide additional image-analysis capabilities. Once cell boundaries have been established, detected transcripts are assigned to individual cells according to their spatial coordinates. Incorrect segmentation may cause transcripts to be assigned to the wrong cells, especially in densely packed tissues, overlapping cell populations, or regions with poorly defined boundaries.
- After the initial processing steps, quality control is performed to assess the reliability of the spatial expression data. For spot-based spatial transcriptomics, important quality indicators include the number of detected genes per spot, total UMI counts, sequencing depth, the proportion of mitochondrial transcripts, mapping efficiency, and the number of spots containing reliable tissue-associated signals. Low gene counts or low UMI counts may indicate poor RNA capture, low sequencing depth, damaged tissue, or insufficient molecular detection. However, these measurements must be interpreted in relation to the tissue type and platform because different tissues naturally exhibit different levels of gene expression and RNA abundance.
- For spot-based datasets, mitochondrial transcript percentage can be calculated as follows:
- Mitochondrial percentage = (Mitochondrial transcript counts / Total transcript counts) × 100
- Mitochondrial transcript percentages can provide information about tissue quality and cellular integrity, but their interpretation differs between tissues and technologies. A high percentage may indicate damaged cells or poor RNA quality in some datasets, but it should not automatically be considered evidence of low-quality data. Similarly, mitochondrial content may be less informative in some spatial assays than in conventional single-cell RNA sequencing because the measurement unit may represent a mixture of cells rather than an individual cell.
- For imaging-based single-cell-resolution datasets, quality control includes the number of detected transcripts per cell, the number of genes detected, the proportion of background or unassigned transcripts, cell area, nuclear area, segmentation confidence, and signal intensity. Cells with unusually low transcript counts may represent damaged cells, incomplete segmentation, or insufficient detection. Extremely high transcript counts may indicate cell multiplets, incorrect segmentation, or overlapping cellular boundaries. However, large cells and cells with naturally high transcriptional activity can also contain more transcripts, so thresholds should be selected according to the biological context rather than applied mechanically.
- Spatial coordinates and tissue-image alignment must also be evaluated. Inaccurate spatial coordinates can place expression measurements in incorrect tissue regions and distort spatial relationships. For sequencing-based technologies, tissue images must be correctly aligned with capture locations. For imaging-based methods, molecular coordinates must correspond accurately to the tissue image and segmented cells. Researchers should examine spatial plots to identify misplaced spots, missing tissue regions, distorted images, and unusual spatial patterns. Image registration errors and incorrect tissue boundaries can affect cell assignment, spatial clustering, and neighbourhood analysis.
- Background contamination is another important quality-control concern. In sequencing-based methods, RNA released from damaged or lysed cells may become distributed across nearby capture areas, producing ambient RNA contamination. In imaging-based methods, nonspecific probe binding, autofluorescence, and background signals may generate false-positive molecular detections. Depending on the technology, background correction, signal filtering, and contamination estimation may be required. Computational tools such as SoupX and CellBender are mainly associated with ambient RNA correction in sequencing-based single-cell or related expression data, while image-based platforms may use their own background-detection and signal-filtering procedures. The appropriate correction method depends on the source and structure of the contamination.
- Batch effects can also influence spatial omics datasets. These effects may arise from differences in tissue collection, fixation, sectioning, staining, probe batches, reagent lots, sequencing runs, imaging equipment, operators, and experimental laboratories. Batch effects may create apparent differences between samples that are technical rather than biological. Researchers should compare quality metrics and spatial expression patterns across samples and experimental batches. Methods such as ComBat, Harmony, fastMNN, Seurat integration, and scVI may be useful for appropriate downstream data integration, depending on the data type. However, batch correction should not be used to conceal genuine biological differences or remove meaningful tissue-specific variation.
- Several software packages support spatial data preprocessing and quality control. Space Ranger is widely used for processing 10x Genomics Visium data, while Xenium Ranger supports processing of Xenium datasets. Seurat provides tools for spatial data handling, visualization, quality assessment, and integration with single-cell RNA sequencing. Scanpy supports expression-matrix processing, normalization, dimensionality reduction, and quality-control analysis. Squidpy provides spatial analysis functions, including neighbourhood analysis and spatial statistics. Giotto offers an integrated framework for spatial transcriptomics analysis, while SpatialExperiment provides a structured data framework within the Bioconductor ecosystem. For image processing and segmentation, Fiji/ImageJ, CellProfiler, QuPath, Cellpose, and StarDist are useful complementary tools.
- A typical spatial data preprocessing workflow begins with raw sequencing or imaging data and proceeds through data organization, technical quality assessment, read or image processing, barcode and transcript detection, spatial coordinate assignment, cell or spot identification, and quality filtering. After generating a cleaned expression matrix, researchers inspect quality metrics, spatial distributions, and tissue images. Normalization and other downstream processing steps are then applied according to the technology and research objective. The processed data can subsequently be used for spatial clustering, cell-type identification, spatially variable gene detection, cell–cell communication analysis, tissue-region characterization, and integration with other omics datasets.
- The choice of quality-control thresholds is particularly important. Extremely strict filtering may remove genuine biological populations, including rare cell types, low-RNA cells, and cells with naturally unusual expression profiles. Very permissive filtering may retain damaged cells, unreliable spots, background signals, or incorrectly assigned transcripts. Thresholds should therefore be selected using data distributions, visual inspection, technical information, and biological knowledge. Researchers should also document the filtering criteria and report how many spots, cells, genes, or molecular observations were removed at each stage. When possible, sensitivity analyses using alternative thresholds can help determine whether the biological conclusions are robust.
- Spatial data preprocessing and quality control have important applications in cancer research, developmental biology, neuroscience, immunology, infectious disease studies, and animal genomics. In livestock research, high-quality spatial datasets can help investigate gene-expression patterns in skeletal muscle, mammary glands, reproductive tissues, liver, and immune organs. They may reveal tissue-specific cellular populations and molecular pathways associated with growth, meat quality, milk production, fertility, disease resistance, and environmental adaptation. Reliable preprocessing is particularly important when comparing tissues from different breeds, developmental stages, production conditions, or disease states.
- Overall, spatial data preprocessing and quality control establish the foundation for reliable spatial omics analysis. They ensure that molecular measurements are accurately associated with their spatial locations and that technical artefacts are identified before biological interpretation. Combining sequencing quality assessment, image processing, transcript detection, cell segmentation, spatial alignment, contamination assessment, and systematic quality filtering improves the reliability and reproducibility of spatial datasets. As spatial transcriptomics and other spatial omics technologies continue to develop, standardized preprocessing workflows and transparent quality-control practices will become increasingly important for understanding the molecular organization of cells and tissues.