前言
Seurat 包为我们的scRNA分析提供了三种进行差异分析的函数,并给到了我们它们不同的使用状态,了解它们设定的不同目的,可以帮助我们选择正确的函数进行分析。
FindAllMarkers
FindAllMarkers函数用的比较多,官方的解释如下:
FindAllMarkers()will find markers differentially expressed in each identity group by comparing it to all of the others.You don't have to manually define anything. Note that markers may bleed over between closely-related groups - they are not forced to be specific to only one group. This is what most people use and likely what you want.
所以如果我们需要了解一个细胞亚型与其他亚型之间的差异基因(或特异表达基因)可以使用该函数进行分析。only.pos = TRUE 函数可以让我们找到差异上调的基因。使用方法如下:
pbmc.markers <- FindAllMarkers(pbmc,only.pos = TRUE)
FindMarkers
FindMarkers函数用于寻找两组指定的细胞群之间的差异比较,官方解释如下:
FindMarkers() will find markers between two different identity groups.You have to specify both identity groups. This is useful for comparing the differences between two specific groups.
所以如果我们需要了解两个不同的细胞亚型或者相同cluster中来源于不同处理(group)的细胞群之间的差异情况,可以使用该函数进行分析,具体实例如下:
pbmc$cluster.group <- paste(pbmc$seurat_clusters, pbmc$group, sep = "_") # 根据cluster和group重新定义分组。
pbmc$cluster <- Idents(pbmc)
Idents(pbmc) <- "cluster.group"
mydeg <- FindMarkers(pbmc,ident.1 = '1_db/m',ident.2 = '1_db/db',verbose = FALSE, test.use = 'wilcox',min.pct = 0.1)
head(mydeg) # 单独进行两组细胞的差异分析
# 如果希望通过循环的方式,对所有cluster中不同处理进行差异分析,使用如下代码:
clusterlist<-levels(pbmc$seurat_clusters)
for(i in 1:length(clusterlist)){
CELLDEG <- FindMarkers(pbmc, ident.1 = paste0(clusterlist[i],"_db/m"), ident.2 = paste0(clusterlist[i],"_db/db"), verbose = FALSE)
write.csv(CELLDEG,paste0(cellfordeg[i],".CSV"))
}
FindConservedMarkers
FindConservedMarkers函数提供指定细胞群不同处理情况下,相对于其他cluster细胞群的marker基因。官方解释如下:
FindConservedMarkers()will find markers that are conserved between two groups.This can be useful if you want to find markers that are conserved between a treated and untreated condition for a specific cell type or group of cells. It means they are differentially expressed compared to other groups, but have similar expression between the two groups you're actually comparing.
所以,如果我们想研究的是处理前后,在不同的细胞亚型中产生的差异情况,可以使用该函数进行分析。具体实例如下:
nk.markers <-FindConservedMarkers(pbmc, ident.1 = 6, grouping.var = "group", verbose = FALSE)
此时我们得到的结果,是cluster6 细胞群,不同group状态下相对于其他cluster细胞群的差异基因(或特异性基因),需要注意的是,此时cluster 6 细胞群中不同group的细胞表达模式可能相似。