-
Notifications
You must be signed in to change notification settings - Fork 0
/
enrichment.R
100 lines (94 loc) · 2.52 KB
/
enrichment.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
# install_packages("gprofiler2")
library(gprofiler2)
library(tidyr)
library(dplyr)
loc.all = c("WNT4",
"HIVEP3",
"FAF1",
"TET3",
"LSM3",
"ADCY5",
"EEFSEC",
"MRPS22",
"ZBTB38",
"KCNAB1",
"LEKR1",
"KDR",
"HAND2",
"EBF1",
"EBF1", # duplicate - gprofiler sorts it out
"HGNC:4942", # HLA-DQA1 resolved
"GDAP1",
"FBXO32",
"COL27A1",
"TFAP4",
"MYOCD",
"TCEA2",
"AGTR2",
"RAP2C",
"LRP5",
"LRATD2",
"IL1A",
"LPP",
"SPATA6")
res.all = gost(loc.all, organism="hsapiens")
# check that all were mapped
res.all$meta$genes_metadata
res.all$result
# loci w/ T-V effects in this cohort
loc.varying = c("WNT4",
"HIVEP3",
"TET3",
"ADCY5",
"EEFSEC",
"MRPS22",
"ZBTB38",
"KCNAB1",
"LEKR1",
"KDR",
"EBF1",
"GDAP1",
"FBXO32",
"COL27A1",
"TFAP4",
"MYOCD",
"TCEA2",
"AGTR2",
"RAP2C",
"LRATD2",
"IL1A")
res.varying = gost(loc.varying, organism="hsapiens")
res.varying$result
full_join(res.all$result[,c("term_name", "p_value")],
res.varying$result[,c("term_name", "p_value")],
by="term_name", suffix=c("all", "tv")) %>%
View
# removed loci w/ later effect peaks
loc.early = c("WNT4",
"HIVEP3",
"ADCY5",
"EEFSEC",
"MRPS22",
"ZBTB38",
"KCNAB1",
"KDR",
"GDAP1",
"FBXO32",
"TFAP4",
"MYOCD",
"TCEA2",
"LEKR1",
"AGTR2",
"RAP2C",
"LRATD2")
res.early = gost(loc.early, organism="hsapiens")
res.early$result
res.wide = bind_rows("all"=res.all$result[,c("term_name", "p_value")],
"tv"=res.varying$result[,c("term_name", "p_value")],
"early"=res.early$result[,c("term_name", "p_value")],
.id="gr") %>%
mutate(p_value = signif(p_value, digits=2)) %>%
spread(key="gr", value="p_value")
View(res.wide)
arrange(res.wide[,c("term_name", "all", "tv", "early")], early) %>%
print