Error in .checkKeys(value, Lkeys(x), x@ifnotfound)
3
2
Entering edit mode
nooshin ▴ 300
@nooshin-5239
Last seen 6.0 years ago

Hello,

I have read all comments about the following error comes from GOstat package, 

> res <- summary(hgOver,pvalue=hgCutoff)
Error in .checkKeys(value, Lkeys(x), x@ifnotfound) : 
  value for "GO:0098856" not found
Error during wrapup: cannot open the connection
> traceback()
No traceback available 

Almost all said that if we update all corresponding packages this error can be resolved. However, I updated my R as well as all other packages but still get this error.

I really appreciate a lot your help. 

Here is my code:

library(org.Dm.eg.db)
library(GOstats)
library(DBI)
onto <- "BP"
hgCutoff <- 0.05
annot <- "org.Dm.eg.db"
> params=new("GOHyperGParams", geneIds = genes,universeGeneIds = universe_genes, annotation = annot,ontology = onto, pvalueCutoff = hgCutoff, conditional = FALSE,testDirection = "over")
> hgOver=hyperGTest(params)
> summary <- getGeneric("summary")
> res <- summary(hgOver,pvalue=hgCutoff)
Error in .checkKeys(value, Lkeys(x), x@ifnotfound) : 
  value for "GO:0098856" not found
Error during wrapup: cannot open the connection
> traceback()
No traceback available 
> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
 [1] stats4    grid      parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] DBI_0.4-1                  GOstats_2.39.0             graph_1.48.0               Category_2.36.0           
 [5] GO.db_3.3.0                Matrix_1.2-6               org.Dm.eg.db_3.3.0         AnnotationDbi_1.35.3      
 [9] DESeq2_1.13.2              SummarizedExperiment_1.2.2 Biobase_2.30.0             GenomicRanges_1.25.0      
[13] GenomeInfoDb_1.6.3         IRanges_2.7.1              S4Vectors_0.11.2           BiocGenerics_0.19.0       
[17] edgeR_3.12.1               elasticnet_1.1             lars_1.2                   DeMAND_1.2.0              
[21] KernSmooth_2.23-15         psych_1.6.4                igraph_1.0.1               fields_8.4-1              
[25] maps_3.1.0                 spam_1.3-0                 Hmisc_3.17-4               Formula_1.2-1             
[29] lattice_0.20-33            R.utils_2.3.0              R.oo_1.20.0                R.methodsS3_1.7.1         
[33] penalized_0.9-46           survival_2.39-4            samr_2.0                   matrixStats_0.50.2        
[37] impute_1.44.0              timecourse_1.42.0          MASS_7.3-45                ggplot2_2.1.0             
[41] venneuler_1.1-0            rJava_0.9-8                limma_3.26.9              

loaded via a namespace (and not attached):
 [1] splines_3.3.0          statmod_1.4.24         latticeExtra_0.6-28    RBGL_1.46.0           
 [5] RSQLite_1.0.0          chron_2.3-47           RColorBrewer_1.1-2     XVector_0.13.0        
 [9] colorspace_1.2-6       plyr_1.8.3             GSEABase_1.32.0        XML_3.98-1.4          
[13] genefilter_1.52.1      zlibbioc_1.16.0        xtable_1.8-2           scales_0.4.0          
[17] BiocParallel_1.4.3     annotate_1.51.0        nnet_7.3-12            mnormt_1.5-4          
[21] magrittr_1.5           foreign_0.8-66         tools_3.3.0            data.table_1.9.6      
[25] munsell_0.4.3          locfit_1.5-9.1         cluster_2.0.4          lambda.r_1.1.7        
[29] futile.logger_1.4.1    AnnotationForge_1.12.2 marray_1.48.0          gtable_0.2.0          
[33] gridExtra_2.2.1        futile.options_1.0.0   Rcpp_0.12.5            geneplotter_1.48.0    
[37] rpart_4.1-10           acepack_1.3-3.3       
 
 
Gostats go term annotation drosophila melanogaster error • 3.8k views
ADD COMMENT
0
Entering edit mode

Hi,

Thanks a lot for your response.

I did all you've mentioned as follow:

ids = keys(org.Dm.eg.db, "GO")
df = select(GO.db, keys(GO.db), "ONTOLOGY") 
ids = ids[ids %in% df$GOID[df$ONTOLOGY == "BP"]] 
goMaps <- lapply(ids, function(x) unlist(mget(x, org.Dm.egGO2ALLEGS)))
all_genes <- unique(as.character(unlist(goMaps)))

# genes are all genes in my study
Alias_id <- unlist(as.list(org.Dm.egALIAS2EG))
ids <- cbind(as.character(genes),as.character(Alias_id[as.character(genes)]), names(genes))
ids_new <- ids[!duplicated(ids[,1]),]
rownames(ids_new) <- ids_new[,3]
    
# rownames(counts) includes all genes from RNA-seq data, which is equal to the genes
universe_genes<-as.character(ids_new[intersect(rownames(ids_new),rownames(counts)),2])
universe_genes <- intersect(all_genes,unique(universe_genes[!is.na(universe_genes)]))

# g is genes differentially expressed at time point 1 
g <- as.character(ids_new[intersect(rownames(ids_new),as.character(df1$id)),2])    
g <- intersect(all_genes,unique(g[!is.na(g)]))
onto <- "BP"    
hgCutoff <- 0.05    
annot <- "org.Dm.eg.db"    

params=new("GOHyperGParams", geneIds = g,universeGeneIds = universe_genes, annotation = annot,ontology = onto, pvalueCutoff = hgCutoff, conditional = FALSE,testDirection = "over")

hgOver=hyperGTest(params)
res <- GOstats::summary(hgOver,pvalue=hgCutoff)
Error in .checkKeys(value, Lkeys(x), x@ifnotfound) : 
  value for "GO:0098856" not found
Error during wrapup: cannot open the connection

This sounds very strange to me.

Regarding summary, you understood it correctly and I used the same as your suggestion, but still I get the same error.

I appreciate it a lot if you could help in this regard.

 

 

 

 

ADD REPLY
2
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States

Remove genes whose GO ids are not in the ontology you're interested in. For instance, here are all the ids

ids = keys(org.Dm.eg.db, "GO")

and here are all the GO ids and their ontology

df = select(GO.db, keys(GO.db), "ONTOLOGY")

Explore each, head(ids), head(df), and note that many are not part of the "BP" ontology

> table(ids %in% df$GOID[df$ONTOLOGY == "BP"])

FALSE  TRUE 
 2987  4082 

Select just those that are

ids = ids[ids %in% df$GOID[df$ONTOLOGY == "BP"]]

What's the intention of the line summary <- getGeneric("summary") ? Maybe you're thinking that there is more than one 'summary' function, and you're trying to select the appropriate one. I think you would have more luck with GOstats::summary(hgOver, pvalue=hgCutoff).

ADD COMMENT
1
Entering edit mode
tlaguna ▴ 10
@tlaguna-12370
Last seen 7.8 years ago
IMB Mainz

I have to say that I had the same problem using the release version of GOstats in Bioconductor. I realized that AnotationDBI, GO.db, and other packages to which GOstats depend on, were not updated, and after updating them the problem was solved. Just in case someone has the same issue...

ADD COMMENT
0
Entering edit mode
nooshin ▴ 300
@nooshin-5239
Last seen 6.0 years ago

Actually when I write the following

res <- summary(hgOver,pvalue = hgCutoff,categorySize=2)

It works and I don't get any error, but when I write:

res <- summary(hgOver,pvalue = hgCutoff,categorySize=1)
Error in .checkKeys(value, Lkeys(x), x@ifnotfound) : 
  value for "GO:0098856" not found
Error during wrapup: cannot open the connection

I get the same error.

looking very much forward to your help

ADD COMMENT
1
Entering edit mode

As the original poster you should almost never use the 'Add your answer' box, because you are almost never going to be answering your own question. Instead you should use the ADD COMMENT button to add a comment, which is in fact what you are doing.

In general you don't want to use a categorySize that small. I usually use something like 10, which limits the GO terms to those with at least 10 genes. Anything less and you run the risk of picking up likely false positives.

In addition, it looks like you are running Bioc Devel. As the name suggests, this is a development version and may well contain bugs as people are actively developing things. I sort of doubt this is the case with GOstats, as it hasn't seen active development for a while now. But unless you are a developer, there is no profit in using the devel versions of things, and I would recommend downgrading to release.

ADD REPLY
0
Entering edit mode

Thanks a lot. I will then reply instead of adding my answer. You are totally right :)

Thanks a lot also for the hint, I will then downgrade all the devel versions to the release.

 

ADD REPLY

Login before adding your answer.

Traffic: 816 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6