forked from guozihuaa/PCa_ceRNA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path201-functional_enrichment_analysis.R
109 lines (80 loc) · 2.84 KB
/
201-functional_enrichment_analysis.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
rm(list = ls())
library(clusterProfiler)
library(annotables)
library(enrichplot)
load("result/intersect_Gene.RData")
data("grch37")
downgenlist <- dplyr::filter(grch37, ensgene %in% intersectdown)
upgenlist <- dplyr::filter(grch37, ensgene %in% intersetup)
upeg = bitr(unique(upgenlist$symbol),
fromType="SYMBOL", toType=c("ENTREZID", "SYMBOL"), OrgDb="org.Hs.eg.db")
downeg <- bitr(unique(downgenlist$symbol),
fromType="SYMBOL", toType=c("ENTREZID", "SYMBOL"), OrgDb="org.Hs.eg.db")
gmtfile <- system.file("extdata", "c2.cp.kegg.v6.1.entrez.gmt", package="clusterProfiler")
kegg <- read.gmt(gmtfile)
################### UP Gene
egmtkegg <- enricher(upeg$ENTREZID,
TERM2GENE=kegg,
pvalueCutoff = 0.9,
qvalueCutoff = 0.9,
minGSSize = 3)
dot5 <- dotplot(egmtkegg, showCategory=15,
color = "pvalue",
x="GeneRatio",
font.size = 12)
ggsave(plot = dot5,
filename = "result/up_kegg_enrich.tiff",
device = "tiff",
dpi = 300,
width = 24,
height = 15,
units = "cm")
go <- enrichGO(upeg$ENTREZID,
OrgDb = "org.Hs.eg.db",
ont="bp",
pvalueCutoff = 0.9,
qvalueCutoff = 0.9,
minGSSize = 3)
dott <- barplot(go, showCategory=15, color = "pvalue")
ggsave(plot = dott,
filename = "result/up_GO_enrich.tiff",
device = "tiff",
dpi = 300,
width = 24,
height = 15,
units = "cm")
############## down Gene
egmtkegg <- enricher(downeg$ENTREZID,
TERM2GENE=kegg,
pvalueCutoff = 0.9,
qvalueCutoff = 0.9,
minGSSize = 3)
dot5 <- dotplot(egmtkegg, showCategory=15,
color = "pvalue",
x="GeneRatio",
font.size = 10)
ggsave(plot = dot5,
filename = "result/down_kegg_enrich.tiff",
device = "tiff",
dpi = 300,
width = 24,
height = 15,
units = "cm")
go <- enrichGO(downeg$ENTREZID,
OrgDb = "org.Hs.eg.db",
ont="bp",
pvalueCutoff = 0.9,
qvalueCutoff = 0.9,
minGSSize = 3)
dott <- barplot(go, showCategory=15, color = "pvalue")
ggsave(plot = dott,
filename = "result/down_GO_enrich.tiff",
device = "tiff",
dpi = 300,
width = 24,
height = 15,
units = "cm")
goread <- as.data.frame(go)
keggread <- egmtkegg@result
write.csv(goread, "result/enrich_tcga_DEG_go.csv", row.names = F, quote = F)
write.csv(keggread, "result/enrich_tcga_DEG_kegg.csv", row.names = F, quote = F)