Search code examples
rruntime-errorbioconductorinstall.packagesbiomart

Error in EnsDb.Hsapiens.v86 package to convert ensembl to symbol


I installed package EnsDb.Hsapiens.v86 to convert genes ensembl to symbol, after trying many packages that's the best one to conversion with less NAs. I tried to write the code but I got unsual error, here's my code:

library(EnsDb.Hsapiens.v86)
mapIds = mapIds (EnsDb.Hsapiens.v86,
             keys = genes, 
             keytype = "GENEID", 
             column = "SYMBOL")

after that code conversion must be done, but I got this error:

Error: 'filter' has to be an 'AnnotationFilter', a list of 'AnnotationFilter' object, an 'AnnotationFilterList' or a valid filter expression!


Solution

  • Maybe your keys are problematic, e.g. not a character vector. Try if it works for you with the reproducible example below:

    library(EnsDb.Hsapiens.v86)
    genes <- c("ENSG00000102145", "ENSG00000179348", "ENSG00000107485")
    mapIds(EnsDb.Hsapiens.v86,
                 keys = genes, 
                 keytype = "GENEID", 
                 column = "SYMBOL")
    #> ENSG00000102145 ENSG00000179348 ENSG00000107485 
    #>         "GATA1"         "GATA2"         "GATA3"
    

    Created on 2022-04-10 by the reprex package (v2.0.1)