[Biopython-dev] [Bug 2468] Tutorial needs a fix: Bio.WWW.NCBI
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Thu Mar 13 07:27:14 EDT 2008
http://bugzilla.open-bio.org/show_bug.cgi?id=2468
------- Comment #2 from biopython-bugzilla at maubp.freeserve.co.uk 2008-03-13 07:27 EST -------
Reading the Bio.Entrez documentation, the query function always returns HTML.
You could also use the esearch function which returns XML, followed by the
efetch function which seems to support a range of options depending on the
datatype. For example, using the taxonomy db:
#This gets an XML file from the following URL,
#http://www.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=taxonomy&term=Cypripedioideae
from Bio import Entrez
result_handle = Entrez.esearch("taxonomy", term="Cypripedioideae")
print result_handle.read()
You could then parse the XML file to extract the matching ID(s), perhaps with a
regular expression. In this case, there is only one match, 158330.
#http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=taxonomy
#&id=9685&report=brief&retmode=text
from Bio import Entrez
result_handle = Entrez.efetch("taxonomy", id="158330", \
report="docsum", retmode="text")
print result_handle.read()
#Given ID 9685, returns "Cypripedioideae, subfamily, monocots"
I agree that this section of the tutorial could be more useful. Do you think
the above could would be more helpful?
--
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Biopython-dev
mailing list