使用clusterprofile做聚类分析

library(clusterProfiler )

#cat test.txt

gene_symbol

EXOSC10
ARHGEF10L
VWA5B1
SRRM1
PTAFR
CSMD2
SH3GLB1
GBP6
ZNF326
AKNAD1
STRIP1
GOLPH3L
...............

a <- read.table("test.txt",colClasses = "character")
b <- a[,1]
eg = bitr(b, fromType="SYMBOL", toType="ENTREZID", annoDb="org.Hs.eg.db")
head(eg)
write.table(eg, file="test_id.txt")

idType("org.Hs.eg.db")
gene <- eg[,2]
head(gene)

ggo <- groupGO(gene = gene,
organism = "human",
ont = "BP",
level = 7,
readable = TRUE)
head(summary(ggo))
write.table(as.matrix(ggo@result), file="test_ggo.txt")
#导出ggo的结果


ego_cc <- enrichGO(gene = gene,
organism = "human",
ont = "CC",
pAdjustMethod = "BH",
minGSSize = 1,
pvalueCutoff = 1,
qvalueCutoff = 1,
readable = TRUE)
head(summary(ego))
write.table(as.matrix(ego_cc@result), file="test_cc.txt")


ego_BP <- enrichGO(gene = gene,
organism = "human",
ont = "BP",
pAdjustMethod = "BH",
minGSSize = 1,
pvalueCutoff = 1,
qvalueCutoff = 1,
readable = TRUE)
write.table(as.matrix(ego_BP@result), file="test_BP.txt")

ego_MF <- enrichGO(gene = gene,
organism = "human",
ont = "MF",
pAdjustMethod = "BH",
minGSSize = 1,
pvalueCutoff = 1,
qvalueCutoff = 1,
readable = TRUE)
write.table(as.matrix( ego_MF@result), file="test_MF.txt")

kk <- enrichKEGG(gene = gene,
organism="human",
pvalueCutoff = 1,
qvalueCutoff = 1,
minGSSize = 1,
readable = TRUE,
use_internal_data =FALSE)
write.table(as.matrix(kk@result), file="test_kk.txt")

# barplot(ggo, drop=TRUE, showCategory=24)
barplot(ego_cc, showCategory=24)
dotplot(ego_cc)
barplot(ego_BP, showCategory=24)
dotplot(ego_BP)
barplot(ego_MF, showCategory=24)
dotplot(ego_MF)

barplot(kk, drop=TRUE, showCategory=24)

dev.off()

posted @ 2016-08-31 17:39  qinqinyang  阅读(4987)  评论(0编辑  收藏  举报