This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Retrieving Sequences using NCBI Gene database IDs

I'm trying to automatically retrieve sequences for genes defined by NCBI Gene identifiers. Example gene ID: 114787. Page on the Gene database site for this is: http://www.ncbi.nlm.nih.gov/gene/?term=114787%5Buid%5D

There's links on that page to the nucleotide database to get sequences for this gene in FASTA format, which is what I want. But, I can't query the nucleotide database with Biopython through the Efetch service because the IDs are different. I've tried using the elink service to map from Gene ID to nucleotide ID but I just get a massive list of IDs out, which can't be right.

How should I be doing this for a large number of Entrez Gene IDs? Preferably with Biopython.

sequence biopython gene

1 answer

http://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi?db=gene shows that you can restrict the output of Elink to the refseq sequences linkname=gene_nuccore_refseqrna.

The query for NOTCH2 would be: http://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=gene&db=nucleotide&id=4853&linkname=gene_nuccore_refseqrna

Although, your script as written there fails to run. There's a problem with the tab delimiters (maybe they got reformatted when you pasted it in here?). I replaced them with $'\t' but the script just hangs.

Writing my own code it looks like each Gene ID maps to multiple protein IDs. You say in the comments on the other post that I could just select any of these protein IDs and it wouldn't matter. Do you mean that for a set of protein IDs which map to a single Gene ID they will return the same sequence?

Log in to answer this question.