Analysis, visualization, and integration of spatial datasets with Seurat
This tutorial demonstrates how to use Seurat v3.2 to analyze spatially-resolved RNA-seq data. While the analytical pipelines are similar to the Seurat workflow for single-cell RNA-seq analysis, we introduce updated interaction and visualization tools, with a particular emphasis on the integration of spatial and molecular information. This tutorial will cover the following tasks, which we believe will be common for many spatial analyses:
- Dimensional reduction and clustering
- Detecting spatially-variable features
- Interactive visualization
- Integration with single-cell RNA-seq data
- Working with multiple slices
For our first vignette, we analyze a dataset generated with the Visium technology from 10x Genomics. We will be extending Seurat to work with additional data types in the near-future, including SLIDE-Seq, STARmap, and MERFISH.
Seurat v3.2 is currently in a pre-release beta stage and is available for installation through Github.
devtools::install_github("satijalab/seurat", ref = "spatial")
First, we load Seurat and the other packages necessary for this vignette.
library(Seurat) library(SeuratData) library(ggplot2) library(patchwork) library(dplyr)
Here, we will be using a recently released dataset of sagital mouse brain slices generated using the Visium v1 chemistry. There are two serial anterior sections, and two (matched) serial posterior sections.
You can download the data here, and load it into Seurat using the
Load10X_Spatial function. This reads in the output of the spaceranger pipeline, and returns a Seurat object that contains both the spot-level expression data along with the associated image of the tissue slice. You can also use our SeuratData package for easy data access, as demonstrated below. After installing the dataset, you can type
?stxBrain to learn more.
InstallData("stxBrain") brain <- LoadData("stxBrain", type = "anterior1")
How is the spatial data stored within Seurat? The visium data from 10x consists of the following data types:
- A spot by gene expression matrix
- An image of the tissue slice (obtained from H&E staining during data acquisition)
- Scaling factors that relate the original high resolution image to the lower resolution image used here for visualization.
In the Seurat object, the spot by gene expression matrix is similar to a typical “RNA”
Assay but contains spot level, not single-cell level data. The image itself is stored in a new
images slot in the Seurat object. The
images slot also stores the information necessary to associate spots with their physical position on the tissue image.
The initial preprocessing steps that we perform on the spot by gene expression data are similar to a typical scRNA-seq experiment. We first need to normalize the data in order to account for variance in sequencing depth across data points. We note that the variance in molecular counts / spot can be substantial for spatial datasets, particularly if there are differences in cell density across the tissue. We see substantial heterogeneity here, which requires effective normalization.
plot1 <- VlnPlot(brain, features = "nCount_Spatial", pt.size = 0.1) + NoLegend() plot2 <- SpatialFeaturePlot(brain, features = "nCount_Spatial") + theme(legend.position = "right") wrap_plots(plot1, plot2)