[Biopython] Formatting of the xml return from Entrez DB Gene is not parsed correctly

Peter biopython at maubp.freeserve.co.uk
Fri Sep 11 07:48:13 EDT 2009


On Fri, Sep 11, 2009 at 12:39 PM, Michael S. Koeris
<michael.koeris at gmail.com> wrote:
> Hi Peter,
>
> I am using
>
> handle = Entrez.efetch(db='gene', id=UID['Activin B'][0][0], rettype='xml')
> testDic = handle.read()
>
> UID['Activin B'][0][0] is the unique gene number I grabbed earlier through
> an Entrez.esearch and in this case is : 90
>
> Many thanks
> Mike

You should be using retmode="xml", not retype="xml". See:
http://eutils.ncbi.nlm.nih.gov/corehtml/query/static/efetchseq_help.html

Is there a mistake in our documentation somewhere, or was this a typo?

You are getting back an HTML error page, which of course our XML
parser doesn't like. Try:

from Bio import Entrez
record = Entrez.read(Entrez.efetch(db='gene', id='90', retmode='xml'))

Peter


More information about the Biopython mailing list