7、Cell type annotation

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

原文链接Chapter 12 Cell type annotation

1、概述

2、SingleR注释

(1)基本方法

#加载待注释sce
load("fluidigm.clust.RData")
fluidigm.clust

#准备合适的ref data
library(SingleR)
ref <- BlueprintEncodeData()
ref
pred <- SingleR(test=fluidigm.clust, ref=ref, labels=ref$label.main)
#pred <- SingleR(test=fluidigm.clust, ref=ref, labels=ref$label.fine)
table(pred$labels)
2-1
fluidigm.clust
colnames(colData(fluidigm.clust))
fluidigm.clust$celltype <- pred$labels
table(fluidigm.clust$celltype)
plotReducedDim(fluidigm.clust, dimred="UMAP", colour_by="celltype")
fluidigm.anno <- fluidigm.clust
save(fluidigm.anno,file = "fluidigm.anno.Rdata")

(2)visualization digonosis

plotScoreHeatmap(pred)
plotScoreHeatmap(pred)
sum(is.na(pred$pruned.labels)) 
#无 pruned cell
plotScoreDistribution(pred)
#black point for each cell
#grey area for cells that were assigned to the label.
#yellow area for other cells not assigned to the label.
plotScoreDistribution(pred)
tab <- table(Assigned=pred$pruned.labels, Cluster=fluidigm.clust$Cluster2)
tab
# Adding a pseudo-count of 10 to avoid strong color jumps with just 1 cell.
library(pheatmap)
pheatmap(log2(tab+10), color=colorRampPalette(c("white", "blue"))(101))

ref data from other source

library(scRNAseq)
sceM <- MuraroPancreasData()
sceM
#此外要注意的是基因名为Ensemble ID
table(sceM$label)
sceM
#ID转换:symbol→ensemble
library(AnnotationHub)
edb <- AnnotationHub()[["AH73881"]]
gene.symb <- sub("__chr.*$", "", rownames(sceG))
gene.ids <- mapIds(edb, keys=gene.symb, 
                   keytype="SYMBOL", column="GENEID")
keep <- !is.na(gene.ids) & !duplicated(gene.ids)
sceG <- sceG[keep,]
rownames(sceG) <- gene.ids[keep]
counts(sceG)[1:4,1:4]
sceG
pred.sceG <- SingleR(test=sceG, ref=sceM, 
                      labels=sceM$label, de.method="wilcox")
table(pred.sceG$labels)

3、其它注释方法

简单介绍,不再操作,详见原文

(1)Assigning cell labels from gene sets

(2)Assigning cluster labels from markers


以上是第十二章Clustering部分的简单流程笔记,主要学习了基于SingleR的cell type注释方法。其它方式详见原文Chapter 12 Cell type annotation
本系列笔记基于OSCA全流程的大致流程梳理,详细原理可参考原文。如有错误,恳请指正!
此外还有刘小泽老师整理的全文翻译笔记,详见目录

上一篇下一篇

猜你喜欢

热点阅读