[Biopython] Moving from Bio.PubMed to Bio.Entrez

Peter Cock p.j.a.cock at googlemail.com
Sat Jul 18 11:48:30 UTC 2009


On Fri, Jul 17, 2009 at 2:29 PM, Martin
MOKREJŠ<mmokrejs at ribosome.natur.cuni.cz> wrote:
> Hi Brad,
>  thanks for clarification. I somewhat overlooked in the tutorial that
> Entrez.read() requires me to ask for XML rettype and that it parses
> the XML result by itself into the dictionary structure. Still I think it should
> check what values I have passed down to Entrez.efetch() function.

This isn't going to be possible given that Entrez.read() just takes a
file handle. This separation between getting the data and parsing
it is deliberate. The handle you give to Entrez.read() might be to a
file on disk (saved from a previous search) instead of an Internet
handle to a live NCBI Entrez connection.

> Either way, my code works now with Bio.Entrez instead of the
> deprecated Bio.PubMed.

Good.

Note you didn't have to switch to using the XML from Entrez (e.g.
with the Bio.Entrez.read() funciton). It sounds like you were using
Bio.PubMed to access the data (in Medline format), and internally
this used Bio.Medline to parse it. Therefore, it would have been
less upheaval to use Bio.Entrez to fetch the data (as Medline files),
and continue to use Bio.Medline to parse this. See the section
"Parsing Medline records" in the Entrez chapter of the tutorial.

Peter




More information about the Biopython mailing list