Error Using Entrez.Esummary From Biopython
3
0
Entering edit mode
13.3 years ago
Martin ▴ 30

Can someone please explain this error?

I hava a smal script that tries to fetch information from the a NCBI BioAssay using the Entrez module form Bipython. I get an error I do not understand. I try to run:

from Bio import Entrez
Entrez.email="yourname@mail.se"

handle_esummary=Entrez.esummary(db='pcassay',id='1337')
record_esummary=Entrez.read(handle_esummary)

I get the error:

File "smaltest.py", line 5, in <module>
    record_esummary=Entrez.read(handle_esummary)
  File "/usr/common/schrodinger/mmshare-v20109/lib/Linux-x86_64/lib/python2.7/site-packages/Bio/Entrez/__init__.py", line 297, in read
    record = handler.run(handle)
  File "/usr/common/schrodinger/mmshare-v20109/lib/Linux-x86_64/lib/python2.7/site-packages/Bio/Entrez/Parser.py", line 90, in run
    self.parser.ParseFile(handle)
  File "/usr/common/schrodinger/mmshare-v20109/lib/Linux-x86_64/lib/python2.7/site-packages/Bio/Entrez/Parser.py", line 105, in startElement
    itemtype = str(attrs["Type"]) # convert from Unicode
KeyError: 'Type'
biopython entrez eutils ncbi • 5.3k views
ADD COMMENT
0
Entering edit mode

I tried handle_esummary=Entrez.esummary(db="journals",id="30367"); record = Entrez.read(handle_esummary) and it is ok. But I got same error message, so I think it is the parsing problem of biopython to different database.

ADD REPLY
0
Entering edit mode

I tried handle_esummary=Entrez.esummary(db="journals",id="30367"); record = Entrez.read(handle_esummary) and it is ok. But I got same error message when I use your example, so I think it is the parsing problem of biopython to different database.

ADD REPLY
0
Entering edit mode

It's about programmatically access of esummary, efetch with available database (pcassay, pubmed, nucleotide, journal) at NCBI have nothing to do with parsing I guess.

ADD REPLY
0
Entering edit mode

http://biopython.org/DIST/docs/api/Bio.Entrez.Parser-pysrc.html

I think the error raised at the line 263 when biopython tried to parse the XML result but failed to get an attribute named "type". I didn't read it carefully, so it is just my guessing.

ADD REPLY
1
Entering edit mode
13.3 years ago
Peter 6.0k

Hi,

I can reproduce this and the cause is the NCBI using lowercase in one tag's attribute:

<Item Name="SourceNameList" type="List">

All the other [?] tags in the XML from eSummary use Type rather than type, and this is what the NCBI's XML DTD file says should be used. As a result, the XML file fails XML validation.

i.e. This is a bug in the NCBI eSummary service, please report it to them.

You can demonstrate this using http://validator.w3.org/ (or another XML validator) and either save the XML via Python, or enter this URL directly: http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?tool=biopython&db=pcassay&id=1337

Peter

ADD COMMENT
1
Entering edit mode
13.0 years ago
Martin ▴ 30

The bug has been fixed. The NCBI finally took their time and corrected the error.

Many thanks for your help Peter.

ADD COMMENT
0
Entering edit mode
13.2 years ago
Martin ▴ 30

NCBI has been made aware of the bug.

Waiting to see how long time it will take for them to fix it.

ADD COMMENT

Login before adding your answer.

Traffic: 2118 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6