Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orgdb note didn't work in Gene annotation #53

Open
Gammerdinger opened this issue May 10, 2024 · 2 comments
Open

Orgdb note didn't work in Gene annotation #53

Gammerdinger opened this issue May 10, 2024 · 2 comments
Assignees

Comments

@Gammerdinger
Copy link
Contributor

This is a draft of how to fix it:
#check available updated database
query(ah,'org.Hs.eg.db.sqlite')
human_orgdb <- query(ah, c("Homo sapiens", "OrgDb"))
test <- human_orgdb[["AH111575"]]
test

@Gammerdinger
Copy link
Contributor Author

query(ah,'org.Hs.eg.db.sqlite') is key. different versions of bioc impact this

@hwick
Copy link
Contributor

hwick commented May 10, 2024

Unfortunately while this works, the following line from the original code, which uses select() will not work on it without specifying the package select() is from:

human_orgdb <- human_orgdb[["AH111575"]]
annotations_orgdb <- select(human_orgdb, res_tableOE_tb$gene, c("SYMBOL", "GENENAME", "ENTREZID"), "ENSEMBL")
Error in UseMethod("select") : 
  no applicable method for 'select' applied to an object of class "c('OrgDb', 'AnnotationDb', 'envRefClass', '.environment', 'refClass', 'environment', 'refObject', 'AssayData')"

This, however, will work (with a warning):

human_orgdb <- human_orgdb[["AH111575"]]
annotations_orgdb <- AnnotationDbi::select(human_orgdb, res_tableOE_tb$gene, c("SYMBOL", "GENENAME", "ENTREZID"), "ENSEMBL")
'select()' returned 1:many mapping between keys and columns

Which also implies that the note itself is wrong, since the note mentions these 1:many mappings are automatically removed.

And in fact there are duplicate ENTREZ IDs

> annotations_orgdb<-annotations_orgdb[!is.na(annotations_orgdb$ENTREZID),]
> dim(annotations_orgdb)
[1] 36282     4
> sum(is.na(annotations_orgdb$ENTREZID))
[1] 0
> sum(duplicated(annotations_orgdb$ENTREZID))
[1] 272

Unless there is a different select() that produces a working result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants