DR-SC: DLPFC Data Analysis

Wei Liu

2024-03-19

The package can be loaded with the command:

library("DR.SC")

Fit DR-SC using real data DLPFC

To fit DR-SC model, we first require to create a Seurat object with meta.data including spatial coordinates in columns must named “row” (x coordinates) and “col” (y coordinates)!

Prepare Seurat object for DR-SC

We start this tutorial with creating the Seurat object. Users who are familar with Seurat object, can skip this subsection and go to next subsection.

First, we load the subset data of DLPFC 151510, dlpfc151510. Although it is saved as a Seurat object prepared for DR-SC, we re-create the Seurat object to show how to prepare the Seurat object for DR-SC.

Second, we create a Seurat object using the count matrix in dlpfc151510 and the spatial coordinates in the meta.data slot.

Until now, the data preparation with Seurat object format is finished, and we can go to next step: preprocessing.

Data preprocessing

This preprocessing includes Log-normalization and feature selection. Here we select highly variable genes for example first. The selected genes’ names are saved in “

Fit DR-SC model using 500 highly variable features

We fit the DR-SC model by using the highly variable genes.

### Given K
seu <- DR.SC(seu, K=7, platform = 'Visium', verbose=T, approxPCA=T)

Visualization

Show the tSNE plot based on the extracted features from DR-SC.

Show the UMAP plot based on the extracted features from DR-SC.

Fit DR-SC model using 480 spatially variable features

In spatially resolved transcriptomics data analysis, we recommend users using the spatially variable genes for analysis. We embeded the method SPARK-X (developed by Xiang Zhou’s Lab) into DR.SC package, which can be called using FindSVGs. The selected genes’ names are also saved in “” and the order is determined by the statistical significance, where the gene with highest significance ranks first. We note there are some difference between SVGs and HVGs.

# choose 480 spatially variable features
seus <- FindSVGs(seu, nfeatures = 480)
seus@assays$RNA@var.features[1:10]

We fit DR-SC model by using the selected spatially variable genes.

### Given K
seus <- DR.SC(seus,  K=7, platform = 'Visium', verbose=F, approxPCA=T)

Visualization

Next, we show the application of DR-SC in visualization. First, we can visualize the clusters from DR-SC on the spatial coordinates.

We can also visualize the clusters from DR-SC on the two-dimensional tSNE based on the extracted features from DR-SC.

Similarly, can also visualize the clusters from DR-SC on the two-dimensional UMAP based on the extracted features from DR-SC.

Since DR.SC uses the Seurat object to save results, all visualization functions in Seurat package can used to visualize the results of DR-SC, such as ridge plot, feature plot, dot plot and so on. ### Ridge plots we show the application of DR-SC in differential expression analysis. Find the marker genes in SVGs for each clusters.

Visualize single cell expression distributions in each cluster from Seruat.

Violin plot

Visualize single cell expression distributions in each cluster

Feature plot

We extract tSNE based on the features from DR-SC and then visualize feature expression in the low-dimensional space

Dot plots

The size of the dot corresponds to the percentage of cells expressing the feature in each cluster. The color represents the average expression level

Heatmap plot

Single cell heatmap of feature expression

Fit DR-SC model using 480 spatially variable features and using MBIC to determine clusters

# choose spatially variable features
seus <- FindSVGs(seu, nfeatures = 480, verbose = F)

We set the argument variable.type=‘SVGs’ (default option) to use the spatially variable genes.

### Given K
seus <- DR.SC(seus, K=3:9, platform = 'Visium', verbose=F)

Plot the MBIC curve

seus <- selectModel(seus, pen.const = 0.8)
mbicPlot(seus)

Show the spatial scatter plot for clusters

spatialPlotClusters(seus)

Show the tSNE plot based on the extracted features from DR-SC.

drscPlot(seus, dims=1:10)

Session information

sessionInfo()