This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Gene IDs turn into mutiple Ensembl IDs?

Hi!

I am trying to use the MyGene python module to convert Gene IDs into Ensembl IDs. However an issue I noticed was that some Gene IDs turn into multiple Ensembl IDs. Why is this? For example:

A1BG turns into ENSG00000121410 and ENSG00000268895

Here is the code I'm using:

import mygene

mg = mygene.MyGeneInfo()

result = mg.query("A1BG", scopes='symbol', fields=['ensembl'], species="human")

for hit in result["hits"]:
     if "ensembl" in hit and "gene" in hit["ensembl"]:
          print(hit["ensembl"]["gene"])

Thank you!

python ensembl genome

2 answers

Alternatively, you could use gget search to find Ensembl IDs linked to a gene symbol, and then check the returned Ensembl IDs with gget info.

pip install gget, then simply:

# Command-line
gget search -s human A1BG
gget info ENSG00000121410
# Python
import gget
gget.search("A1BG", "human")
gget.info("ENSG00000121410")

Haplotypes, maybe, after looking at the Ensembl records for those two accessions. Why am I getting different ensembl gene ids for a given gene symbol?

Log in to answer this question.