6. Spatial Transcriptomics & Cellular Spot Deconvolution
Mapping spatially resolved gene expression in intact histological tissue sections, identifying spatially variable genes via Moran's I, and deconvolving multi-cell spots with scRNA-seq reference atlases using RCTD.
| Metric / Requirement | Specification | Target Configuration |
|---|---|---|
| Core Engine / Framework | Space Ranger + Seurat Spatial / Giotto + RCTD | Nextflow / Snakemake Compatible |
| Benchmark Runtime | ~3 – 5 hours per slide | 16 CPU cores / 32 GB RAM |
| Standard Container | 10xgenomics/spaceranger:3.0.0 | Docker • Singularity • Conda |
| Input → Deliverable | Visium FASTQs + High-Res H&E TIFF → Spatial Feature Matrix, Spot Deconvolution | |
Step 1: Spatial Read Mapping & Image Fiducial Registration with Space Ranger
Aligns tissue H&E microscopy images to capture area fiducials, maps sequencing reads, and assigns counts to coordinates.
spaceranger count --id=Cortex_Visium \
--transcriptome=/ref/refdata-gex-GRCh38-2020-A \
--fastqs=/data/visium_fastqs \
--sample=cortex_sample \
--image=cortex_he_image.tif \
--slide=V10M12-001 --area=A1 \
--localcores=16 --localmem=32--slide and --area retrieve exact manufacturing array masks for spot spatial coordinate tracking.Step 2: Spatial Expression Matrix Ingestion & SCTransform Normalization
Ingests spatial spot coordinates and H&E overlays into Seurat, applying regularized negative binomial regression.
library(Seurat)
library(ggplot2)
spatial_obj <- Load10X_Spatial(data.dir = "Cortex_Visium/outs/")
spatial_obj <- SCTransform(spatial_obj, assay = "Spatial", verbose = FALSE)
spatial_obj <- RunPCA(spatial_obj, assay = "SCT", verbose = FALSE)
spatial_obj <- FindNeighbors(spatial_obj, reduction = "pca", dims = 1:30)
spatial_obj <- FindClusters(spatial_obj, verbose = FALSE)
spatial_obj <- RunUMAP(spatial_obj, reduction = "pca", dims = 1:30)
SpatialDimPlot(spatial_obj, label = TRUE, label.size = 3)Load10X_Spatial loads the lowres/hires histology image and aligns spatial pixel coordinates with matrix columns.Step 3: Spatially Variable Gene (SVG) Discovery with Moran's I
Identifies genes whose expression levels exhibit non-random spatial autocorrelation across tissue architecture.
spatial_obj <- FindSpatiallyVariableFeatures(
spatial_obj, assay = "SCT",
features = VariableFeatures(spatial_obj)[1:1000],
selection.method = "moransi"
)
top_svgs <- head(SpatiallyVariableFeatures(spatial_obj, selection.method = "moransi"), 6)
SpatialFeaturePlot(spatial_obj, features = top_svgs, ncol = 3)selection.method = 'moransi' computes spatial autocorrelation scores between adjacent histological spots.Step 4: Spot Multi-Cellular Deconvolution with RCTD & scRNA Reference
Deconvolves the 1-10 cells captured in each Visium spot using single-cell RNA-seq reference profiles.
library(spacexr)
# Ingest single-cell reference and spatial query
sc_ref <- Reference(counts = sc_counts, cell_types = sc_cell_types)
puck <- SpatialRNA(coords = spatial_coords, counts = spatial_raw_counts)
# Run Robust Cell Type Decomposition (RCTD)
myRCTD <- create.RCTD(puck, sc_ref, max_cores = 8)
myRCTD <- run.RCTD(myRCTD, doublet_mode = 'doublet')
results <- myRCTD@results$weightsdoublet_mode = 'doublet' infers primary and secondary cell-type proportions per capture spot.