-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathGO_over.r
38 lines (33 loc) · 1.35 KB
/
GO_over.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
#
# GO_over.r
#
# Created by David Ruau on 2012-01-23.
# Dept. of Pediatrics/Div. Systems Medicine, Stanford University.
#
#
##################### USAGE #########################
#
# mfhyper <- GO_over(entrezUniverse, glist=glist, annot='org.Hs.eg.db')
# geneMappedCount(mfhyper)
# htmlReport(mfhyper, file="results.html", label="ceci n'est pas une pipe")
#
#####################################################
GO_over <- function(universe, glist, annot='HsAgilentDesign026652.db', ontology='BP', cutoff=0.001) {
require(GOstats)
universe <- unique(as.character(universe))
glist <- unique(as.character(glist))
# conditional hypergeometric test
# "uses the structure of the GO graph to estimate for each term whether or
# not there is evidence beyond that which is provided by the term’s children
# to call the term in question statistically overrepresented." - GOstatsHyperG vignette
params <- new("GOHyperGParams",
geneIds=glist,
universeGeneIds=universe, # this is a gene list of all the genes tested on the microarray
annotation=annot, # annotation pacakge for the microarray in question
ontology=ontology, # either BP, CC, or MF
pvalueCutoff=cutoff, # for uncorrected pvalues
conditional=TRUE, # Use conditional algorithms or standard Hypergeometric test
testDirection="over")
mfhyper = hyperGTest(params)
return(mfhyper)
}