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!
• 3,317 views
•
link
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")
• 0 views
•
link
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?
• 1 views
•
link
Log in to answer this question.