Date: 2026-04-28

# OSTA.data

Yixing E Dong1, Helena L Crowell2 and Vincent J Carey3

1University of Lausanne, Lausanne, Switzerland
2National Center for Genomic Analysis, Barcelona, Spain
3Harvard Medical School, Boston, USA

#### April 28, 2026

#### Package

OSTA.data 1.4.0

    library(VisiumIO)
    library(OSTA.data)
    library(DropletUtils)
    library(SpatialExperimentIO)

# 1 Introduction

`OSTA.data` is a companion package for the “Orchestrating Spatial Transcriptomics Analysis” (OSTA) with Bioconductor online book.

Throughout OSTA, we rely on a set of publicly available datasets that cover different sequencing- and imaging-based platforms, namely: Visium, Visium HD, Xenium (10x Genomics) and CosMx (NanoString). In addition, we rely on scRNA-seq (Chromium) data for tasks such as spot deconvolution and label transfer (i.e., supervised clustering).

These data been deposited in an Open Storage Framework (OSF) repository here, and can be easily queried and downloaded using functions from the osfr package.

For convenience, we have implemented `OSTA.data` to:

- query and retrieve data from our OSF node
- cache the .zip archive using BiocFileCache

A list of currently available datasets maybe be viewer via:

    OSTA.data_list()

    ##  [1] "Chromium_HumanBreast_Janesick" "Chromium_HumanColon_Oliveira"
    ##  [3] "CosMx1k_MouseBrain1"           "CosMx1k_MouseBrain2"
    ##  [5] "CosMx6k_HumanBrain"            "VisiumHD_HumanColon_Oliveira"
    ##  [7] "Visium_HumanBreast_Janesick"   "Visium_HumanColon_Oliveira"
    ##  [9] "Xenium_HumanBreast1_Janesick"  "Xenium_HumanColon_Oliveira"

# 2 Retrieval

Any of the above may be retrieved using `OSTA.data_load()`.

For imaging-based spatial transcriptomics datasets (namely, CosMx and Xenium), arguments `pol` and `mol` specify whether or not cell segmentation boundaries and data on transcript molecules should be retrieved (both default to `TRUE`).

    id <- "Xenium_HumanColon_Oliveira"
    pa <- OSTA.data_load(id)
    basename(pa)

    ## [1] "d10a692f9232_Xenium_HumanColon_Oliveira.zip"

Once we have downloaded the .zip archive, we can unpack into a designated location (e.g., a working directory subfolder), or a temporary location:

    # create temporary directory
    dir.create(td <- tempfile())
    unzip(pa, exdir=td) # unzip
    list.files(td) # list files

    ## [1] "LICENSE.txt"                "cell_boundaries.parquet"
    ## [3] "cell_feature_matrix.h5"     "cells.parquet"
    ## [5] "experiment.xenium"          "gene_panel.json"
    ## [7] "nucleus_boundaries.parquet" "transcripts.parquet"

# 3 Importing

Data is all set, and can be read it into R using a framework of our choice. Here, we demonstrate how to

- read Xenium and CosMx data using SpatialExperimentIO
- read Visium and Visium HD data using VisiumIO
- read Chromium data using DropletUtils

both of which return a SpatialExperiment object.

## 3.1 Xenium

    (spe <- readXeniumSXE(td))

    ## class: SpatialExperiment
    ## dim: 422 340837
    ## metadata(4): experiment.xenium transcripts cell_boundaries
    ##   nucleus_boundaries
    ## assays(1): counts
    ## rownames(422): ABCC8 ACP5 ... WFDC2 XCL2
    ## rowData names(3): ID Symbol Type
    ## colnames(340837): aaaadaba-1 aaaadgga-1 ... oikdmkkf-1 oikeebja-1
    ## colData names(10): cell_id transcript_counts ... nucleus_area sample_id
    ## reducedDimNames(0):
    ## mainExpName: NULL
    ## altExpNames(3): NegControlProbe UnassignedCodeword NegControlCodeword
    ## spatialCoords names(2) : x_centroid y_centroid
    ## imgData names(0):

## 3.2 CosMx

    # retrieval
    id <- "CosMx1k_MouseBrain1"
    pa <- OSTA.data_load(id, mol=FALSE)
    dir.create(td <- tempfile())
    unzip(pa, exdir=td)
    # importing
    (spe <- readCosmxSXE(td, addTx=FALSE))

    ## class: SpatialExperiment
    ## dim: 950 38996
    ## metadata(2): polygons fov_positions
    ## assays(1): counts
    ## rownames(950): Chrna4 Slc6a1 ... Cck Aqp4
    ## rowData names(0):
    ## colnames(38996): 1 2 ... 38995 38996
    ## colData names(19): fov cell_ID ... Max.DAPI sample_id
    ## reducedDimNames(0):
    ## mainExpName: NULL
    ## altExpNames(1): NegPrb
    ## spatialCoords names(2) : CenterX_global_px CenterY_global_px
    ## imgData names(0):

## 3.3 Visium

    # retrieval
    id <- "Visium_HumanColon_Oliveira"
    pa <- OSTA.data_load(id)
    dir.create(td <- tempfile())
    unzip(pa, exdir=td)
    # importing
    obj <- TENxVisium(
        spacerangerOut=td,
        images="lowres",
        format="h5")
    (spe <- import(obj))

    ## class: SpatialExperiment
    ## dim: 18085 4269
    ## metadata(2): resources spatialList
    ## assays(1): counts
    ## rownames(18085): ENSG00000187634 ENSG00000188976 ... ENSG00000198695
    ##   ENSG00000198727
    ## rowData names(3): ID Symbol Type
    ## colnames(4269): AACAATGTGCTCCGAG-1 AACACCATTCGCATAC-1 ...
    ##   TGTTGGTGCGGAATCA-1 TGTTGGTGGACTCAGG-1
    ## colData names(4): in_tissue array_row array_col sample_id
    ## reducedDimNames(0):
    ## mainExpName: Gene Expression
    ## altExpNames(0):
    ## spatialCoords names(2) : pxl_col_in_fullres pxl_row_in_fullres
    ## imgData names(4): sample_id image_id data scaleFactor

## 3.4 VisiumHD

Bin-level data object construction:

    # retrieval
    id <- "VisiumHD_HumanColon_Oliveira"
    pa <- OSTA.data_load(id)
    dir.create(td <- tempfile())
    unzip(pa, exdir=td)
    # importing
    obj <- TENxVisiumHD(
        spacerangerOut=td,
        images="lowres",
        bin_size = "008",
        format="h5")
    (spe <- import(obj))

    ## class: SpatialExperiment
    ## dim: 18085 545913
    ## metadata(2): resouces spatialList
    ## assays(1): counts
    ## rownames(18085): ENSG00000187634 ENSG00000188976 ... ENSG00000198695
    ##   ENSG00000198727
    ## rowData names(3): ID Symbol Type
    ## colnames(545913): s_008um_00301_00321-1 s_008um_00526_00291-1 ...
    ##   s_008um_00353_00477-1 s_008um_00595_00611-1
    ## colData names(12): barcode in_tissue ... in_cell sample_id
    ## reducedDimNames(0):
    ## mainExpName: Gene Expression
    ## altExpNames(0):
    ## spatialCoords names(2) : pxl_col_in_fullres pxl_row_in_fullres
    ## imgData names(4): sample_id image_id data scaleFactor

Cell-level data object construction:

    # retrieval
    id <- "VisiumHD_HumanColon_Oliveira"
    pa <- OSTA.data_load(id)
    dir.create(td <- tempfile())
    unzip(pa, exdir=td)
    vhdcell <- TENxVisiumHD(
        format = "h5",
        segmented_outputs = file.path(td,"segmented_outputs"),
        images = "hires")|>
        import()
    rownames(vhdcell) <- make.unique(rowData(vhdcell)$Symbol)
    vhdcell

    ## class: SpatialExperiment
    ## dim: 18132 220703
    ## metadata(4): resouces spatialList cellseg boundary
    ## assays(1): counts
    ## rownames(18132): SAMD11 NOC2L ... MT-ND6 MT-CYB
    ## rowData names(3): ID Symbol Type
    ## colnames(220703): cellid_000000003-1 cellid_000000004-1 ...
    ##   cellid_000268813-1 cellid_000268814-1
    ## colData names(2): map sample_id
    ## reducedDimNames(0):
    ## mainExpName: Gene Expression
    ## altExpNames(0):
    ## spatialCoords names(2) : pxl_col_in_fullres pxl_row_in_fullres
    ## imgData names(4): sample_id image_id data scaleFactor

## 3.5 Chromium

    # retrieval
    id <- "Chromium_HumanBreast_Janesick"
    pa <- OSTA.data_load(id)
    dir.create(td <- tempfile())
    unzip(pa, exdir=td)
    # importing
    h5 <- list.files(td, "h5$", full.names=TRUE)
    (sce <- read10xCounts(h5))

    ## class: SingleCellExperiment
    ## dim: 18082 30365
    ## metadata(1): Samples
    ## assays(1): counts
    ## rownames(18082): ENSG00000187634 ENSG00000188976 ... ENSG00000198695
    ##   ENSG00000198727
    ## rowData names(3): ID Symbol Type
    ## colnames: NULL
    ## colData names(2): Sample Barcode
    ## reducedDimNames(0):
    ## mainExpName: NULL
    ## altExpNames(0):

# 4 Session

    sessionInfo()

    ## R version 4.6.0 Patched (2026-04-24 r89963)
    ## Platform: aarch64-apple-darwin23
    ## Running under: macOS Tahoe 26.3.1
    ##
    ## Matrix products: default
    ## BLAS:   /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRblas.0.dylib
    ## LAPACK: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1
    ##
    ## locale:
    ## [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
    ##
    ## time zone: America/New_York
    ## tzcode source: internal
    ##
    ## attached base packages:
    ## [1] stats4    stats     graphics  grDevices utils     datasets  methods
    ## [8] base
    ##
    ## other attached packages:
    ##  [1] SpatialExperimentIO_1.4.0   DropletUtils_1.32.0
    ##  [3] OSTA.data_1.4.0             VisiumIO_1.8.0
    ##  [5] TENxIO_1.14.0               SingleCellExperiment_1.34.0
    ##  [7] SummarizedExperiment_1.42.0 Biobase_2.72.0
    ##  [9] GenomicRanges_1.64.0        Seqinfo_1.2.0
    ## [11] IRanges_2.46.0              S4Vectors_0.50.0
    ## [13] BiocGenerics_0.58.0         generics_0.1.4
    ## [15] MatrixGenerics_1.24.0       matrixStats_1.5.0
    ## [17] BiocStyle_2.40.0
    ##
    ## loaded via a namespace (and not attached):
    ##  [1] DBI_1.3.0                 httr2_1.2.2
    ##  [3] rlang_1.2.0               magrittr_2.0.5
    ##  [5] otel_0.2.0                e1071_1.7-17
    ##  [7] compiler_4.6.0            RSQLite_2.4.6
    ##  [9] DelayedMatrixStats_1.34.0 vctrs_0.7.3
    ## [11] httpcode_0.3.0            pkgconfig_2.0.3
    ## [13] SpatialExperiment_1.22.0  fastmap_1.2.0
    ## [15] dbplyr_2.5.2              magick_2.9.1
    ## [17] XVector_0.52.0            scuttle_1.22.0
    ## [19] rmarkdown_2.31            tzdb_0.5.0
    ## [21] purrr_1.2.2               bit_4.6.0
    ## [23] xfun_0.57                 cachem_1.1.0
    ## [25] beachmat_2.28.0           jsonlite_2.0.0
    ## [27] blob_1.3.0                rhdf5filters_1.24.0
    ## [29] DelayedArray_0.38.0       Rhdf5lib_2.0.0
    ## [31] BiocParallel_1.46.0       parallel_4.6.0
    ## [33] R6_2.6.1                  bslib_0.10.0
    ## [35] stringi_1.8.7             limma_3.68.0
    ## [37] jquerylib_0.1.4           Rcpp_1.1.1-1.1
    ## [39] bookdown_0.46             assertthat_0.2.1
    ## [41] knitr_1.51                triebeard_0.4.1
    ## [43] R.utils_2.13.0            readr_2.2.0
    ## [45] BiocBaseUtils_1.14.0      Matrix_1.7-5
    ## [47] tidyselect_1.2.1          abind_1.4-8
    ## [49] yaml_2.3.12               codetools_0.2-20
    ## [51] curl_7.1.0                lattice_0.22-9
    ## [53] tibble_3.3.1              withr_3.0.2
    ## [55] evaluate_1.0.5            sf_1.1-0
    ## [57] units_1.0-1               proxy_0.4-29
    ## [59] BiocFileCache_3.2.0       pillar_1.11.1
    ## [61] BiocManager_1.30.27       filelock_1.0.3
    ## [63] KernSmooth_2.23-26        hms_1.1.4
    ## [65] sparseMatrixStats_1.24.0  class_7.3-23
    ## [67] glue_1.8.1                tools_4.6.0
    ## [69] BiocIO_1.22.0             data.table_1.18.2.1
    ## [71] locfit_1.5-9.12           fs_2.1.0
    ## [73] rhdf5_2.56.0              grid_4.6.0
    ## [75] urltools_1.7.3.1          edgeR_4.10.0
    ## [77] HDF5Array_1.40.0          cli_3.6.6
    ## [79] rappdirs_0.3.4            S4Arrays_1.12.0
    ## [81] arrow_23.0.1.2            dplyr_1.2.1
    ## [83] R.methodsS3_1.8.2         sass_0.4.10
    ## [85] digest_0.6.39             classInt_0.4-11
    ## [87] SparseArray_1.12.0        crul_1.6.0
    ## [89] dqrng_0.4.1               osfr_0.2.9
    ## [91] rjson_0.2.23              memoise_2.0.1
    ## [93] htmltools_0.5.9           R.oo_1.27.1
    ## [95] lifecycle_1.0.5           h5mread_1.4.0
    ## [97] httr_1.4.8                statmod_1.5.1
    ## [99] bit64_4.8.0