Spatial Analysis Tutorial

Author: Bo Li
Date: 2022-03-09
Notebook Source: spatial_analysis.ipynb

This tutorial runs analysis on a 10x Visium mouse brain section dataset with Pegasus.

Load data

You can download the data at https://storage.googleapis.com/terra-featured-workspaces/Cumulus/mouse_brain_10x.tar.gz.

After downloading, unzip the tar ball file and load the data into memory:

Quality Control (QC)

Calculate statistics for QC

First calculate QC metrics before filtration. Notice that mouse mito gene names start with mt-.

Then we can view the metrics. For example, the code below shows the 2.5% and 97.5% quantiles for number of genes:

QC filtration

Based on the quantiles above, we filter the data by number of genes between 2.5% and 97.5%, and percent of mito gene expression below 20%:

Now do the actual filteration below:

And identify robust genes:

Downstream analysis to get clusters

Run the code below to show the UMAP plot of cells colored by cluster labels generated by Leiden algorithm on their PCA embedding:

DE analysis

Run the function below to perform Differential Expression analysis:

Cell type annotation

This is to annotate cluster-specific cell types with preset mouse brain markers:

Plotting

Besides the UMAP plot, Pegasus also provides spatial function to generate spatial plots. Below is the spatial plot of cells colored by their cell types:

Save results