I have a vector of GOIDs that are specific GO IDs outputted from an enrichment analysis. I want to cluster my GOIDs by their parent GOID term. I used GOstats to do my enrichment analysis, and I have noticed there is an inducedTermGraph, which outputs a graphNEL object of direct children and direction parents of the GOIDs you query. If you set parents=TRUE and children=FALSE, your graph includes only parent nodes which relate to your GOID query.
However, how can I extract the node names of these parent nodes??? See code below:
gene.ids <- c(51141, 84968, 140850, 388289, 406994, 677828, 693217, 100287428,
100505685, 100506540, 101926966, 101927244, 101928659)
require(RnBeads)
uids <- rnb.get.annotation("genes")
uids <- sort(unique(as.numeric(na.omit(unlist(sapply(unlist(uids)$entrezID,
function(i) strsplit(i, split=";")))))))
params <- new("GOHyperGParams", annotation = "org.Hs.eg.db", geneIds = gene.ids,
universeGeneIds = uids, ontology = "BP", conditional = TRUE,
testDirection = "over")
res <- tryCatch({ hyper.genes <- hyperGTest(params) }, error = function(ee) { print("Errorfests.") })
go.ids <- summary(hyper.genes)[,"GOBPID"]
result <- inducedTermGraph(hyper.genes, id=go.ids, children=FALSE, parents=TRUE)
nAttrs <- list()
z <- attributes(result)$nodes
names(z) <- nodes(result)
nAttrs$label <- z
plot(result, nodeAttrs=nAttrs)
$
and a variable like that. 3) GOMFPARENTS is not a function so using()
doesn't work either. $\endgroup$