Question: list in which each element is a vector of GO BP ids corresponding to an entrez gene
0
gravatar for salamandra
21 months ago by
salamandra200
salamandra200 wrote:

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?

org.hs.eg.db lapply R • 715 views
ADD COMMENTlink modified 19 months ago by Biostar ♦♦ 20 • written 21 months ago by salamandra200
1

Following is not the solution to your issue. However, easier way may be:

library(org.Hs.eg.db)
goeg=as.data.frame(org.Hs.egGO2EG)
goegbp=goeg[goeg$Ontology=="BP",]

First few lines from the output:

> head(goegbp)
  gene_id      go_id Evidence Ontology
1       1 GO:0008150       ND       BP
2       2 GO:0001869      IDA       BP
3       2 GO:0002576      TAS       BP
4       2 GO:0007264      TAS       BP
5       2 GO:0007596      TAS       BP
6       2 GO:0007597      TAS       BP
ADD REPLYlink modified 21 months ago • written 21 months ago by cpad011211k

thank you very much! :)

ADD REPLYlink written 21 months ago by salamandra200
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 897 users visited in the last hour