Converting Entrez gene ids to Ensembl gene ids
1
0
Entering edit mode
5.3 years ago
Natasha ▴ 40

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?

gene entrez ensembl • 7.0k views
ADD COMMENT
1
Entering edit mode
5.3 years ago

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 COMMENT
0
Entering edit mode
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 REPLY
1
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 1377 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6