In the following tutorial, we examine the recently published Microwell-seq “Mouse Cell Atlas”, composed of hundreds of thousands of cells derived from all major mouse organs. For those that are getting started using Seurat, we recommend first working through our 3k PBMC tutorial, which introduces the basic functionality of the package.

Our goal is to demonstrate a workflow for handling very large datasets in Seurat, emphasizing recent improvements we have made for speed and memory efficiency. We do not perform downstream biological analyses on the resulting clusters, but encourage users to explore this dataset and interpret this exciting resource. All analyses here are performed in memory, but we also now support storage on-disk (using the HDF5-based loom framework). See this vignette for a workflow of the same MCA dataset using loomR.

Setup the Seurat Object

The original data for the MCA is available here. For ease of getting started, we provide a sparse matrix R data file (.rds) file containing the combined expression matrix and the published metadata file here.

mca.matrix <- readRDS(file = "../data/MCA_merged_mat.rds")
mca.metadata <- read.csv(file = "../data/MCA_All-batch-removed-assignments.csv", row.names = 1)

We will analyze ~242,000 cells that were assigned a cluster ID in the original study. As a result, we don’t do perform additional QC steps or filtration steps here.

mca <- CreateSeuratObject(counts = mca.matrix, = mca.metadata, project = "MouseCellAtlas")
# Only keep annotated cells
mca <- subset(mca, cells = names(which(!$ClusterID))))
# Leaves us with 242k cells
## An object of class Seurat 
## 39855 features across 242533 samples within 1 assay 
## Active assay: RNA (39855 features)

Data Preprocessing

We perform standard log-normalization.

mca <- NormalizeData(mca, normalization.method = "LogNormalize", scale.factor = 10000)

FindVariableGenes calculates the variance and mean for each gene in the dataset in the dataset (storing this in object[[assay]]@meta.features). We have observed that for large-cell datasets with unique molecular identifiers, selecting highly variable genes (HVG) simply based on variance mean ratio (VMR) is an efficient and robust strategy. Here, we select the top 1,000 HVG for downstream analysis.

mca <- FindVariableFeatures(mca)

We calculate and regress out mitochondrial expression per cell.

Suggestions for large datasets
  • ScaleData now has the option for multi-core parallel processing, using the future framework.
  • You can perform gene scaling on only the HVF, dramatically improving speed and memory use. Since dimensional reduction is run only on HVF, this will not affect downstream results.
mca[[""]] <- PercentageFeatureSet(mca, pattern = "^mt-")
mca <- ScaleData(mca, = "")

Dimensional Reduction (PCA)

mca <- RunPCA(mca, npcs = 100, ndims.print = 1:5, nfeatures.print = 5)
## PC_ 1 
## Positive:  Lyz2, S100a8, S100a6, S100a9, Igkc 
## Negative:  Fabp9, Meig1, Prm1, Ldhc, Prm2 
## PC_ 2 
## Positive:  Lypd8, Reg3b, Lgals2, Reg3g, Lgals4 
## Negative:  Sparc, Col2a1, Col9a2, Col9a1, Col9a3 
## PC_ 3 
## Positive:  Plp1, Mobp, Mag, Ermn, Cldn11 
## Negative:  Sparc, Mgp, Col2a1, Col9a2, Col9a1 
## PC_ 4 
## Positive:  Zpbp2, Hdgfl1, Pabpc6, Tmbim7, Tuba3a 
## Negative:  1700031M16Rik, 1700042G07Rik, 4930570D08Rik, 1700016P04Rik, H1fnt 
## PC_ 5 
## Positive:  Plp1, Mobp, Mag, Ermn, Cldn11 
## Negative:  S100a8, S100a9, Camp, Ngp, Ly6c2
Suggestions for large datasets
  • To select downstream PCs for analysis, JackStraw now also features mutli-core parallelization. However, for data sets of this size, the saturation of explained variance, along with the visualization of PC ‘metagenes’, are likely to be more effective. We select 75 PCs here for downstream analysis.
ElbowPlot(mca, ndims = 100)

DimHeatmap(mca, dims = c(1:3, 70:75), cells = 500, balanced = TRUE)