DR-SC: DLPFC Data Analysis

Wei Liu

2022-05-27

The package can be loaded with the command:

library("DR.SC")

Fit DR-SC using real data HCC1

load the data HCC1 in package DR.SC

data("dlpfc151510", package = 'DR.SC')

Data preprocessing

library(Seurat)
# standard log-normalization
dlpfc151510 <- NormalizeData(dlpfc151510, verbose = F)
# choose 500 highly variable features
seu <- FindVariableFeatures(dlpfc151510, nfeatures = 500, verbose = F)

Fit DR-SC model using 1000 highly variable features

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

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

Visualization

spatialPlotClusters(seu)

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

drscPlot(seu)

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

drscPlot(seu, visu.method = 'UMAP')

Fit DR-SC model using 480 spatially variable features

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

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

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

Visualization

Show the spatial scatter plot for clusters

spatialPlotClusters(seus)

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

drscPlot(seus)

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

drscPlot(seus, visu.method = 'UMAP')

Ridge plots

Find the marker genes in SVGs for each clusters

SVGs <- topSVGs(seus, ntop = 400)
dat <- FindAllMarkers(seus, features = SVGs)
head(dat)
library(dplyr, verbose=F)
top2 <-  dat %>%
  group_by(cluster) %>%
  top_n(n = 2, wt = avg_log2FC)
top2

Visualize single cell expression distributions in each cluster from Seruat.

genes <- top2$gene[seq(1, 12, by=2)]
RidgePlot(seus, features = genes, ncol = 2)

Violin plot

Visualize single cell expression distributions in each cluster


VlnPlot(seus, features = genes, ncol=2)

Feature plot

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

seus <- RunTSNE(seus, reduction="dr-sc", reduction.key='drsc_tSNE_')
FeaturePlot(seus, features = genes, reduction = 'tsne' ,ncol=2)

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

DotPlot(seus, features = genes)

Heatmap plot

Single cell heatmap of feature expression

top20 <-  dat %>%
  group_by(cluster) %>%
  top_n(n = 20, wt = avg_log2FC)
genes <- top20$gene
# standard scaling (no regression)
seus <- ScaleData(seus)
DoHeatmap(subset(seus, downsample = 500), features = genes, size = 5)

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

# choose 2000 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()