[Biopython] Question about efetch output format

Peter biopython at maubp.freeserve.co.uk
Thu Sep 3 16:38:57 UTC 2009


On Thu, Sep 3, 2009 at 5:06 PM, jorma kala<jjkk73 at gmail.com> wrote:
> Hi,
> I'm trying to retrieve a record from protein database (I found the record id
> by running Entrez.esearch)
>
>    handle = Entrez.efetch(db="protein", id='483329',mode='xml')
>    print handle.read()
> Although I specify xml mode, the result comes in a quite confusing format
> using braces  (I've pasted a snippet at the end of the email)
>
> Do you know what I should do to get it in xml?
> Many thanks

You've got the default ASN.1 output. You need to use "retmode" not "mode",

from Bio import Entrez
handle = Entrez.efetch(db="protein", id='483329',retmode='xml')
print handle.read()

I thought both the Biopython documentation and the NCBI documentation
was clear on this - maybe you found a typo? Please let us know if there is
an error in any of the documentation or examples.

Thanks

Peter




More information about the Biopython mailing list