ssayols / rrvgo

Reduce + Visualize Gene Ontology
GNU General Public License v3.0
21 stars 3 forks source link

Error with custom OrgDB: authorize alternative keytype #4

Closed lassancejm closed 3 years ago

lassancejm commented 3 years ago

Thanks for taking the time to develop this package.

I am trying to use the package with my own OrgDb object, which I created using the function AnnotationForge::makeOrgPackage().

The issue I run into is that some of the called functions use 'ENTREZID' as keytype by default, while my OrgDb object was created using 'GID' to label gene IDs. Note that is imposed by the developer(s) of the AnnotationForge::makeOrgPackage function.

Error message below:

Error in testForValidKeytype(x, keytype): Invalid keytype: ENTREZID. Please use the keytypes method to see a listing of valid arguments.
Traceback:

1. reduceSimMatrix(simMatrix, scores, threshold = 0.7, orgdb = "org.Mybeast.eg.db")
2. getGoSize(rownames(simMatrix), orgdb)
3. suppressMessages(AnnotationDbi::select(orgdb, keytype = "ENTREZID", 
 .     columns = c("GO", "ONTOLOGY"), keys = AnnotationDbi::keys(orgdb, 
 .         keytype = "ENTREZID")))
4. withCallingHandlers(expr, message = function(c) if (inherits(c, 
 .     classes)) tryInvokeRestart("muffleMessage"))
5. AnnotationDbi::select(orgdb, keytype = "ENTREZID", columns = c("GO", 
 .     "ONTOLOGY"), keys = AnnotationDbi::keys(orgdb, keytype = "ENTREZID"))
6. AnnotationDbi::select(orgdb, keytype = "ENTREZID", columns = c("GO", 
 .     "ONTOLOGY"), keys = AnnotationDbi::keys(orgdb, keytype = "ENTREZID"))
7. .select(x, keys, columns, keytype, jointype = jointype, ...)
8. testSelectArgs(x, keys = keys, cols = cols, keytype = keytype, 
 .     fks = fks, skipValidKeysTest = skipValidKeysTest)
9. testForValidKeytype(x, keytype)
10. stop(msg)

I would be good to have the possibility to the specify the keytype when calling the functions.

ssayols commented 3 years ago

good point. I just patched the version in Github so you can call the function to reduce the terms with a custom keytype, which defaults to ENTREZID:

     reduceSimMatrix(
       simMatrix,
       scores = NULL,
       threshold = 0.7,
       orgdb,
       keytype = "ENTREZID"
     )

Could you please install the latest version with devtools (devtools::install_github("https://github.com/ssayols/rrvgo")) and give it a go? I'll deploy the patch to Bioconductor but probably won't be available until tomorrow.

I don't have access to a custom orgdb object, so any feedback will be appreciated. Thanks!

lassancejm commented 3 years ago

I just ran a test with the latest github version and happy to report that it is working fine.

Thanks for your quick response!

ssayols commented 3 years ago

excellent, thanks!

lassancejm commented 2 years ago

I think this should be re-open. I had the same issue again today, using a version from Bioconductor (sorry can't tell which version) and had to revert back to installing from the github repo.

ssayols commented 2 years ago

This should be fixed in rrvgo 1.4.4 (Bioconductor 3.13). Could you confirm which version of rrvgo you have loaded, via sessionInfo()?

lassancejm commented 2 years ago

Nvm, it seems that the issue is coming from the fact that I was using an older version of Bioconductor (3.12), so am limited in which version of rrvgo I can install via bioconductor. Will stick to the devel version than.

ssayols commented 2 years ago

Thanks for the feedback! I'd prefer not to backport the feature to previous versions, unless you tell me the devel version doesn't work anymore on Bioconductor 3.12

lassancejm commented 2 years ago

I understand. The devel version works fine as far as I can tell.