This vignette provides an introduction to the R package DR.SC
, where the function DR.SC
implements the model DR-SC
, spatial clustering with hidden Markov random field using empirical Bayes. The package can be installed with the command:
library(remotes)
remotes::install_github("feiyoung/DR.SC")
The package can be loaded with the command:
First, we generate the spatial transcriptomics data with lattice neighborhood, i.e. ST platform.
For function DR.SC, users can specify the number of clusters \(K\) or set {K=NULL} by using modified BIC(MBIC) to determine \(K\). First, we try using user-specified number of clusters. Then we show the version chosen by MBIC.
### Given K
library(Seurat)
seu <- NormalizeData(seu)
# choose 2000 variable features using Seurat
seu <- FindVariableFeatures(seu, nfeatures = 2000)
seu2 <- DR.SC(seu, K=4, platform = 'ST', verbose=F)
Using ARI to check the performance of clustering
Show the spatial scatter plot for clusters
Show the tSNE plot based on the extracted features from DR-SC.
Show the UMAP plot based on the extracted features from DR-SC.
Use MBIC to choose number of clusters:
Visualize single cell expression distributions in each cluster from Seruat.
Visualize single cell expression distributions in each cluster
We extract tSNE based on the features from DR-SC and then visualize feature expression in the low-dimensional space
The size of the dot corresponds to the percentage of cells expressing the feature in each cluster. The color represents the average expression level
Single cell heatmap of feature expression