Entering edit mode
9.5 years ago
Endre Bakken Stovner
▴
970
library("GO.db")
GOCCCHILDREN$"GO:0005575"
is_a is_a is_a is_a is_a is_a
"GO:0016020" "GO:0005576" "GO:0005581" "GO:0005623" "GO:0009295" "GO:0019012"
is_a is_a is_a is_a is_a is_a
"GO:0030054" "GO:0031012" "GO:0031974" "GO:0032991" "GO:0039679" "GO:0043226"
is_a is_a is_a is_a is_a is_a
"GO:0044420" "GO:0044421" "GO:0044422" "GO:0044423" "GO:0044425" "GO:0044456"
is_a is_a is_a is_a
"GO:0044464" "GO:0045202" "GO:0055044" "GO:0097423"
go <- "GO:0005575"
GOCCCHILDREN$go
NULL
If this isn't due to a inane mistake on my part this is absolutely insane behavior.
I need to use a variable to make a general script that extracts the children for every node, like so:
get_hierarchy_data <- function(ontology, root_node, outfile){
parent_offspring_map <- get_correct_offspring_list(ontology)
for (node in parent_offspring_map$root_node) {
print(node)
# actual code omitted
}
}
get_correct_offspring_list <- function(ontology){
if (ontology == "CC"){
return(GOCCOFFSPRING)
} else if (ontology == "MF") {
return(GOMFOFFSPRING)
} else {
return(GOBPOFFSPRING)
}
}
I kinda had an inkling that that was the problem, and that I had to evaluate the char-vector at runtime, but I thought it couldn't be, since R is supposedly so high level. I guess I have been spoiled by non-blub languages:
Ended up using pyper which pipes to R through Python: