Question: Converting Entrez gene ids to Ensembl gene ids
0
gravatar for Natasha
9 months ago by
Natasha40
Natasha40 wrote:

I want a map a set of Entrez gene ids to Ensembl gene ids. I came across some posts that mention about mapping Ensembl ids to Entrez ids using Biomart. I am not sure how to do the mapping the other way round.

I would like to do this programmatically. Any suggestions on how the mapping can be done?

entrez ensembl gene • 567 views
ADD COMMENTlink modified 9 months ago by Jean-Karim Heriche22k • written 9 months ago by Natasha40
1
gravatar for Jean-Karim Heriche
9 months ago by
EMBL Heidelberg, Germany
Jean-Karim Heriche22k wrote:

You can use Ensembl Biomart for this. Follow previous instructions just swapping the IDs, i.e. use Entrez gene IDs as filter and retrieve Ensembl IDs as attribute. Programmatically, you can use the Ensembl perl API or the Bioconductor R package biomaRt. With the Ensembl API, this could be something along the lines of:

my $registry = "Bio::EnsEMBL::Registry";
$registry->load_all(".ensembl_init");
my $gene_adaptor = $registry->get_adaptor('Homo sapiens', 'core', 'gene');
my $extID = 5347;
my @genes = @{$gene_adaptor->fetch_all_by_external_name($extID)};
ADD COMMENTlink written 9 months ago by Jean-Karim Heriche22k
library("biomaRt")                                                                                                                   
listMarts()                                                                                                                           
ensembl <- useMart("ensembl",dataset="hsapiens_gene_ensembl")                                                                         
filters = listFilters(ensembl)                                                                                                        
entrezgene = ("3098","728642|982")             
genes <- getBM(filters="entrezgene_id", attributes=c("ensembl_gene_id","entrezgene_id"), values=entrezgene, mart=ensembl)                                                                                                                 
print(genes)

Thanks a lot for the response. I have tired the above in R. When entrezgene = ("3098") the code works fine.

When the input is changed to entrezgene = ("3098","728642|982") , the following error occurs

Error: unexpected ',' in "entrezgene = ("3098","                                                                                      
Execution halted

Also, I am not sure how to map cases like this ""728642|982" which is present in my input data containing list of entrez gene ids.

Any suggestions?

ADD REPLYlink modified 9 months ago by Jean-Karim Heriche22k • written 9 months ago by Natasha40
1

I don't know where your data is coming from but a pipe symbol i.e. |, is often used to delimit two pieces of data related to the same item, here two IDs relating to the same gene. The error you're getting is because you have a syntax error. In R, a vector is specified with c(), i.e. entrezgene = c("3098","728642|982").

ADD REPLYlink written 9 months ago by Jean-Karim Heriche22k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1204 users visited in the last hour