library(dplyr)
library(tidyr)
library(ggplot2)
library(ggrepel)
library(patchwork)
library(Seurat)
library(arrow)

Introduction

This vignette compares breast cancer samples profiled with ATERA and Xenium, then demonstrates the transcriptomic enhancement obtained with SPLIT, along with the new, more optimised and versatile SPLIT v0.2.0+.

Overview

  1. Data pre-processing
  2. Side-by-side comparison of key metrics
  3. Annotation with RCTD using a single-cell reference (pre-computed)
  4. Evaluation of transcript spillover
  5. Purification with SPLIT

Data

We use publicly available matched breast cancer samples profiled with ATERA and Xenium from the same donor. For annotation, we use a publicly available annotated Chromium snRNA-seq breast cancer dataset (Janesick et al., 2023).

Data sources:

Side-by-side Comparison of Key Metrics

QC

Xenium is profiled with a targeted panel of 269 genes, while ATERA provides full-transcriptome coverage (~18,000 genes). We compare distributions of counts per cell, detected genes per cell, and the counts-to-features ratio, first across each platform’s full panel, then restricted to the shared gene set (n = 263).

Full panel

qc_df <- bind_rows(
  atera@meta.data %>%
    select(nCount = nCount_Xenium, nFeature = nFeature_Xenium) %>%
    mutate(Experiment = "ATERA"),
  xenium@meta.data %>%
    select(nCount = nCount_Xenium, nFeature = nFeature_Xenium) %>%
    mutate(Experiment = "Xenium"),
  chromium@meta.data %>%
    select(nCount = nCount_RNA, nFeature = nFeature_RNA) %>%
    mutate(Experiment = "Chromium")
) %>%
  mutate(nCount_to_nFeature = nCount / nFeature) %>%
  pivot_longer(
    cols      = c(nCount, nFeature, nCount_to_nFeature),
    names_to  = "metric",
    values_to = "value"
  ) %>%
  filter(!is.na(value)) %>%
  mutate(
    Metric     = ordered(metric, levels = c("nCount", "nFeature", "nCount_to_nFeature")),
    Experiment = ordered(Experiment, levels = c("Xenium", "ATERA", "Chromium"))
  )

ggplot(qc_df, aes(y = value, color = Experiment, x = Experiment)) +
  geom_boxplot(
    position     = position_dodge(width = 0.8),
    outlier.size = 0.15,
    width        = 0.65
  ) +
  facet_wrap(~ Metric, scales = "free_y") +
  labs(
    x     = NULL,
    y     = "Value",
    title = paste0("Xenium (", nrow(xenium), " genes) vs ATERA (",
                   nrow(atera), " genes) vs Chromium (", nrow(chromium), " genes)"),
    color = "Experiment"
  ) +
  scale_y_log10() +
  scale_color_manual(values = pal_exp) +
  theme_classic() +
  theme(
    axis.text.x  = element_text(angle = 45, hjust = 1),
    aspect.ratio = 1,
    legend.position = "none"
  )
plot of chunk qc-full
plot of chunk qc-full

Shared genes (n = 263)

common_genes <- intersect(rownames(chromium), intersect(rownames(atera), rownames(xenium)))

atera[["common"]]    <- CreateAssayObject(counts = GetAssayData(atera,    assay = "Xenium", layer = "counts")[common_genes, ])
xenium[["common"]]   <- CreateAssayObject(counts = GetAssayData(xenium,   assay = "Xenium", layer = "counts")[common_genes, ])
chromium[["common"]] <- CreateAssayObject(counts = GetAssayData(chromium, assay = "RNA",    layer = "counts")[common_genes, ])

qc_df_common <- bind_rows(
  atera@meta.data %>%
    select(nCount = nCount_common, nFeature = nFeature_common) %>%
    mutate(Experiment = "ATERA"),
  xenium@meta.data %>%
    select(nCount = nCount_common, nFeature = nFeature_common) %>%
    mutate(Experiment = "Xenium"),
  chromium@meta.data %>%
    select(nCount = nCount_common, nFeature = nFeature_common) %>%
    mutate(Experiment = "Chromium")
) %>%
  mutate(nCount_to_nFeature = nCount / nFeature) %>%
  pivot_longer(
    cols      = c(nCount, nFeature, nCount_to_nFeature),
    names_to  = "metric",
    values_to = "value"
  ) %>%
  filter(!is.na(value)) %>%
  mutate(
    Metric     = ordered(metric, levels = c("nCount", "nFeature", "nCount_to_nFeature")),
    Experiment = ordered(Experiment, levels = c("Xenium", "ATERA", "Chromium"))
  )

ggplot(qc_df_common, aes(y = value, color = Experiment, x = Experiment)) +
  geom_boxplot(
    position     = position_dodge(width = 0.8),
    outlier.size = 0.15,
    width        = 0.65
  ) +
  facet_wrap(~ Metric, scales = "free_y") +
  labs(
    x     = NULL,
    y     = "Value",
    title = paste0("Xenium vs ATERA vs Chromium across ", length(common_genes), " shared genes"),
    color = "Experiment"
  ) +
  scale_y_log10() +
  scale_color_manual(values = pal_exp) +
  theme_classic() +
  theme(
    axis.text.x  = element_text(angle = 45, hjust = 1),
    aspect.ratio = 1,
    legend.position = "none"
  )
plot of chunk qc-common
plot of chunk qc-common

Summary: ATERA provides full-transcriptome single-cell spatial profiling at a sensitivity comparable to Chromium.

Cell-type Annotation with a Single-cell Reference

To annotate the matched ATERA and Xenium samples we used a previously published snRNA-seq breast cancer dataset (Janesick et al., 2023) as a reference. Annotation was performed with rctd-py, a fast Python reimplementation of RCTD.

Note: SPLIT v0.2.0+ is annotation-tool agnostic – any deconvolution tool of your choice can be used (see the SPLIT section below).

Reference preparation

The original reference contains mixed-cell-type clusters (“T Cell & Tumor Hybrid”, “Stromal & T Cell Hybrid”) that are removed prior to annotation. Cell types are also consolidated into three levels of granularity (Level 1-3).

chromium <- subset(
  chromium,
  subset = !cell_type %in% c("T Cell & Tumor Hybrid", "Stromal & T Cell Hybrid") & !is.na(cell_type)
)

chromium <- chromium %>%
  NormalizeData() %>% FindVariableFeatures() %>% ScaleData() %>% RunPCA() %>%
  RunUMAP(dims = 1:50)
p_l3 <- UMAPPlot(chromium, group.by = "Level3", cols = pal_l3, label = T, repel = T) &
  theme_void() & theme(aspect.ratio = 1, legend.position = "none") & ggtitle("Level 3")

p_l2 <- UMAPPlot(chromium, group.by = "Level2", cols = pal_l2, label = T, repel = T) &
  theme_void() & theme(aspect.ratio = 1, legend.position = "none") & ggtitle("Level 2")

p_l1 <- UMAPPlot(chromium, group.by = "Level1", cols = pal_l1, label = T, repel = T) &
  theme_void() & theme(aspect.ratio = 1, legend.position = "none") & ggtitle("Level 1")

p_l3 | p_l2 | p_l1
plot of chunk umap-reference
plot of chunk umap-reference

RCTD annotation results

RCTD was run at Level 2 using Level 1 as class_df to guide the method on related cell types.

p_xe_sp <- DimPlot(xenium, group.by = "first_type", label = F, cols = pal_l2,
                   reduction = "spatial", raster = T) +
  theme_void() + coord_fixed() + ggtitle("Xenium")

p_atera_sp <- DimPlot(atera, group.by = "first_type", label = F, cols = pal_l2,
                      reduction = "spatial", raster = T) +
  theme_void() + coord_fixed() + ggtitle("ATERA")

p_xe_sp + p_atera_sp +
  plot_layout(guides = "collect", ncol = 2) &
  theme(legend.position = "bottom", legend.direction = "horizontal") &
  guides(color = guide_legend(nrow = 1, override.aes = list(size = 3)))
plot of chunk spatial-annotation
plot of chunk spatial-annotation
# Primary cell-type proportions
df_first_xe <- as.data.frame(table(xenium$first_type, useNA = "ifany")) %>%
  setNames(c("CellType", "Count")) %>%
  dplyr::arrange(desc(Count))

df_first_atera <- as.data.frame(table(atera$first_type, useNA = "ifany")) %>%
  setNames(c("CellType", "Count")) %>%
  dplyr::arrange(desc(Count))

plot_df <- df_first_xe %>%
  dplyr::rename(Count_first_xe = Count) %>%
  dplyr::inner_join(df_first_atera %>% dplyr::rename(Count_first_atera = Count), by = "CellType") %>%
  dplyr::mutate(
    Prop_first_xe    = Count_first_xe    / sum(Count_first_xe),
    Prop_first_atera = Count_first_atera / sum(Count_first_atera)
  )

p_primary_xe_atera <- ggplot(plot_df,
    aes(x = Prop_first_xe, y = Prop_first_atera, label = CellType, color = CellType)) +
  geom_point(size = 3) +
  geom_text_repel(size = 4, max.overlaps = Inf) +
  geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
  scale_x_continuous(labels = scales::percent_format(accuracy = 1)) +
  scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  scale_color_manual(values = pal_l2, na.value = "grey50") +
  labs(
    x     = "Primary proportion - Xenium",
    y     = "Primary proportion - ATERA",
    title = "Primary cell-type proportions"
  ) +
  theme_classic() +
  theme(legend.position = "none", aspect.ratio = 1)

# Secondary cell-type proportions
df_second_xe <- as.data.frame(table(xenium$second_type, useNA = "ifany")) %>%
  setNames(c("CellType", "Count")) %>%
  dplyr::mutate(CellType = as.character(CellType) %>% tidyr::replace_na("NA")) %>%
  dplyr::arrange(desc(Count))

df_second_atera <- as.data.frame(table(atera$second_type, useNA = "ifany")) %>%
  setNames(c("CellType", "Count")) %>%
  dplyr::mutate(CellType = as.character(CellType) %>% tidyr::replace_na("NA")) %>%
  dplyr::arrange(desc(Count))

plot_df_second <- df_second_xe %>%
  dplyr::rename(Count_second_xe = Count) %>%
  dplyr::full_join(df_second_atera %>% dplyr::rename(Count_second_atera = Count), by = "CellType") %>%
  dplyr::mutate(
    Count_second_xe    = tidyr::replace_na(Count_second_xe, 0),
    Count_second_atera = tidyr::replace_na(Count_second_atera, 0),
    Prop_second_xe     = Count_second_xe    / sum(Count_second_xe),
    Prop_second_atera  = Count_second_atera / sum(Count_second_atera)
  )

p_second_xe_atera <- ggplot(plot_df_second,
    aes(x = Prop_second_xe, y = Prop_second_atera, label = CellType, color = CellType)) +
  geom_point(size = 3) +
  geom_text_repel(size = 4, max.overlaps = Inf) +
  geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
  scale_x_continuous(labels = scales::percent_format(accuracy = 1)) +
  scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  scale_color_manual(values = pal_l2, na.value = "grey50") +
  labs(
    x     = "Secondary proportion - Xenium",
    y     = "Secondary proportion - ATERA",
    title = "Secondary cell-type proportions"
  ) +
  theme_classic() +
  theme(legend.position = "none", aspect.ratio = 1)

p_primary_xe_atera + p_second_xe_atera
plot of chunk proportion-comparison
plot of chunk proportion-comparison

Transcript spillover

The secondary cell-type weight (w2) estimates the fraction of transcripts attributed to a contaminating neighbouring cell type, serving as a proxy for transcript spillover.

plot_df_w2 <- bind_rows(
  atera@meta.data  %>% select(weight_second_type) %>% mutate(dataset = "ATERA"),
  xenium@meta.data %>% select(weight_second_type) %>% mutate(dataset = "Xenium")
)

median_df <- plot_df_w2 %>%
  group_by(dataset) %>%
  summarise(median_weight = median(weight_second_type, na.rm = TRUE), .groups = "drop")

ggplot(plot_df_w2, aes(x = weight_second_type, color = dataset, fill = dataset)) +
  geom_density(alpha = 0.2, linewidth = 1) +
  geom_vline(
    data     = median_df,
    aes(xintercept = median_weight, color = dataset),
    linetype = "dashed",
    linewidth = 0.8
  ) +
  scale_fill_manual(values  = pal_exp) +
  scale_color_manual(values = pal_exp) +
  labs(
    x     = "w2 (contamination weight)",
    y     = "Density",
    title = "Transcript spillover: Xenium vs ATERA",
    color = "Experiment",
    fill  = "Experiment"
  ) +
  theme_classic() +
  theme(aspect.ratio = 1)
plot of chunk spillover
plot of chunk spillover

Summary: There is strong agreement between ATERA and Xenium annotations despite the former being derived from ~1,600 shared genes and the latter from 183, demonstrating that both technologies are compatible with label transfer. ATERA shows lower but detectable transcript spillover compared to Xenium. This reduced spillover is also evident in the UMAP embeddings below, where cell types in ATERA are better separated.

UMAP embeddings (pre-SPLIT)

xenium <- xenium %>%
  NormalizeData() %>% FindVariableFeatures() %>% ScaleData() %>% RunPCA() %>%
  RunUMAP(dims = 1:30)

atera <- atera %>%
  NormalizeData() %>% FindVariableFeatures() %>% ScaleData() %>% RunPCA() %>%
  RunUMAP(dims = 1:50)
p_umap_xe <- UMAPPlot(xenium, group.by = "first_type", label = T, repel = T,
                      cols = pal_l2, raster = F) +
  theme_void() + ggtitle("Raw Xenium") + NoLegend()

p_umap_atera <- UMAPPlot(atera, group.by = "first_type", label = T, repel = T,
                         cols = pal_l2, raster = F) +
  theme_void() + ggtitle("Raw ATERA") + NoLegend()

p_umap_xe | p_umap_atera
plot of chunk umap-raw
plot of chunk umap-raw

SPLIT

SPLIT is a statistical decontamination method that removes transcript spillover from spatial transcriptomics data. It is compatible with any single-cell technology, including large-scale full-transcriptome platforms such as ATERA, and is annotation-tool agnostic as of v0.2.0.

split_xenium <- SPLIT::purify(
  counts             = GetAssayData(xenium, assay = "Xenium", layer = "counts"),
  rctd               = rctd_xenium,
  DO_output_sce      = FALSE,
  chunk_size         = 10000,
  DO_purify_singlets = TRUE
)

purified_xenium <- CreateSeuratObject(
  counts    = split_xenium$purified_counts,
  meta.data = split_xenium$cell_meta,
  assay     = "Xenium"
)

purified_xenium <- subset(purified_xenium, subset = nCount_Xenium > 10)
purified_xenium <- purified_xenium[
  rowSums(GetAssayData(purified_xenium, assay = "Xenium", layer = "counts") > 0) >= 5, ]

purified_xenium <- purified_xenium %>%
  NormalizeData() %>% FindVariableFeatures() %>% ScaleData() %>%
  RunPCA(verbose = FALSE) %>%
  RunUMAP(dims = 1:30, verbose = FALSE)
split_atera <- SPLIT::purify(
  counts             = GetAssayData(atera, assay = "Xenium", layer = "counts"),
  rctd               = rctd_atera,
  DO_output_sce      = FALSE,
  chunk_size         = 10000,
  DO_purify_singlets = TRUE
)

purified_atera <- CreateSeuratObject(
  counts    = split_atera$purified_counts,
  meta.data = split_atera$cell_meta,
  assay     = "Xenium"
)

purified_atera <- subset(purified_atera, subset = nCount_Xenium > 10)
purified_atera <- purified_atera[
  rowSums(GetAssayData(purified_atera, assay = "Xenium", layer = "counts") > 0) >= 5, ]

purified_atera <- purified_atera %>%
  NormalizeData() %>% FindVariableFeatures() %>% ScaleData() %>%
  RunPCA(verbose = FALSE) %>%
  RunUMAP(dims = 1:50, verbose = FALSE)
p_umap_xe_split <- UMAPPlot(purified_xenium, group.by = "first_type", label = T, repel = T,
                             cols = pal_l2, raster = F) +
  theme_void() + ggtitle("Post-SPLIT Xenium") + NoLegend()

p_umap_atera_split <- UMAPPlot(purified_atera, group.by = "first_type", label = T, repel = T,
                                cols = pal_l2, raster = F) +
  theme_void() + ggtitle("Post-SPLIT ATERA") + NoLegend()

p_umap_xe_split | p_umap_atera_split
plot of chunk umap-post-split
plot of chunk umap-post-split

Annotation-tool-agnostic SPLIT

As of v0.2.0, SPLIT does not depend of RCTD output. To run SPLIT, you just need a weight matrix, a vector of primary cell-type and a reference profile. See below how to run SPLIT with any decomposition below:

## Here we extract output of RCTD, but what we need is just a deconvolution weights, primary cell-type vector and the reference matrix

new_input <- SPLIT::convert_rctd_result_to_purify_input(rctd = rctd_xenium)

# Run SPLIT purification
split_xenium_v020 <- SPLIT::purify(
  counts = GetAssayData(xenium, assay = 'Xenium', layer = 'counts'), # or any gene x cells counts matrix
  reference = t(new_input$reference),
  primary_cell_type = new_input$primary_cell_type,
  deconvolution_weights = new_input$deconvolution_weights,
  DO_output_sce = TRUE
  )

Session Info

sessionInfo()
## R version 4.5.0 (2025-04-11)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.2 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.26.so;  LAPACK version 3.12.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
##  [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
## [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: Etc/UTC
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] arrow_20.0.0       Seurat_5.3.0       SeuratObject_5.2.0 sp_2.2-0           patchwork_1.3.2   
## [6] ggrepel_0.9.6      ggplot2_4.0.0      tidyr_1.3.1        dplyr_1.1.4       
## 
## loaded via a namespace (and not attached):
##   [1] RColorBrewer_1.1-3          rstudioapi_0.17.1           jsonlite_2.0.0             
##   [4] magrittr_2.0.4              spatstat.utils_3.1-5        farver_2.1.2               
##   [7] rmarkdown_2.29              fs_1.6.6                    vctrs_0.6.5                
##  [10] ROCR_1.0-11                 spatstat.explore_3.5-2      S4Arrays_1.8.1             
##  [13] htmltools_0.5.8.1           SPLIT_0.2.0                 SparseArray_1.8.0          
##  [16] sctransform_0.4.2           parallelly_1.45.1           KernSmooth_2.23-26         
##  [19] htmlwidgets_1.6.4           ica_1.0-3                   plyr_1.8.9                 
##  [22] plotly_4.11.0               zoo_1.8-14                  igraph_2.1.4               
##  [25] mime_0.13                   lifecycle_1.0.4             iterators_1.0.14           
##  [28] pkgconfig_2.0.3             Matrix_1.7-3                R6_2.6.1                   
##  [31] fastmap_1.2.0               GenomeInfoDbData_1.2.14     MatrixGenerics_1.20.0      
##  [34] fitdistrplus_1.2-4          future_1.67.0               shiny_1.11.1               
##  [37] digest_0.6.37               colorspace_2.1-1            S4Vectors_0.46.0           
##  [40] tensor_1.5.1                RSpectra_0.16-2             irlba_2.3.5.1              
##  [43] GenomicRanges_1.60.0        labeling_0.4.3              progressr_0.15.1           
##  [46] spatstat.sparse_3.1-0       httr_1.4.7                  polyclip_1.10-7            
##  [49] abind_1.4-8                 compiler_4.5.0              bit64_4.6.0-1              
##  [52] withr_3.0.2                 doParallel_1.0.17           S7_0.2.0                   
##  [55] BiocParallel_1.42.1         fastDummies_1.7.5           ggforce_0.4.2              
##  [58] MASS_7.3-65                 DelayedArray_0.34.1         ggsci_3.2.0                
##  [61] tools_4.5.0                 lmtest_0.9-40               scatterpie_0.2.4           
##  [64] httpuv_1.6.16               future.apply_1.20.0         goftest_1.2-3              
##  [67] glue_1.8.0                  nlme_3.1-168                promises_1.3.3             
##  [70] grid_4.5.0                  Rtsne_0.17                  cluster_2.1.8.1            
##  [73] reshape2_1.4.4              generics_0.1.4              gtable_0.3.6               
##  [76] spatstat.data_3.1-8         data.table_1.17.8           XVector_0.48.0             
##  [79] BiocGenerics_0.54.0         spatstat.geom_3.5-0         RcppAnnoy_0.0.22           
##  [82] RANN_2.6.2                  foreach_1.5.2               pillar_1.11.0              
##  [85] stringr_1.5.2               yulab.utils_0.2.0           spam_2.11-1                
##  [88] RcppHNSW_0.6.0              later_1.4.4                 splines_4.5.0              
##  [91] tweenr_2.0.3                lattice_0.22-7              survival_3.8-3             
##  [94] bit_4.6.0                   deldir_2.0-4                tidyselect_1.2.1           
##  [97] SingleCellExperiment_1.30.1 miniUI_0.1.2                pbapply_1.7-4              
## [100] knitr_1.50                  gridExtra_2.3               IRanges_2.42.0             
## [103] SummarizedExperiment_1.38.1 scattermore_1.2             stats4_4.5.0               
## [106] xfun_0.53                   Biobase_2.68.0              spacexr_2.2.1              
## [109] matrixStats_1.5.0           UCSC.utils_1.4.0            stringi_1.8.7              
## [112] ggfun_0.1.8                 lazyeval_0.2.2              yaml_2.3.10                
## [115] evaluate_1.0.5              codetools_0.2-20            entropy_1.3.2              
## [118] tibble_3.3.0                cli_3.6.5                   uwot_0.2.3                 
## [121] xtable_1.8-4                reticulate_1.43.0           GenomeInfoDb_1.44.0        
## [124] dichromat_2.0-0.1           Rcpp_1.1.0                  globals_0.18.0             
## [127] spatstat.random_3.4-1       png_0.1-8                   spatstat.univar_3.1-4      
## [130] parallel_4.5.0              assertthat_0.2.1            dotCall64_1.2              
## [133] listenv_0.9.1               viridisLite_0.4.2           scales_1.4.0               
## [136] ggridges_0.5.7              crayon_1.5.3                purrr_1.1.0                
## [139] rlang_1.1.6                 cowplot_1.2.0