-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathgseAnalyzer.R
160 lines (143 loc) · 4.86 KB
/
gseAnalyzer.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
gseDisease <- function(geneList,
organism = "hsa",
exponent=1,
minGSSize = 10,
maxGSSize = 500,
eps = 1e-10,
pvalueCutoff=0.05,
pAdjustMethod="BH",
verbose=TRUE,
seed=FALSE,
by = 'fgsea',
ontology,
...) {
annoData <- get_anno_data(ontology)
res <- GSEA_internal(geneList = geneList,
exponent = exponent,
minGSSize = minGSSize,
maxGSSize = maxGSSize,
eps = eps,
pvalueCutoff = pvalueCutoff,
pAdjustMethod = pAdjustMethod,
verbose = verbose,
seed = seed,
USER_DATA = annoData,
by = by,
...)
if (is.null(res))
return(res)
if (organism == "hsa") {
res@organism <- "Homo sapiens"
} else {
res@organism <- "Mus musculus"
}
res@setType <- ontology
res@keytype <- "ENTREZID"
return(res)
}
##' DO Gene Set Enrichment Analysis
##'
##'
##' perform gsea analysis
##' @param geneList order ranked geneList
##' @param ont one of "HDO", "HPO" or "MPO"
##' @param organism one of "hsa" and "mmu"
##' @param exponent weight of each step
##' @param minGSSize minimal size of each geneSet for analyzing
##' @param maxGSSize maximal size of each geneSet for analyzing
##' @param pvalueCutoff pvalue Cutoff
##' @param pAdjustMethod p value adjustment method
##' @param verbose print message or not
##' @param seed logical
##' @param by one of 'fgsea' or 'DOSE'
##' @param ... other parameter
##' @return gseaResult object
##' @export
##' @author Yu Guangchuang
##' @keywords manip
gseDO <- function(geneList,
ont = "HDO",
organism = "hsa",
exponent=1,
minGSSize = 10,
maxGSSize = 500,
pvalueCutoff=0.05,
pAdjustMethod="BH",
verbose=TRUE,
seed=FALSE,
by = 'fgsea',
...) {
gseDisease(geneList = geneList,
exponent = exponent,
minGSSize = minGSSize,
maxGSSize = maxGSSize,
pvalueCutoff = pvalueCutoff,
pAdjustMethod = pAdjustMethod,
verbose = verbose,
seed = seed,
by = by,
ontology = ont,
...)
}
##' NCG Gene Set Enrichment Analysis
##'
##'
##' perform gsea analysis
##' @inheritParams gseDO
##' @return gseaResult object
##' @export
##' @author Yu Guangchuang
##' @keywords manip
gseNCG <- function(geneList,
exponent=1,
minGSSize = 10,
maxGSSize = 500,
pvalueCutoff=0.05,
pAdjustMethod="BH",
verbose=TRUE,
seed=FALSE,
by = 'fgsea',
...) {
gseDisease(geneList = geneList,
exponent = exponent,
minGSSize = minGSSize,
maxGSSize = maxGSSize,
pvalueCutoff = pvalueCutoff,
pAdjustMethod = pAdjustMethod,
verbose = verbose,
seed = seed,
by = by,
ontology = "NCG",
...)
}
##' DisGeNET Gene Set Enrichment Analysis
##'
##'
##' perform gsea analysis
##' @inheritParams gseDO
##' @return gseaResult object
##' @export
##' @author Yu Guangchuang
##' @keywords manip
gseDGN <- function(geneList,
exponent=1,
minGSSize = 10,
maxGSSize = 500,
pvalueCutoff=0.05,
pAdjustMethod="BH",
verbose=TRUE,
seed=FALSE,
by = 'fgsea',
...) {
gseDisease(geneList = geneList,
exponent = exponent,
minGSSize = minGSSize,
maxGSSize = maxGSSize,
pvalueCutoff = pvalueCutoff,
pAdjustMethod = pAdjustMethod,
verbose = verbose,
seed = seed,
by = by,
ontology = "DisGeNET",
...)
}