I am struggling with likely a simple problem, but I can't get it to work... I would appreciate if one of the more knowledgeable people could provide some code/directions to get it working...
Thanks, Guido
I have a data frame consisting of human Entrez IDs, which I would like to convert into Gene Symbols. NAs should preferably be removed. How to best do this? the select()
function only accepts a character vector... (as expected).
> library(org.Hs.eg.db) > myGenes[1:3,1:15] V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 1 1572 1571 4129 216 316 217 15 3620 7453 847 3028 1573 1576 38 3033 2 51478 3295 3294 3293 3284 3292 3283 2165 1586 1369 NA NA NA NA NA 3 10 6799 54600 6817 1544 54657 NA NA NA NA NA NA NA NA NA > class(myGenes) [1] "data.frame" > anno.result <- select(org.Hs.eg.db, keys=myGenes, columns=c("SYMBOL"),keytype="ENTREZID") Error in .testForValidKeys(x, keys, keytype, fks) : 'keys' must be a character vector >
@Aaron and Leandro,
Thanks for your replies. Although both suggestions do work, it doesn't work for my use case (which turned out not to be sufficiently clear): I would like to get back the same data frame/matrix, but with the IDs replaced by the corresponding Symbols. Both your suggestions "only" return a 'conversion table' (i.e. a data frame with only 2 columns; ID vs Symbol)..