R语言学习笔记转录组数据分析单细胞试验记录

cluster差异基因寻找及GO、KEGG注释

2019-10-28  本文已影响0人  麒麟991

library(Seurat)

library(dplyr)

library(clusterProfiler)

library(ggplot2)

for( j in 0:12)

{

cluster.markers <- FindMarkers(object = combined, ident.1 =j, logfc.threshold = 0.25, test.use = "bimod", only.pos = TRUE)

cluster<- row.names.data.frame(cluster.markers)

cluster=bitr(cluster,fromType = "SYMBOL",toType = c("ENTREZID"),OrgDb = "org.Hs.eg.db")

cluster.go<-enrichGO(gene=cluster[,"ENTREZID"],keyType = "ENTREZID",OrgDb=org.Hs.eg.db,ont = "ALL",pAdjustMethod = "BH",pvalueCutoff = 0.01,qvalueCutoff = 0.05,readable = TRUE)

assign(paste0("cluster",j,".go"),cluster.go)

pdf(file = paste0("cluster",j,"go.pdf"),,width=20,height=10)

barplot(cluster.go,showCategory=50)

dev.off()

这里可以分别对一个个cluster进行注释。

cluster.kegg<-enrichKEGG(gene = cluster[,"ENTREZID"],organism = 'hsa', pvalueCutoff = 0.05,pAdjustMethod = 'BH', minGSSize = 10,maxGSSize = 500,qvalueCutoff = 0.2,use_internal_data = FALSE)

assign(paste0("cluster",j,".kegg"),cluster.kegg)

pdf(file = paste0("cluster",j,"kegg.pdf"),,width=20,height=10)

dotplot(cluster.kegg,showCategory=50)

dev.off()

write.csv(x=cluster.markers,file=paste0("cluster",j,".csv"))

}

作者:阿糖胞苷_SYSU

链接:https://www.jianshu.com/p/0b80b24b0d03

来源:简书

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

上一篇 下一篇

猜你喜欢

热点阅读