Skip to content

Instantly share code, notes, and snippets.

@bobthecat
Last active October 4, 2015 22:18
Show Gist options
  • Save bobthecat/2708387 to your computer and use it in GitHub Desktop.
Save bobthecat/2708387 to your computer and use it in GitHub Desktop.
GO_over
source('source_https.r')
## You can now source R scripts from GitHub. The RAW URL is needed.
source_https('https://raw.github.com/bobthecat/codebox/master/GO_over.r')
## Define the universe
library(mouse4302.db)
uniqueId <- unique(as.vector(unlist(as.list(mouse4302ENTREZID))))
entrezUniverse <- uniqueId[!is.na(uniqueId)]
length(entrezUniverse)
[1] 20877
## ORA with conditional hypergeometric test
mfhyper <- GO_over(entrezUniverse, glist, annot='mouse4302.db')
## Information on the Directed Acyclic Graph (DAG)
goDag(mfhyper)
A graphNEL graph with directed edges
Number of Nodes = 2723
Number of Edges = 5643
## How many gene were mapped in the end?
geneMappedCount(mfhyper)
[1] 257
## Write out the results
source_https('https://raw.github.com/bobthecat/codebox/master/write.GOhyper.r')
mrnaGO <- write.GOhyper(mfhyper, filename="BP_mRNA_significant.xls")
dim(mrnaGO <- mrnaGO[mrnaGO$adjPvalue <= 0.05,])
[1] 59 8
head(mrnaGO)
GOBPID Pvalue adjPvalue OddsRatio ExpCount Count Size Term
1 GO:0007275 7.195117e-09 4.245119e-07 2.238934 47.7311790 86 3138 multicellular organismal development
2 GO:0031116 9.123574e-07 2.691454e-05 41.247520 0.1977391 5 13 positive regulation of microtubule polymerization
3 GO:0007155 6.134458e-06 1.206443e-04 2.792433 11.0429688 28 726 cell adhesion
4 GO:0048699 9.122060e-06 1.345504e-04 2.630388 12.5640388 30 826 generation of neurons
5 GO:0048468 1.143166e-05 1.348936e-04 2.326166 18.1463660 38 1193 cell development
6 GO:0031399 2.234055e-05 2.196821e-04 2.586734 11.8491359 28 779 regulation of protein modification process
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment