This tutorial is adapted from the Seurat vignette: https://satijalab.org/seurat/v3.2/spatial_vignette.html
Spatial transcriptomic data with the Visium platform is in many ways similar to scRNAseq data. It contains UMI counts for 5-20 cells instead of single cells, but is still quite sparse in the same way as scRNAseq data is, but with the additional information about spatial location in the tissue.
Here we will first run quality control in a similar manner to scRNAseq data, then QC filtering, dimensionality reduction, integration and clustering. Then we will use scRNAseq data from mouse cortex to run LabelTransfer to predict celltypes in the Visium spots.
We will use two Visium spatial transcriptomics dataset of the mouse brain (Sagittal), which are publicly available from the 10x genomics website. Note, that these dataset have already been filtered for spots that does not overlap with the tissue.
## ## checking for file ‘/tmp/RtmpcVJCPY/remotes118eae37e56/satijalab-seurat-data-c633765/DESCRIPTION’ ... ✔ checking for file ‘/tmp/RtmpcVJCPY/remotes118eae37e56/satijalab-seurat-data-c633765/DESCRIPTION’ (561ms) ## ─ preparing ‘SeuratData’: ## checking DESCRIPTION meta-information ... ✔ checking DESCRIPTION meta-information ## ─ checking for LF line-endings in source and make files and shell scripts (385ms) ## ─ checking for empty or unneeded directories ## ─ building ‘SeuratData_0.2.1.tar.gz’ ## ##
suppressPackageStartupMessages(require(Matrix)) suppressPackageStartupMessages(require(dplyr)) suppressPackageStartupMessages(require(SeuratData)) suppressPackageStartupMessages(require(Seurat)) suppressPackageStartupMessages(require(ggplot2)) suppressPackageStartupMessages(require(patchwork)) suppressPackageStartupMessages(require(dplyr))
SeuratData has some seurat objects for different datasets. Among those are spatial transcriptomics data from mouse brain and kidney. Here we will download and process sections from the mouse brain.
= "data/spatial/" outdir dir.create(outdir, showWarnings = F) # to list available datasets in SeuratData you can run AvailableData() # first we dowload the dataset InstallData("stxBrain") ## Check again that it works, did not work at first... # now we can list what datasets we have downloaded InstalledData()
# now we will load the seurat object for one section <- LoadData("stxBrain", type = "anterior1") brain1 <- LoadData("stxBrain", type = "posterior1")brain2
Merge into one seurat object
<- merge(brain1, brain2) brain brain
## An object of class Seurat ## 31053 features across 6049 samples within 1 assay ## Active assay: Spatial (31053 features, 0 variable features)
As you can see, now we do not have the assay “RNA”, but instead an assay called “Spatial”.
##Quality control ***
Similar to scRNAseq we use statistics on number of counts, number of features and percent mitochondria for quality control.
Now the counts and feature counts are calculated on the Spatial assay, so they are named “nCount_Spatial” and “nFeature_Spatial”.
<- PercentageFeatureSet(brain, "^mt-", col.name = "percent_mito") brain <- PercentageFeatureSet(brain, "^Hb.*-", col.name = "percent_hb") brain VlnPlot(brain, features = c("nCount_Spatial", "nFeature_Spatial", "percent_mito", "percent_hb"), pt.size = 0.1, ncol = 2) + NoLegend()