-
Notifications
You must be signed in to change notification settings - Fork 0
/
GO-KEGG-DO.R
113 lines (94 loc) · 3 KB
/
GO-KEGG-DO.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
110
111
112
library(clusterProfiler)
library(pathview)
library(topGO)
library(AnnotationHub)
library(biomaRt)
library(Rgraphviz)
library(org.Hs.eg.db)
library(argparse)
library(dplyr)
print("...configure parameters...")
parser <- ArgumentParser(description='Process some tasks')
parser$add_argument("--dataset",
type="character",
default=NULL,
help="The path of objects")
parser$add_argument("--topn",
type="character",
default="50")
args<-parser$parse_args()
print("reading markers")
markers<-readRDS(paste0("pretrain","/",args$dataset,"/","model","/","markers.rds"))
figure<-paste0("pretrain","/",args$dataset,"/","figure")
topn<-markers%>%
group_by(cluster)%>%
top_n(n=as.numeric(args$topn),wt=avg_logFC)
print("enrich GO")
genes<-as.character(markers$gene)
symbols<-mapIds(x=org.Hs.eg.db,
keys=genes,
keytype="SYMBOL",
column="ENTREZID")
head(symbols)
enrich.go.BP<-clusterProfiler::enrichGO(symbols,
OrgDb=org.Hs.eg.db,
keyType = "ENTREZID",
ont="BP",
pvalueCutoff=0.05,
qvalueCutoff=0.2,
readable=TRUE
)
print("enrich GO BP Plot")
print("Barplot")
jpeg(paste0(figure,"/","BP.enrich.go.barplot.jpeg"))
barplot(enrich.go.BP,showCategory=15)
dev.off()
jpeg(paste0(figure,"/","BP.enrich.go.dotplot.jpeg"))
dotplot(enrich.go.BP,showCategory=15)
dev.off()
print("GO Graph")
jpeg(paste0(figure,"/","BP.GoGraph.jpeg"))
plotGOgraph(enrich.go.BP)
dev.off()
####################
enrich.go.CC<-clusterProfiler::enrichGO(symbols,
OrgDb=org.Hs.eg.db,
keyType = "ENTREZID",
ont="CC",
pvalueCutoff=0.05,
qvalueCutoff=0.2,
readable=TRUE
)
print("enrich GO CC Plot")
print("Barplot")
jpeg(paste0(figure,"/","CC.enrich.go.barplot.jpeg"))
barplot(enrich.go.CC,showCategory=15)
dev.off()
jpeg(paste0(figure,"/","CC.enrich.go.dotplot.jpeg"))
dotplot(enrich.go.CC,showCategory=15)
dev.off()
print("GO Graph")
jpeg(paste0(figure,"/","CC.GoGraph.jpeg"))
plotGOgraph(enrich.go.CC)
dev.off()
##################
enrich.go.MF<-clusterProfiler::enrichGO(symbols,
OrgDb=org.Hs.eg.db,
keyType = "ENTREZID",
ont="MF",
pvalueCutoff=0.05,
qvalueCutoff=0.2,
readable=TRUE
)
print("enrich GO MF Plot")
print("Barplot")
jpeg(paste0(figure,"/","MF.enrich.go.barplot.jpeg"))
barplot(enrich.go.CC,showCategory=15)
dev.off()
jpeg(paste0(figure,"/","MF.enrich.go.dotplot.jpeg"))
dotplot(enrich.go.CC,showCategory=15)
dev.off()
print("GO Graph")
jpeg(paste0(figure,"/","MF.GoGraph.jpeg"))
plotGOgraph(enrich.go.CC)
dev.off()