SpatialFeatureExperiment: An S4 Class Bringing Geospatial Tools To Spatial Omics***

SpatialFeatureExperiment: An S4 Class Bringing Geospatial Tools To Spatial Omics***


Author(s): Lambda Moses, Lior Pachter

Affiliation(s): California Institute of Technology

Twitter: @LambdaMoses

Spatial localization of gene expression and histological images in spatial transcriptomics present many opportunities unavailable to non-spatial single cell RNA-seq (scRNA-seq). Some existing data analysis packages for spatial transcriptomics have been inspired by spatial statistics originally developed for geospatial data, such as Moran's I, Ripley's K, and Gaussian process regression. However, as existing tools generally regard cells or Visium spots as points and non-spatial methods are still widely used, many such opportunities have been missed. Here we present the SpatialFeatureExperiment (SFE) package, which implements an S4 class extending SpatialExperiment (SPE), to better take advantage of such opportunities. SF is a popular and well-established geospatial package that provides an R interface to the standard Simple Features representation of geometries and the GEOS C++ library for geometry operations. SFE brings sf to SPE, representing geometries associated with columns of the gene count matrix such as nuclei and cell segmentation and Visium spot polygons as sf data frames. Annotations such as tissue boundaries and histological regions, and annotated objects not corresponding to the columns such as nuclei segmentation in a Visium dataset, can also be stored in the SFE object as sf data frames. With sf, fast geometry operations can be applied, such as to find the number of nuclei in each Visium spot and which histological region each Visium spot intersects. In addition, spatial neighborhood graphs of cells/spots and of other annotated objects can be stored in the SFE object, to be used with classical geospatial tools, such as spatial dependence analyses with the spdep package and multivariate spatial analyses with the adespatial package. We demonstrate the opportunities presented by geospatial tools in an analysis of a Visium mouse skeletal muscle regeneration dataset using SFE. We performed spatial autocorrelation, hot spot analyses, and geographically weighted principal component analysis (GWPCA) of myofiber and nuclei morphology and identified histological regions based on these analyses. Spatial autocorrelation of canonical scRNA-seq quality control (QC) metrics such as library size and number of genes detected per spot is also examined. In addition, we relate the morphology and number of nuclei and myofibers in each Visium spot to gene expression. We plan to submit the SpatialFeatureExperiment to Bioconductor; the development version can be accessed on GitHub: https://github.com/pachterlab/SpatialFeatureExperiment.

Package demo details

Source code

Orchestra

1. Go to Orchestra.
2. Log in.
3. Search for the workshop of interest.
4. Click "Launch" (may take a minute or two).
5. Follow instructions.

On YouTube: