美文网首页单细胞测序生信绘图
多个list做功能富集分析

多个list做功能富集分析

作者: 医学小白学生信 | 来源:发表于2021-04-05 12:28 被阅读0次
    library("org.Hs.eg.db")
    rt=read.table("cluster 1.txt",sep="\t",check.names=F,header=T)
    genes=as.vector(rt[,1])
    entrezIDs <- mget(genes, org.Hs.egSYMBOL2EG, ifnotfound=NA)
    entrezIDs <- as.character(entrezIDs)
    out1=cbind(rt,entrezID=entrezIDs)
    
    rt=read.table("cluster 2.txt",sep="\t",check.names=F,header=T)
    genes=as.vector(rt[,1])
    entrezIDs <- mget(genes, org.Hs.egSYMBOL2EG, ifnotfound=NA)
    entrezIDs <- as.character(entrezIDs)
    out2=cbind(rt,entrezID=entrezIDs)
    
    
    library("clusterProfiler")
    library("org.Hs.eg.db")
    library("enrichplot")
    library("ggplot2")
    cp = list(cluster_1=out1$entrezID, cluster_2=out2$entrezID)  # 合并两个数据集,并转换为列表
    xx <- compareCluster(cp, fun="enrichKEGG", organism="hsa", pvalueCutoff=0.01,pAdjustMethod = "BH",qvalueCutoff = 0.05) 
    dotplot(xx,showCategory=10,includeAll=TRUE)
    
    a<-xx@compareClusterResult
    write.csv(a,"KEGG-enrich.csv",row.names =F)
    
    image.png

    相关文章

      网友评论

        本文标题:多个list做功能富集分析

        本文链接:https://www.haomeiwen.com/subject/ezsaiktx.html