The package can be loaded with the command:
library("DR.SC")
data("dlpfc151510", package = 'DR.SC')
library(Seurat)
# standard log-normalization
<- NormalizeData(dlpfc151510, verbose = F)
dlpfc151510 # choose 500 highly variable features
<- FindVariableFeatures(dlpfc151510, nfeatures = 500, verbose = F) seu
We set the argument variable.type=‘HVGs’ (default option) to use the highly variable genes.
### Given K
<- DR.SC(seu, K=7, platform = 'Visium', verbose=F) seu
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
<- FindSVGs(seu, nfeatures = 480) seus
We set the argument variable.type=‘SVGs’ (default option) to use the spatially variable genes.
### Given K
<- DR.SC(seus, K=7, platform = 'Visium', verbose=T) seus
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
<- topSVGs(seus, ntop = 400)
SVGs <- FindAllMarkers(seus, features = SVGs)
dat head(dat)
library(dplyr, verbose=F)
<- dat %>%
top2 group_by(cluster) %>%
top_n(n = 2, wt = avg_log2FC)
top2
Visualize single cell expression distributions in each cluster from Seruat.
<- top2$gene[seq(1, 12, by=2)]
genes 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
<- RunTSNE(seus, reduction="dr-sc", reduction.key='drsc_tSNE_')
seus 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
<- dat %>%
top20 group_by(cluster) %>%
top_n(n = 20, wt = avg_log2FC)
<- top20$gene
genes # standard scaling (no regression)
<- ScaleData(seus)
seus DoHeatmap(subset(seus, downsample = 500), features = genes, size = 5)
# choose 2000 spatially variable features
<- FindSVGs(seu, nfeatures = 480, verbose = F) seus
We set the argument variable.type=‘SVGs’ (default option) to use the spatially variable genes.
### Given K
<- DR.SC(seus, K=3:9, platform = 'Visium', verbose=F) seus
Plot the MBIC curve
<- selectModel(seus, pen.const = 0.8)
seus 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()