The TENxVisiumData ExperimentHub package provides a collection of Visium spatial gene expression datasets by 10X Genomics. Data cover various organisms and tissues, and are formatted into objects of class SpatialExperiment.
TENxVisiumData 1.10.0
The TENxVisiumData
package provides an R/Bioconductor resource for
Visium spatial gene expression datasets by 10X Genomics. The package currently includes 13 datasets from 23 samples across two organisms (human and mouse) and 13 tissues:
A list of currently available datasets can be obtained using the ExperimentHub
interface:
library(ExperimentHub)
eh <- ExperimentHub()
(q <- query(eh, "TENxVisium"))
## ExperimentHub with 26 records
## # snapshotDate(): 2023-10-24
## # $dataprovider: 10X Genomics
## # $species: Homo sapiens, Mus musculus
## # $rdataclass: SpatialExperiment
## # additional mcols(): taxonomyid, genome, description,
## # coordinate_1_based, maintainer, rdatadateadded, preparerclass, tags,
## # rdatapath, sourceurl, sourcetype
## # retrieve records with, e.g., 'object[["EH6695"]]'
##
## title
## EH6695 | HumanBreastCancerIDC
## EH6696 | HumanBreastCancerILC
## EH6697 | HumanCerebellum
## EH6698 | HumanColorectalCancer
## EH6699 | HumanGlioblastoma
## ... ...
## EH6739 | HumanSpinalCord_v3.13
## EH6740 | MouseBrainCoronal_v3.13
## EH6741 | MouseBrainSagittalPosterior_v3.13
## EH6742 | MouseBrainSagittalAnterior_v3.13
## EH6743 | MouseKidneyCoronal_v3.13
To retrieve a dataset, we can use a dataset’s corresponding named function <id>()
, where <id>
should correspond to one a valid dataset identifier (see ?TENxVisiumData
). E.g.:
library(TENxVisiumData)
spe <- HumanHeart()
Alternatively, data can loaded directly from Bioconductor’s ExerimentHub as follows. First, we initialize a hub instance and store the complete list of records in a variable eh
. Using query()
, we then identify any records made available by the TENxVisiumData
package, as well as their accession IDs (EH1234). Finally, we can load the data into R via eh[[id]]
, where id
corresponds to the data entry’s identifier we’d like to load. E.g.:
library(ExperimentHub)
eh <- ExperimentHub() # initialize hub instance
q <- query(eh, "TENxVisium") # retrieve 'TENxVisiumData' records
id <- q$ah_id[1] # specify dataset ID to load
spe <- eh[[id]] # load specified dataset
Each dataset is provided as a SpatialExperiment (SPE), which extends the SingleCellExperiment (SCE) class with features specific to spatially resolved data:
spe
## class: SpatialExperiment
## dim: 36601 7785
## metadata(0):
## assays(1): counts
## rownames(36601): ENSG00000243485 ENSG00000237613 ... ENSG00000278817
## ENSG00000277196
## rowData names(1): symbol
## colnames(7785): AAACAAGTATCTCCCA-1 AAACACCAATAACTGC-1 ...
## TTGTTTGTATTACACG-1 TTGTTTGTGTAAATTC-1
## colData names(1): sample_id
## reducedDimNames(0):
## mainExpName: NULL
## altExpNames(0):
## spatialCoords names(2) : pxl_col_in_fullres pxl_row_in_fullres
## imgData names(4): sample_id image_id data scaleFactor
For details on the SPE class, we refer to the package’s vignette. Briefly, the SPE harbors the following data in addition to that stored in a SCE:
spatialCoords
; a numeric matrix of spatial coordinates, stored inside the object’s int_colData
:
head(spatialCoords(spe))
## pxl_col_in_fullres pxl_row_in_fullres
## AAACAAGTATCTCCCA-1 15937 17428
## AAACACCAATAACTGC-1 18054 6092
## AAACAGAGCGACTCCT-1 7383 16351
## AAACAGGGTCTATATT-1 15202 5278
## AAACAGTGTTCCTGGG-1 21386 9363
## AAACATTTCCCGGATT-1 18549 16740
spatialData
; a DFrame
of spatially-related sample metadata, stored as part of the object’s colData
. This colData
subset is in turn determined by the int_metadata
field spatialDataNames
:
head(spatialData(spe))
## DataFrame with 6 rows and 0 columns
imgData
; a DFrame
containing image-related data, stored inside the int_metadata
:
imgData(spe)
## DataFrame with 2 rows and 4 columns
## sample_id image_id data scaleFactor
## <character> <character> <list> <numeric>
## 1 HumanBreastCancerIDC1 lowres #### 0.0247525
## 2 HumanBreastCancerIDC2 lowres #### 0.0247525
Datasets with multiple sections are consolidated into a single SPE with colData
field sample_id
indicating each spot’s sample of origin. E.g.:
spe <- MouseBrainSagittalAnterior()
table(spe$sample_id)
##
## MouseBrainSagittalAnterior1 MouseBrainSagittalAnterior2
## 2695 2825
Datasets of targeted analyses are provided as a nested SPE, with whole transcriptome measurements as primary data, and those obtained from targeted panels as altExp
s. E.g.:
spe <- HumanOvarianCancer()
altExpNames(spe)
## [1] "TargetedImmunology" "TargetedPanCancer"
sessionInfo()
## R version 4.3.1 (2023-06-16)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.3 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.18-bioc/R/lib/libRblas.so
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_GB LC_COLLATE=C
## [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: America/New_York
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats4 stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] Matrix_1.6-1.1 TENxVisiumData_1.10.0
## [3] SpatialExperiment_1.12.0 SingleCellExperiment_1.24.0
## [5] SummarizedExperiment_1.32.0 Biobase_2.62.0
## [7] GenomicRanges_1.54.0 GenomeInfoDb_1.38.0
## [9] IRanges_2.36.0 S4Vectors_0.40.0
## [11] MatrixGenerics_1.14.0 matrixStats_1.0.0
## [13] ExperimentHub_2.10.0 AnnotationHub_3.10.0
## [15] BiocFileCache_2.10.0 dbplyr_2.3.4
## [17] BiocGenerics_0.48.0 BiocStyle_2.30.0
##
## loaded via a namespace (and not attached):
## [1] tidyselect_1.2.0 dplyr_1.1.3
## [3] blob_1.2.4 filelock_1.0.2
## [5] Biostrings_2.70.1 bitops_1.0-7
## [7] fastmap_1.1.1 RCurl_1.98-1.12
## [9] promises_1.2.1 digest_0.6.33
## [11] mime_0.12 lifecycle_1.0.3
## [13] ellipsis_0.3.2 KEGGREST_1.42.0
## [15] interactiveDisplayBase_1.40.0 RSQLite_2.3.1
## [17] magrittr_2.0.3 compiler_4.3.1
## [19] rlang_1.1.1 sass_0.4.7
## [21] tools_4.3.1 utf8_1.2.4
## [23] yaml_2.3.7 knitr_1.44
## [25] S4Arrays_1.2.0 bit_4.0.5
## [27] curl_5.1.0 DelayedArray_0.28.0
## [29] abind_1.4-5 withr_2.5.1
## [31] purrr_1.0.2 grid_4.3.1
## [33] fansi_1.0.5 xtable_1.8-4
## [35] cli_3.6.1 rmarkdown_2.25
## [37] crayon_1.5.2 generics_0.1.3
## [39] rjson_0.2.21 httr_1.4.7
## [41] DBI_1.1.3 cachem_1.0.8
## [43] zlibbioc_1.48.0 AnnotationDbi_1.64.0
## [45] BiocManager_1.30.22 XVector_0.42.0
## [47] vctrs_0.6.4 jsonlite_1.8.7
## [49] bookdown_0.36 bit64_4.0.5
## [51] magick_2.8.1 jquerylib_0.1.4
## [53] glue_1.6.2 BiocVersion_3.18.0
## [55] later_1.3.1 tibble_3.2.1
## [57] pillar_1.9.0 rappdirs_0.3.3
## [59] htmltools_0.5.6.1 GenomeInfoDbData_1.2.11
## [61] R6_2.5.1 evaluate_0.22
## [63] shiny_1.7.5.1 lattice_0.22-5
## [65] png_0.1-8 memoise_2.0.1
## [67] httpuv_1.6.12 bslib_0.5.1
## [69] Rcpp_1.0.11 SparseArray_1.2.0
## [71] xfun_0.40 pkgconfig_2.0.3