[Biopython] Access Entrez gene DB using rettype 'gb'

David Jacobs developer at allthingsprogress.com
Thu Dec 2 20:42:09 UTC 2010


I want to do something obvious but can't find a good way to do it. Maybe I'm
looking in the wrong places. Anyway, I figured I'd ask here. (Bear with me,
I'm new to Python and Biopython.)

My question is: What's the easiest way to find and parse DNA sequences from
the gene database?

I'd like to use something like:

handle = Entrez.efetch(db='gene', id='2', rettype='gb')
handle.read()

But this doesn't work. After poking around, I've learned you can do this
query on, the nucleotide database. But not on the gene database. Instead, I
have to do this:

handle = Entrez.efetch(db='gene', id='2', retmode='gb')

I get back something like this:

http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=gene&id=2&retmode=gb

That isn't easily parseable, at least as far as I can tell. So what's the
best way for me to find my sequence? And is there a parser for the string I
get from retmode='gb'?

Thanks,
David



More information about the Biopython mailing list