---
title: "TENxXeniumData"
author:
- name: Matineh Rahmatbakhsh
  affiliation: ProCogia, Vancouver, Canada
- name: Monica Ge 
  affiliation: Genentech, South San Francisco, California, USA
output:
  BiocStyle::html_document:
  toc_float: true
package: TENxXeniumData
abstract: |
  The TENxXeniumData ExperimentHub package provides a collection of Xenium 
  spatial transcriptomics datasets by 10X Genomics. These datasets have been 
  formatted into the Bioconductor classes, the SpatialExperiment or 
  SpatialFeatureExperiment (SFE), to facilitate seamless integration into 
  various applications, including examples, demonstrations, and tutorials. 
  The constructed data objects include gene expression profiles, 
  per-transcript location data, centroid, segmentation boundaries 
  (e.g., cell or nucleus boundaries), and image.
vignette: |
  %\VignetteIndexEntry{TENxXeniumData}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---


  
```{r include = FALSE}
knitr::opts_chunk$set(message = FALSE, warning = FALSE, error = FALSE)
```


# Introduction
Image-based spatial data, like Xenium, is typically focused on profiling a 
pre-selected set of genes. Such data can achieve resolution at the level of 
individual molecules, preserving both single-cell and subcellular details. 
Additionally, these methods often capture cellular boundaries through 
segmentations.

The `TENxXeniumData` package aims to provide a curated collection of Xenium 
spatial transcriptomics datasets provided by 10X Genomics. These 
datasets are formatted into Bioconductor classes, specifically the 
SpatialExperiment or SpatialFeatureExperiment (SFE). Similar to [SFEData](https://bioconductor.org/packages/SFEData/), 
TENxXeniumData is designed as an ExperimentHub package focusing on Spatial 
Data, with a specific emphasis on Xenium.

A notable distinction lies in our constructed data object, where our primary 
focus is on Xenium data. We aim to capture detected molecules/transcripts 
crucial for gaining insights into subcellular details related to specific 
markers and the imaging data, in addition to the gene expression profile of 
each cell, the centroid, and the boundary of each cell. 
Additionally, we have chosen to employ SpatialExperiment as an alternative 
scheme for data representation.  In this scheme, cellular segmentations 
are integrated into per-cell metadata of the constructed object,


# Installation

To install the `TENxXeniumData` package from GitHub:
  
```{r, eval=FALSE}
if (!require("BiocManager", quietly = TRUE))
  install.packages("BiocManager")

BiocManager::install("TENxXeniumData")
```

# Available datasets
The `TENxXeniumData` package provides an R/Bioconductor resource for 
[Xenium spatially-resolved data by 10X Genomics](https://support.10xgenomics.com/spatial-gene-expression/datasets). 
The package currently includes the following datasets:
  
* [Mouse Brain: 10x Genomics Xenium In Situ (Tiny Subset)](https://www.10xgenomics.com/resources/datasets/fresh-frozen-mouse-brain-for-xenium-explorer-demo-1-standard)
  * `spe_mouse_brain` (SpatialExperiment Bioconductor class)
  * `sfe_mouse_brain` (SpatialFeatureExperiment Bioconductor class)
 

* [Human Pancreas: 10x Genomics Xenium In Situ](https://www.10xgenomics.com/resources/datasets/human-pancreas-preview-data-xenium-human-multi-tissue-and-cancer-panel-1-standard)
  * `spe_human_pancreas` (SpatialExperiment Bioconductor class)
  * `sfe_human_pancreas` (SpatialFeatureExperiment Bioconductor class)  

A list of currently available datasets can be obtained using the ExperimentHub 
interface:
  
```{r, message=FALSE}
library(SpatialExperiment)
library(SpatialFeatureExperiment)
library(TENxXeniumData)
library(BumpyMatrix)
library(SummarizedExperiment)

eh <- ExperimentHub()
(q <- query(eh, "TENxXenium"))
```

# Loading the data
The following examples illustrate the process of loading the provided 
datasets into your R session, representing them as objects of 
the `SpatialExperiment` or `SpatialFeatureExperiment` classes.

Loading SpatialExperiment object:
```{r, message=FALSE}
# load object
spe <- spe_mouse_brain()

# check object
spe
```

```{r}
# here, cellular segmentations are stored in per-cell metadata 
colData(spe)
```

Loading SpatialFeatureExperiment object:
```{r, message=FALSE}
# load object
sfe <- sfe_mouse_brain()

# check object
sfe
```

# Session information

```{r}
sessionInfo()
```

