This is a test version of Biostars. For the public version, visit https://www.biostars.org.
map Ensembl gene ID from hg19 to hg38

Hello!

I would like to convert Ensembl gene ID from hg19 to hg38 with R. I tried with this code:

ensembl <- useMart("ensembl", dataset = "hsapiens_gene_ensembl", host= "grch37.ensembl.org")
ensembl_ids <- c("ENSG00000183878", "ENSG00000146083")
converted_ids <- getLDS(attributes = c("ensembl_gene_id"), filters = "ensembl_gene_id", values = your_ensembl_ids,  mart = ensembl, attributesL = c("ensembl_gene_id"), martL = useMart("ensembl", dataset= "hsapiens_gene_ensembl", host = "www.ensembl.org"))

But I get this error:

Error in getLDS(attributes = c("ensembl_gene_id"), filters = "ensembl_gene_id",  :    Both datasets must be located on the same host.

Do you any suggestions on how to map the ensembl id with bioMart? Or other R packages?

Thank you in advance!

biomart ensembl

1 answer

Hi pingu77,

It's not possible to convert gene IDs between different assemblies with BioMart. Instead, you can use the Ensembl ID History Convertor tool as either a web-based tool as a script:

[1] https://www.ensembl.org/Homo_sapiens/Tools/IDMapper [2] https://github.com/Ensembl/ensembl-tools/tree/release/110/scripts/id_history_converter

Log in to answer this question.