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)
![](https://img.haomeiwen.com/i21758668/08f08bd4c00e0c52.png)
image.png
网友评论