DR-SC: installation and simulation

Wei Liu

2021-11-19

Install the DR.SC

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:

library("DR.SC")

Fit DR-SC using simulated data

Generating the simulated data

First, we generate the spatial transcriptomics data with lattice neighborhood, i.e. ST platform.

Fitting model by using DR.SC function

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.

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:

Visualizations of marker gene expression

Ridge plots

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

Session information

sessionInfo()