值得一提的是,您使用的数据可以从此链接下载并创建如下:
library(Seurat)
library(magrittr)
pbmc.big <- Read10X(data.dir = "../data/pbmc3k/filtered_gene_bc_matrices/hg19/")
pbmc.big <- CreateSeuratObject(counts = pbmc.big)
pbmc.big$percent.mito = PercentageFeatureSet(pbmc.big,pattern="^MT-")
运行集群:
pbmc.big = pbmc.big %>%
SCTransform() %>%
RunPCA() %>%
RunTSNE(dims=1:15) %>%
FindNeighbors(dims=1:15) %>%
FindClusters(res=0.1)
你可以这样刻面:
g = FeatureScatter(object = pbmc.big,
feature1 = "MALAT1",
feature2 = "percent.mito",
plot.cor = TRUE)
g + facet_wrap(~colors)
缺少相关性,如果需要,一种方法是提取变量并绘制图:
library(ggpubr)
data.frame(cluster = Idents(pbmc.big),
MALAT1 = FetchData(pbmc.big,"MALAT1"),
percent.mito = FetchData(pbmc.big,"percent.mito")) %>%
ggplot(aes(x=MALAT1 , y= percent.mito, col = cluster)) +
geom_point(size=1) +
facet_wrap(~cluster)+
stat_cor(method = "pearson")