6、Marker gene detection

2020-09-26  本文已影响0人  小贝学生信

原文链接Chapter 11 Marker gene detection

1、目的

load("fluidigm.clust.RData") 
#加载上一步分析结果
fluidigm.clust
library(scran)  

2、findMarkers

(1)基础用法

markers.fluidigm <- findMarkers(fluidigm.clust,groups=fluidigm.clust$label)
markers.fluidigm
markers.fluidigm$`1`
关于Top
chosen <- "1"  #查看clust1与其它三个clust的比较
interesting <- markers.fluidigm[[chosen]]
colnames(interesting)
interesting[1:9,1:4]
2-2
best.set <- interesting[interesting$Top <= 3,]
#选取与其它三个clust差异排名前三,共9个基因的矩阵
getMarkerEffects <- function(x, prefix="logFC", strip=TRUE, remove.na.col=FALSE) {
  #prefix="logFC"
  #x=best.set
  regex <- paste0("^", prefix, "\\.")
  i <- grep(regex, colnames(x))
  out <- as.matrix(x[,i])
  
  if (strip) {
    colnames(out) <- sub(regex, "", colnames(out))
  }
  if (remove.na.col) {
    out <- out[,!colAnyNAs(out),drop=FALSE]
  }
  
  out
}#不知为啥下载scran包没有这个函数,找到了函数源代码,同样效果
logFCs <- getMarkerEffects(best.set)
#得到行名为基因,列名为其它三类clust与clust1de1 logFC
library(pheatmap)
pheatmap(logFCs, breaks=seq(-5, 5, length.out=101))
2-3

(2)细节筛选

基于logFC
#仅挑选上调基因
markers.fluidigm.up <- findMarkers(fluidigm.clust, direction="up",
                                   groups=fluidigm.clust$label)
interesting.up <- markers.fluidigm.up[[chosen]]
interesting.up[1:10,1:4]
#logfc>1
markers.fluidigm.up2 <- findMarkers(fluidigm.clust, direction="up", lfc=1,
                                    groups=fluidigm.clust$label)
interesting.up2 <- markers.fluidigm.up2[[chosen]]
interesting.up2[1:10,1:4]

These two settings yield a more focused set of candidate marker genes that are upregulated in cluster 1

best.set <- interesting.up2[interesting.up2$Top <= 5,]
logFCs <- getMarkerEffects(best.set)
library(pheatmap)
pheatmap(logFCs, breaks=seq(-5, 5, length.out=101))
2-4
基于比较方法

(1)pval.type="all"

markers.fluidigm.up3 <- findMarkers(fluidigm.clust, pval.type="all", 
                                direction="up",
                                groups=fluidigm.clust$label)
interesting.up3 <- markers.fluidigm.up3[[chosen]]
head(interesting.up3)

这种方法看起来很合理,但是也有缺点

(2)pval.type="any"

(3)pval.type="some"

(3)其它参数

block=
m.out <- findMarkers(fluidigm.clust, 
                     block=fluidigm.clust$Coverage_Type, 
                     direction="up",
                     groups=fluidigm.clust$label) 
demo <- m.out[["1"]] 
demo[demo$Top <= 5,1:4]
test=
save(markers.fluidigm, file = "markergene.Rdata")

以上是第十一章Clustering部分的简单流程笔记,主要学习了基于t.test的marker gene detection,其它如wilcox方法见原文Chapter 10 Marker gene detection
本系列笔记基于OSCA全流程的大致流程梳理,详细原理可参考原文。如有错误,恳请指正!
此外还有刘小泽老师整理的全文翻译笔记,详见目录

上一篇 下一篇

猜你喜欢

热点阅读