SpaTalk for Different Spatial Transcriptomics Platforms

Overview

Spatial transcriptomics technologies can be broadly categorized into two types:

Category Resolution Examples SpaTalk Setting
Spot-based Multi-cellular 10x Visium, Slide-seq, ST if_st_is_sc = FALSE
Single-cell Cellular STARmap, MERFISH, seqFISH+, Xenium if_st_is_sc = TRUE

This vignette provides platform-specific guidance for using SpaTalk.

Single-Cell Resolution Platforms

STARmap Example (Built-in Data)

STARmap provides single-cell resolution with targeted gene panels. Let’s demonstrate with the built-in STARmap data:

library(SpaTalk)

# Load built-in STARmap demo data
load(system.file("extdata", "starmap_data.rda", package = "SpaTalk"))
load(system.file("extdata", "starmap_meta.rda", package = "SpaTalk"))

# Check data dimensions
cat("Genes:", nrow(starmap_data), "\n")
#> Genes: 996
cat("Cells:", ncol(starmap_data), "\n")
#> Cells: 930
cat("Cell types:", length(unique(starmap_meta$celltype)), "\n")
#> Cell types: 14
# Create SpaTalk object - NO deconvolution needed
st_meta <- data.frame(
  cell = starmap_meta$cell,
  x = starmap_meta$x,
  y = starmap_meta$y
)

obj <- createSpaTalk(
  st_data = starmap_data,
  st_meta = st_meta,
  species = "Mouse",
  if_st_is_sc = TRUE,       # Single-cell resolution
  spot_max_cell = 1,        # One cell per "spot"
  celltype = starmap_meta$celltype  # Direct annotation
)

obj
#> An object of class SpaTalk 
#> 996 genes across 930 single-cells (0 lrpair)
plot_st_celltype_all(obj, size = 1.2)
STARmap single-cell spatial distribution

STARmap single-cell spatial distribution

Other Single-Cell Platforms

For MERFISH, Xenium, seqFISH+, etc., use the same workflow:

# Generic single-cell resolution workflow
obj <- createSpaTalk(
  st_data = your_counts,        # Gene x Cell matrix
  st_meta = your_coords,        # data.frame with cell, x, y
  species = "Human",            # or "Mouse"
  if_st_is_sc = TRUE,           # Single-cell resolution
  spot_max_cell = 1,
  celltype = your_annotations   # Cell type labels
)

# No deconvolution needed - proceed directly to CCI
data(lrpairs)
data(pathways)
obj <- find_lr_path(obj, lrpairs, pathways)
obj <- dec_cci_all(obj)

Spot-Based Platforms

10x Visium Workflow

Visium captures ~1-10 cells per 55μm diameter spot with whole-transcriptome coverage.

library(SpaTalk)
library(Seurat)

# Load Visium data using Seurat
visium <- Load10X_Spatial(
  data.dir = "path/to/spaceranger/output/",
  filename = "filtered_feature_bc_matrix.h5"
)

# Quality control
visium <- subset(visium, 
  nFeature_Spatial > 200 & 
  nFeature_Spatial < 10000 &
  percent.mt < 20
)

# Extract for SpaTalk
st_data <- GetAssayData(visium, slot = "counts")
coords <- GetTissueCoordinates(visium)
st_meta <- data.frame(
  spot = rownames(coords),
  x = coords$imagerow,
  y = coords$imagecol
)

# Create SpaTalk object (spot-based)
obj <- createSpaTalk(
  st_data = st_data,
  st_meta = st_meta,
  species = "Human",
  if_st_is_sc = FALSE,      # Spot-based
  spot_max_cell = 8         # Visium: ~1-10 cells/spot
)

# Deconvolution with scRNA-seq reference (REQUIRED for spot-based)
obj <- dec_celltype(
  object = obj,
  sc_data = sc_reference,
  sc_celltype = sc_annotations
)

Slide-seq / Slide-seqV2

Slide-seq uses 10μm beads, typically capturing 1-10 cells per bead.

# Slide-seq workflow
obj <- createSpaTalk(
  st_data = slideseq_counts,
  st_meta = data.frame(
    spot = colnames(slideseq_counts),
    x = bead_coordinates$x,
    y = bead_coordinates$y
  ),
  species = "Mouse",
  if_st_is_sc = FALSE,
  spot_max_cell = 5  # Slide-seq: smaller spots
)

# Deconvolution required
obj <- dec_celltype(obj, sc_data, sc_celltype)

Workflow Comparison

Single-cell Workflow (STARmap, MERFISH, Xenium)

# Complete single-cell workflow demonstration
library(SpaTalk)

# 1. Load data
load(system.file("extdata", "starmap_data.rda", package = "SpaTalk"))
load(system.file("extdata", "starmap_meta.rda", package = "SpaTalk"))

# 2. Create object with cell types
st_meta <- data.frame(
  cell = starmap_meta$cell,
  x = starmap_meta$x,
  y = starmap_meta$y
)

obj <- createSpaTalk(
  st_data = starmap_data,
  st_meta = st_meta,
  species = "Mouse",
  if_st_is_sc = TRUE,
  spot_max_cell = 1,
  celltype = starmap_meta$celltype
)

# 3. NO deconvolution needed

# 4. Filter LR paths
data(lrpairs)
data(pathways)
obj <- find_lr_path(obj, lrpairs, pathways, if_doParallel = FALSE)
#> Checking input data 
#> Begin to filter lrpairs and pathways 
#> ***Done***

# 5. Infer CCIs
obj <- dec_cci(obj, "eL6", "PVALB", if_doParallel = FALSE)
#> Begin to find LR pairs

cat("Single-cell workflow completed!\n")
#> Single-cell workflow completed!
cat("LR pairs found:", nrow(obj@lrpair), "\n")
#> LR pairs found: 1

Spot-based Workflow (Visium, Slide-seq)

# Spot-based workflow (requires scRNA-seq reference)

# 1. Create object (spot-based)
obj <- createSpaTalk(st_data, st_meta, "Human", 
                     if_st_is_sc = FALSE, spot_max_cell = 10)

# 2. Deconvolution (REQUIRED)
obj <- dec_celltype(obj, sc_data, sc_celltype)

# 3. Filter LR paths
obj <- find_lr_path(obj, lrpairs, pathways)

# 4. Infer CCIs
obj <- dec_cci_all(obj)

Parameter Guidelines by Platform

Platform spot_max_cell Deconvolution Notes
10x Visium 5-10 Required 55μm spots
Slide-seq 3-8 Required 10μm beads
Slide-seqV2 3-8 Required Improved capture
Original ST 15-30 Required 100μm spots
STARmap 1 Not needed Single-cell
MERFISH 1 Not needed Single-cell
Xenium 1 Not needed Single-cell
seqFISH+ 1 Not needed Single-cell
CosMx 1 Not needed Single-cell

Best Practices

For Spot-based Data

  1. Reference selection: Use tissue-matched scRNA-seq
  2. Deconvolution validation: Check proportions against known biology
  3. Spatial coherence: Verify cell types cluster appropriately

For Single-cell Data

  1. Cell type annotation: Use robust clustering methods
  2. Quality control: Filter low-quality cells
  3. Gene coverage: Consider gene panel limitations

Session Info

sessionInfo()
#> R version 4.6.1 (2026-06-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 26.04 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so;  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] parallel  stats     graphics  grDevices utils     datasets  methods  
#> [8] base     
#> 
#> other attached packages:
#> [1] SpaTalk_2.0.0     doParallel_1.0.17 iterators_1.0.14  foreach_1.5.2    
#> [5] ggalluvial_0.12.6 ggplot2_4.0.3     rmarkdown_2.31   
#> 
#> loaded via a namespace (and not attached):
#>   [1] RColorBrewer_1.1-3     sys_3.4.3              jsonlite_2.0.0        
#>   [4] magrittr_2.0.5         spatstat.utils_3.2-3   farver_2.1.2          
#>   [7] fs_2.1.0               vctrs_0.7.3            ROCR_1.0-12           
#>  [10] spatstat.explore_3.8-1 rstatix_0.7.3          htmltools_0.5.9       
#>  [13] progress_1.2.3         broom_1.0.13           Formula_1.2-5         
#>  [16] sass_0.4.10            sctransform_0.4.3      parallelly_1.48.0     
#>  [19] KernSmooth_2.23-26     bslib_0.11.0           htmlwidgets_1.6.4     
#>  [22] ica_1.0-3              plyr_1.8.9             plotly_4.12.0         
#>  [25] zoo_1.8-15             cachem_1.1.0           buildtools_1.0.0      
#>  [28] igraph_2.3.3           mime_0.13              lifecycle_1.0.5       
#>  [31] pkgconfig_2.0.3        Matrix_1.7-5           R6_2.6.1              
#>  [34] fastmap_1.2.0          fitdistrplus_1.2-6     future_1.70.0         
#>  [37] shiny_1.14.0           digest_0.6.39          patchwork_1.3.2       
#>  [40] Seurat_5.5.1           tensor_1.5.1           RSpectra_0.16-2       
#>  [43] irlba_2.3.7            ggpubr_0.6.3           labeling_0.4.3        
#>  [46] progressr_0.19.0       spatstat.sparse_3.2-0  httr_1.4.8            
#>  [49] polyclip_1.10-7        abind_1.4-8            compiler_4.6.1        
#>  [52] withr_3.0.3            backports_1.5.1        S7_0.2.2              
#>  [55] carData_3.0-6          fastDummies_1.7.6      ggforce_0.5.0         
#>  [58] ggsignif_0.6.4         MASS_7.3-65            rappdirs_0.3.4        
#>  [61] ggsci_5.1.0            tools_4.6.1            lmtest_0.9-40         
#>  [64] otel_0.2.0             scatterpie_0.2.6       httpuv_1.6.17         
#>  [67] future.apply_1.20.2    goftest_1.2-3          glue_1.8.1            
#>  [70] nlme_3.1-169           promises_1.5.0         grid_4.6.1            
#>  [73] Rtsne_0.17             cluster_2.1.8.2        reshape2_1.4.5        
#>  [76] generics_0.1.4         gtable_0.3.6           spatstat.data_3.1-9   
#>  [79] tzdb_0.5.0             tidyr_1.3.2            data.table_1.18.4     
#>  [82] hms_1.1.4              car_3.1-5              sp_2.2-1              
#>  [85] spatstat.geom_3.8-1    RcppAnnoy_0.0.23       ggrepel_0.9.8         
#>  [88] RANN_2.6.2             pillar_1.11.1          stringr_1.6.0         
#>  [91] yulab.utils_0.2.4      ggExtra_0.11.0         spam_2.11-4           
#>  [94] RcppHNSW_0.7.0         later_1.4.8            splines_4.6.1         
#>  [97] tweenr_2.0.3           dplyr_1.2.1            lattice_0.22-9        
#> [100] survival_3.8-6         deldir_2.0-4           tidyselect_1.2.1      
#> [103] maketools_1.3.2        miniUI_0.1.2           pbapply_1.7-4         
#> [106] knitr_1.51             gridExtra_2.3.1        scattermore_1.2       
#> [109] xfun_0.59              matrixStats_1.5.0      pheatmap_1.0.13       
#> [112] stringi_1.8.7          ggfun_0.2.1            lazyeval_0.2.3        
#> [115] yaml_2.3.12            evaluate_1.0.5         codetools_0.2-20      
#> [118] tibble_3.3.1           cli_3.6.6              uwot_0.2.4            
#> [121] xtable_1.8-8           reticulate_1.46.0      jquerylib_0.1.4       
#> [124] Rcpp_1.1.1-1.1         globals_0.19.1         spatstat.random_3.5-0 
#> [127] png_0.1-9              spatstat.univar_3.2-0  readr_2.2.0           
#> [130] prettyunits_1.2.0      dotCall64_1.2          listenv_1.0.0         
#> [133] viridisLite_0.4.3      scales_1.4.0           ggridges_0.5.7        
#> [136] SeuratObject_5.4.0     purrr_1.2.2            crayon_1.5.3          
#> [139] rlang_1.2.0            cowplot_1.2.0