I am trying to convert these gene symbols( that's what i think they are) to ensembl ID's using biomaRt package. But for some reason it seems to fail. Would love to have some feedback!


    library(biomaRt)
    
    ensembl <- useMart("ensembl", dataset="mmusculus_gene_ensembl")
    
    genes <- c("Acad11","Acad8", "Acad9","Acadm","Acadsb", "Acan" ,"Acap1","Acap2" ,"Acat1","Acbd3", "Acbd4")
    
    foo <- getBM(attributes=c('ensembl_gene_id',
                              'external_gene_name'),
                 filters = 'hgnc_symbol',
                 mart = ensembl,
                 values = genes)

Thanks in advance.


Almost correct but it must be `mgi_symbol` instead of `hgnc_symbol` since the HGNCs represent human genes. MGI is the equivalent for mouse.
By the way it is **Ensembl** not Ensembl**e**, just saying if you ever write this up as a paper be sure to correctly spell the data sources ;-)

    library(biomaRt)
    
    ensembl <- useMart("ensembl", dataset="mmusculus_gene_ensembl")
    
    genes <- c("Acad11","Acad8", "Acad9","Acadm","Acadsb", "Acan" ,"Acap1","Acap2" ,"Acat1","Acbd3", "Acbd4")
    
    foo <- getBM(attributes=c('ensembl_gene_id',
                              'external_gene_name'),
                 filters = 'mgi_symbol',
                 mart = ensembl,
                 values = genes)
    
    > foo
          ensembl_gene_id external_gene_name
    1  ENSMUSG00000090150             Acad11
    2  ENSMUSG00000031969              Acad8
    3  ENSMUSG00000027710              Acad9
    4  ENSMUSG00000062908              Acadm
    5  ENSMUSG00000030861             Acadsb
    6  ENSMUSG00000030607               Acan
    7  ENSMUSG00000001588              Acap1
    8  ENSMUSG00000049076              Acap2
    9  ENSMUSG00000032047              Acat1
    10 ENSMUSG00000026499              Acbd3
    11 ENSMUSG00000056938              Acbd4