生物信息做肿瘤

细胞注释

2021-08-19  本文已影响0人  不学无数YD

参考:
细胞类型注释

经典marker手动注释

#在文献里面经常用到的经典marker
在文献里面经常出现
celltype_marker=c(
  "EPCAM",#上皮细胞 epithelial
  "PECAM1",#内皮细胞 endothelial
  "COL3A1",#成纤维细胞 fibroblasts
  "CD163","AIF1",#髓系细胞 myeloid
  "CD79A",#B细胞
  "JCHAIN",#浆细胞 plasma cell
  "CD3D","CD8A","CD4",#T细胞
  "GNLY","NKG7",#NK细胞
  "PTPRC"#免疫细胞
)

结合对应的关系,初步确认细胞类型如下:

VlnPlot(test.seu,features = celltype_marker,pt.size = 0,ncol = 2)
ggsave(filename = "marker.png",device = "png",width = 44,height = 33,units = "cm")
image.png

NK细胞和T细胞不是很能区分开,一些文献也是直接把这两个当做一个大群来做的,此处我根据GNLY基因确定第5个cluster为NK细胞,是否正确我们后面再看。

免疫细胞
0: B_cell
4: Plasma_cell
1 2: T_cell
5: NK_cell
13: Unknown
非免疫细胞
3 6 7 8 10 11 12: Epithelial
14: Endothelial
9: Fibroblasts
doublet
15: Doublet (Myeloid+CD4)

以上根据经典的marker初步确定了细胞大类,接着我们找差异基因,看看找出来的每一个cluster的差异基因是不是和前面鉴定的类型一致。

  1. 找差异基因
markers <- FindAllMarkers(test.seu, logfc.threshold = 0.25, min.pct = 0.1, 
                          only.pos = TRUE, test.use = "wilcox")
markers_df = markers %>% group_by(cluster) %>% top_n(n = 500, wt = avg_logFC)
#根据avg_logFC这一列把前500个差异基因取出来,小于500个时,有多少保留多少。
#不必在意我们保留多少个差异基因,实际用到的,也就前面十几(几十)个基因。
write.table(markers_df,file="test.seu_0.5_logfc0.25_markers500.txt",quote=F,sep="\t",row.names=F,col.names=T)

SingleR注释

细胞亚群注释

library(SingleR)
library(celldex)
refdata <- MouseRNAseqData()
refdata$label.ont
testdata <- GetAssayData(scRNA, slot="data")
clusters <- scRNA@meta.data$seurat_clusters
cellpred <- SingleR(test = testdata, ref = refdata, labels = refdata$label.fine, 
                    # label.finea耗时比较长一点
                    method = "cluster", clusters = clusters, 
                    assay.type.test = "logcounts", assay.type.ref = "logcounts")
rm(refdata, testdata) #珍惜内存
table(cellpred$labels)

给scRNA增添celltype注释信息

celltype = data.frame(ClusterID=rownames(cellpred), celltype=cellpred$labels, stringsAsFactors = F)
table(celltype$ClusterID,celltype$celltype) 

为singleR的细胞cluster鉴定结果。

scRNA@meta.data$celltype = "NA"
#先新增列celltype,值均为NA,然后利用下一行代码循环填充
for(i in 1:nrow(celltype)){
  scRNA@meta.data[which(scRNA@meta.data$seurat_clusters == celltype$ClusterID[i]),'celltype'] <- celltype$celltype[i]}
DimPlot(scRNA, group.by="celltype", label=F , reduction='tsne')
上一篇 下一篇

猜你喜欢

热点阅读