Hi all,

I am using clusterProfiler to perform KEGG enrichment. I have a list of gene Symbol (Rat genes). First I need to translate the symbols to EntrezID.

I installed the Genome wide annotation for Rat:

    source("https://bioconductor.org/biocLite.R")
    biocLite("org.Rn.eg.db")

Then I tried to run the command:

    x <- c("GPX3",  "GLRX",   "LBP",   "CRYAB", "DEFB1", "HCLS1",   "SOD2",   "HSPA2",
           "ORM1",  "IGFBP1", "PTHLH", "GPC3",  "IGFBP3","TOB1",    "MITF",   "NDRG1",
           "NR1H4", "FGFR3",  "PVR",   "IL6",   "PTPRM", "ERBB2",   "NID2",   "LAMB1",
           "COMP",  "PLS3",   "MCAM",  "SPP1",  "LAMC1", "COL4A2",  "COL4A1", "MYOC",
           "ANXA4", "TFPI2",  "CST6",  "SLPI",  "TIMP2", "CPM",     "GGT1",   "NNMT",
           "MAL",   "EEF1A2", "HGD",   "TCN2",  "CDA",   "PCCA",    "CRYM",   "PDXK",
           "STC1",  "WARS",  "HMOX1", "FXYD2", "RBP4",   "SLC6A12", "KDELR3", "ITM2B")

    eg = bitr(x, fromType="SYMBOL", toType="ENTREZID", OrgDb="org.Rn.eg.db")

Then I got the warning message:

> 'select()' returned 1:1 mapping between keys and columns Warning
> message: In bitr(x4, fromType = "SYMBOL", toType = "ENTREZID", OrgDb =
> Rat) :
>   98.21% of input gene IDs are fail to map...

Could anyone tell me what happened and how should I do?

Many thanks,
Stanley
The root of your problem is that your gene names are all upper case, but for rat (and mouse etc) generally only the first letter is capitalised, and the `bitr` conversion is case sensitive.  We can use the function `str_to_title` in the **stringr** package to fix this:

    install.packages('stringr')
    x2 <- stringr::str_to_title(x) 
    head(x2)

Here's what they look like now:

    [1] "Gpx3"  "Glrx"  "Lbp"   "Cryab" "Defb1" "Hcls1"

Then rerun your query:

    eg = bitr(x2, fromType="SYMBOL", toType="ENTREZID", OrgDb="org.Rn.eg.db")

and we get a much better proportion of converted IDs 

    'select()' returned 1:1 mapping between keys and columns
    Warning message:
    In bitr(str_to_title(x), fromType = "SYMBOL", toType = "ENTREZID",  :
      1.79% of input gene IDs are fail to map...

Looking at some of the other answers, **PVR** is an exception to the capitalisation rule.  Since Kevin's **biomaRt** answer isn't case sensitive, it's perhaps the best solution assuming you have reliable internet.