Concatenation of Bimap
2
0
Entering edit mode
Dario Strbenac ★ 1.5k
@dario-strbenac-5916
Last seen 29 days ago
Australia

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 • 811 views
ADD COMMENT
3
Entering edit mode
@james-w-macdonald-5106
Last seen 5 hours ago
United States

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.

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

That's actually AnnotationDbi, not AnnotationForge, correct?
 

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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.

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

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()).

 

ADD COMMENT

Login before adding your answer.

Traffic: 239 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