Question: Concatenation of Bimap
0
3.8 years ago by
Dario Strbenac1.5k
Australia
Dario Strbenac1.5k wrote:

Is it possible to concatenate two AnnDbBimaps without lots of coercions ? I would like to put org.Hs.egSYMBOL2EG and org.Hs.egALIAS2EG into a single AnnDbBimap object, so I could do lookups for a list of differentially expressed genes that are a mix of official symbols and aliases. c does not work as expected.

annotationdbi concatenate • 678 views
modified 3.8 years ago by James W. MacDonald50k • written 3.8 years ago by Dario Strbenac1.5k
3
3.8 years ago by
United States
James W. MacDonald50k wrote:

BiMaps are like old and stuff. If you want to do that, use select(). The SYMBOL column is for the current HUGO symbol, and ALIAS is for the current HUGO symbol, and all preceding ones.

> select(org.Hs.eg.db, c("A1B","ABG","GAB","HYST2477","A1BG"), "ENTREZID","SYMBOL")
'select()' returned 1:1 mapping between keys and columns
SYMBOL ENTREZID
1      A1B     <NA>
2      ABG     <NA>
3      GAB     <NA>
4 HYST2477     <NA>
5     A1BG        1
> select(org.Hs.eg.db, c("A1B","ABG","GAB","HYST2477","A1BG"), "ENTREZID","ALIAS")
'select()' returned 1:many mapping between keys and columns
ALIAS ENTREZID
1      A1B        1
2      A1B     6641
3      ABG        1
4      GAB        1
5 HYST2477        1
6     A1BG        1

And here you see why you cannot really rely on symbols - there is no guarantee that they are unique.

The select interface is great! It's a shame that all of the help pages only show the as.list(databaseVariable) approach.

We've documented select() in the AnnotationForge man pages in devel. The next release of packages made with AnnotationForge (including the OrgDb family) will have these new man pages.

Valerie

That's actually AnnotationDbi, not AnnotationForge, correct?

The changes I made were to the man pages in AnnotationForge/inst/AnnDbPkg-templates. Looking in AnnotationDbi, several man pages already mention select() - AnnotationDb-class, Bimap-keys etc. Were there specific pages in AnnotationDbi you thought could use a refresh?

Valerie

No, that was a mixup on my part. I thought you were talking about the man pages in AnnotationDbi, and had written AnnotationForge by mistake.

2
3.8 years ago by
Martin Morgan ♦♦ 23k
United States
Martin Morgan ♦♦ 23k wrote:

All the SYMBOL keys are included in ALIAS

> all(keys(org.Hs.egSYMBOL2EG) %in% keys(org.Hs.egALIAS2EG))
[1] TRUE

so just use the ALIAS (via mapIds() or perhaps select()).