The package can be loaded with the command:
library("DR.SC")data("dlpfc151510", package = 'DR.SC')library(Seurat)
# standard log-normalization
dlpfc151510 <- NormalizeData(dlpfc151510, verbose = F)
# choose 500 highly variable features
seu <- FindVariableFeatures(dlpfc151510, nfeatures = 500, verbose = F)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)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')# 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)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')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)
top2Visualize single cell expression distributions in each cluster from Seruat.
genes <- top2$gene[seq(1, 12, by=2)]
RidgePlot(seus, features = genes, ncol = 2)Visualize single cell expression distributions in each cluster
VlnPlot(seus, features = genes, ncol=2)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)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)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)# 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)sessionInfo()