Accessing SpaMTP Experiment Data

Introduction

SpaMTPData makes the experiment data used in SpaMTP workflows discoverable through ExperimentHub. The package itself remains small and users download only the resources required for a particular workflow.

The submission API uses camelCase function names. Install SpaMTPData >= 0.99.4, SpaMTPdb >= 0.99.3 and SpaMTP >= 0.99.4 together to replace the historical API. Package versions and the version of a published dataset are independent.

library(SpaMTPData)
resources <- spaMTPDataResources(version = "latest")
resources[c("resource", "version", "category", "r_data_class", "requires_conversion")]
##                             resource version              category
## 1                 mouse_brain_visium   1.1.0           mouse_brain
## 2                  mouse_brain_fmp10   1.1.0           mouse_brain
## 3           mouse_brain_dhb_striatum   1.1.0           mouse_brain
## 4                  mouse_bladder_raw   1.1.0         mouse_bladder
## 5            mouse_bladder_annotated   1.1.0         mouse_bladder
## 6            mouse_bladder_histology   1.1.0         mouse_bladder
## 7        mouse_bladder_intensity_csv   1.1.0         mouse_bladder
## 8         mouse_bladder_metadata_csv   1.1.0         mouse_bladder
## 9                   simulated_xenium   1.1.0  simulated_multiomics
## 10                   simulated_maldi   1.1.0  simulated_multiomics
## 11       annotation_refinement_input   1.1.0 annotation_refinement
## 12      annotation_refinement_scores   1.1.0 annotation_refinement
## 13                      big_data_roi   1.1.0              big_data
## 14            human_brain_integrated   1.1.0           human_brain
## 15              human_brain_pathways   1.1.0           human_brain
## 16                pig_fetus_cardinal   1.1.0       import_examples
## 17                human_rcc_cardinal   1.1.0       import_examples
## 18 annotation_refinement_results_csv   1.1.0 annotation_refinement
##           r_data_class requires_conversion
## 1    SpatialExperiment               FALSE
## 2    SpatialExperiment               FALSE
## 3    SpatialExperiment               FALSE
## 4  MSImagingExperiment               FALSE
## 5    SpatialExperiment               FALSE
## 6                array               FALSE
## 7             FilePath               FALSE
## 8             FilePath               FALSE
## 9    SpatialExperiment               FALSE
## 10   SpatialExperiment               FALSE
## 11 MSImagingExperiment               FALSE
## 12                list               FALSE
## 13 MSImagingExperiment               FALSE
## 14   SpatialExperiment               FALSE
## 15          data.frame               FALSE
## 16 MSImagingExperiment               FALSE
## 17 MSImagingExperiment               FALSE
## 18            FilePath               FALSE
spaMTPDataVersion()
## [1] "1.1.0" "1.0.0"

A native example without downloads

spaMTPExampleData() constructs a small, deterministic synthetic SpatialExperiment. It is not a biological dataset and does not load Seurat. Use it to check the container interface or run the three-package workflow demonstrated in SpaMTP’s SpaMTP_Companion_Workflow vignette.

spe <- spaMTPExampleData()
SummarizedExperiment::assayNames(spe)
## [1] "counts"
SummarizedExperiment::rowData(spe)$mz
## [1] 149.0444 171.0264 181.0707 203.0526 166.0863 500.0500
SummarizedExperiment::colData(spe)$region
##  [1] edge edge edge edge edge edge core core core core core core
## Levels: core edge
SpatialExperiment::spatialCoords(spe)
##       x y
##  [1,] 0 0
##  [2,] 0 1
##  [3,] 0 2
##  [4,] 1 0
##  [5,] 1 1
##  [6,] 1 2
##  [7,] 2 0
##  [8,] 2 1
##  [9,] 2 2
## [10,] 3 0
## [11,] 3 1
## [12,] 3 2
SingleCellExperiment::altExpNames(spe)
## [1] "transcriptome"
core <- spe[, spe$region == "core"]
stopifnot(identical(colnames(SingleCellExperiment::altExp(core, "transcriptome")),
  colnames(core)))

Published native datasets

The maintainer recipe inst/scripts/prepare-native-resources.R extracts the seven archival Seurat datasets into native release 1.1.0, now published in Zenodo record 22733262. It retains counts/data, feature and pixel annotations, image-centroid coordinates and paired transcriptomes. The resulting SpatialExperiment RDS can be read directly without Seurat or any further conversion:

striatum <- spaMTPData("mouse_brain_dhb_striatum", version = "1.1.0")
SummarizedExperiment::assayNames(striatum)
SpatialExperiment::spatialCoords(striatum)
SingleCellExperiment::altExpNames(striatum) # SPT

This downloading example is not evaluated during a package build. The accompanying native manifest records source and output hashes. Optical rasters, polygons, graphs, reductions and Seurat-specific weight objects are omitted; the retained data layer is not reinterpreted as log-normalized expression. The simulated datasets retain their explicit synthetic status.

The resource API selects 1.1.0 by default. Native files have new filenames and checksums and are not substituted under an old archive’s identity. Use version = "1.0.0" to request the original immutable archives explicitly. Hub ingestion is separate from publication and package metadata registration.

The native files are published in the same Zenodo version family as SpaMTPdb’s annotation resources. SpaMTPdb coordinates file publication; SpaMTPData retains experimental resource ownership, documentation and reading. There is no runtime dependency between the two data packages. Registration of a published native release preserves the 1.0.0 history and carries forward all 18 resources, including eleven unchanged files at their original locations.

Loading a published native dataset

Inspect the mouse brain/DHB record without downloading the object:

striatum_metadata <- spaMTPData(
  "mouse_brain_dhb_striatum",
  metadata = TRUE
)
striatum_metadata[c("resource", "version", "r_data_class", "bytes")]
##                    resource version      r_data_class    bytes
## 21 mouse_brain_dhb_striatum   1.1.0 SpatialExperiment 47643252
stopifnot(striatum_metadata$r_data_class == "SpatialExperiment",
  !striatum_metadata$requires_conversion)

Omit metadata = TRUE to retrieve and cache the native object. ExperimentHub is preferred; an immutable source-URL fallback is available before ingestion:

striatum <- spaMTPData("mouse_brain_dhb_striatum")

This default file is a SpatialExperiment and does not need Seurat. Historical metadata can be inspected without downloading the old Seurat object:

historical <- spaMTPData("mouse_brain_dhb_striatum",
  version = "1.0.0", metadata = TRUE)
historical[c("resource", "version", "r_data_class", "requires_conversion")]
##                   resource version r_data_class requires_conversion
## 3 mouse_brain_dhb_striatum   1.0.0       Seurat                TRUE

Historical entries marked requires_conversion = TRUE need explicit conversion at the SpaMTP workflow boundary. Downloading an old file does not update its scientific processing. Its class and checksum remain unchanged.

The same interface can use a previously downloaded local file:

options(SpaMTPData.resource_dir = "/path/to/SpaMTPData-files")
striatum <- spaMTPData("mouse_brain_dhb_striatum", offline = TRUE)

Local files and caches are verified against the recorded size and MD5. offline = TRUE also uses previously verified download-cache entries; it never queries ExperimentHub or Zenodo. A missing or invalid file is an error, not a reason to silently use another version. verify = FALSE permits intentional local development fixtures but does not bypass object-class validation.

The explicit resource accessor follows the same interface:

spaMTPDataResource(
  "mouse_brain_dhb_striatum",
  metadata = TRUE
)
##                    resource version    category
## 21 mouse_brain_dhb_striatum   1.1.0 mouse_brain
##                                        title                        file_name
## 21 SpaMTPData_mouse_brain_dhb_striatum_1.1.0 mouse_brain_dhb_striatum_spe.rds
##                                   location_prefix
## 21 https://zenodo.org/api/records/22733262/files/
##                                  rdata_path                          source_url
## 21 mouse_brain_dhb_striatum_spe.rds/content https://zenodo.org/records/22733262
##         r_data_class dispatch_class    bytes                              md5
## 21 SpatialExperiment            Rds 47643252 629a3f78651a512484550b4ba0e5d66c
##    requires_conversion
## 21               FALSE

Session information

sessionInfo()
## R version 4.6.1 (2026-06-24)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 26.04.1 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] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] SpaMTPData_0.99.5 BiocStyle_2.41.0 
## 
## loaded via a namespace (and not attached):
##  [1] KEGGREST_1.53.6             SummarizedExperiment_1.43.0
##  [3] rjson_0.2.23                xfun_0.61                  
##  [5] bslib_0.12.0                httr2_1.3.0                
##  [7] lattice_0.23-1              Biobase_2.73.2             
##  [9] vctrs_0.7.3                 tools_4.6.1                
## [11] generics_0.1.4              stats4_4.6.1               
## [13] curl_8.0.0                  tibble_3.3.1               
## [15] AnnotationDbi_1.75.2        RSQLite_3.53.3             
## [17] blob_1.3.0                  pkgconfig_2.0.3            
## [19] BiocBaseUtils_1.15.1        Matrix_1.7-6               
## [21] dbplyr_2.6.0                S4Vectors_0.51.10          
## [23] lifecycle_1.0.5             compiler_4.6.1             
## [25] Biostrings_2.81.9           Seqinfo_1.3.2              
## [27] htmltools_0.5.9             sys_3.4.3                  
## [29] buildtools_1.0.0            sass_0.4.10                
## [31] yaml_2.3.12                 pillar_1.11.1              
## [33] crayon_1.5.3                jquerylib_0.1.4            
## [35] SingleCellExperiment_1.35.2 DelayedArray_0.39.8        
## [37] cachem_1.1.0                magick_2.9.1               
## [39] abind_1.4-8                 ExperimentHub_3.3.2        
## [41] AnnotationHub_4.3.2         tidyselect_1.2.1           
## [43] digest_0.6.39               dplyr_1.2.1                
## [45] BiocVersion_3.24.0          maketools_1.3.2            
## [47] grid_4.6.1                  fastmap_1.2.0              
## [49] SparseArray_1.13.4          cli_3.6.6                  
## [51] magrittr_2.0.5              S4Arrays_1.13.2            
## [53] filelock_1.0.3              rappdirs_0.3.4             
## [55] bit64_4.8.6                 rmarkdown_2.32             
## [57] XVector_0.53.0              httr_1.4.9                 
## [59] matrixStats_1.5.0           bit_4.6.0                  
## [61] otel_0.2.0                  png_0.1-9                  
## [63] SpatialExperiment_1.23.0    memoise_2.0.1              
## [65] evaluate_1.0.5              knitr_1.52                 
## [67] GenomicRanges_1.65.4        IRanges_2.47.5             
## [69] BiocFileCache_3.3.0         rlang_1.3.0                
## [71] Rcpp_1.1.2                  glue_1.8.1                 
## [73] DBI_1.3.0                   BiocManager_1.30.27        
## [75] BiocGenerics_0.59.12        jsonlite_2.0.0             
## [77] R6_2.6.1                    MatrixGenerics_1.25.0