Entering edit mode
6.8 years ago
salamandra
▴
550
I'm trying to retrieve a list in which each element is a vector of GO BP ids corresponding to an entrez gene. Then I plan to unlist those elements and do a unique vector with all available GO ids for BP only The following code:
library(org.Hs.eg.db)
xx.GO <- as.list(org.Hs.egGO)
lapply(xx.GO, function(x) unlist(lapply(x, function(y) if(y[["Ontology"]]=="BP") {y[["GOID"]]})))
gives the error:
Error in unlist(lapply(x, function(y) if (y[["Ontology"]] == "BP") { :
error in evaluating the argument 'x' in selecting a method for function 'unlist': Error in y[["Ontology"]] : subscript out of bounds
What am I doing wrong?
Following is not the solution to your issue. However, easier way may be:
First few lines from the output:
thank you very much! :)