##################################################富集分析
library(clusterProfiler)
#人种 org.Hs.eg.db 小鼠 org.Mm.eg.db
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("org.Mm.eg.db")
library(org.Mm.eg.db)
##转换ID
trans <- bitr(gene, fromType="SYMBOL",
toType="ENTREZID", OrgDb="org.Mm.eg.db")
#######################GO
ego <- enrichGO(gene = trans$ENTREZID,
OrgDb = org.Mm.eg.db,
ont = "ALL",
pAdjustMethod = "BH",
pvalueCutoff = 0.05,
qvalueCutoff = 1,
readable = TRUE)
head(ego@result)
result<-ego@result
write.csv(result,file = 'go.result.csv',quote = F,row.names = T,col.names = T)
##########################KEGG
#organism supported organism listed in 'http://www.genome.jp/kegg/catalog/org_list.html'
#hsa 人;mmu 小鼠
kk <- enrichKEGG(gene = trans$ENTREZID,
organism = 'mmu',
pvalueCutoff = 0.05,
qvalueCutoff = 1)
tmp <- data.frame(kk)
kkx <- setReadable(kk, 'org.Mm.eg.db', 'ENTREZID')
kk<- data.frame(kkx)
write.csv(kk,file = 'kegg.result.csv',quote = F,row.names = T,col.names = T)
网友评论