[Biopython-dev] [Bug 2771] New: Entrez.efetch: dbSNP not supported yet?
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Fri Feb 20 11:43:20 EST 2009
http://bugzilla.open-bio.org/show_bug.cgi?id=2771
Summary: Entrez.efetch: dbSNP not supported yet?
Product: Biopython
Version: 1.49b
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Main Distribution
AssignedTo: biopython-dev at biopython.org
ReportedBy: dalloliogm at gmail.com
Executing efetch on the 'snp' database returns an html file instead of an xml
(by default, running efetch on 'gene' or another database returns an xml).
>>> handle = Entrez.efetch(db='snp', id='9996597',)
>>> cont = handle.read()
>>> print cont
<html>
...
</html>
Moreover, even when forcing retmode=xml, it seems that the xml file returned is
written in an xml not supported by biopython (not sure if this a ncbi's
problem):
>>> handle = Entrez.efetch(db='snp', id='9996597', retmode='xml')
>>> cont = handle.read()
>>> print cont
'<?xml version="1.0"?>
<ExchangeSet...>
...
</ExchangeSet>
You can see the problem better if you open the result handle as explained in
the tutorial, via Entrez.read:
>>> handle = Entrez.efetch(db='snp', id='9996597', retmode='xml')
>>> result = Entrez.read(handle)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
/home/gioby/Test/NCBI_wsdl/<ipython console> in <module>()
/home/gioby/usr/share/biopython/Bio/Entrez/__init__.pyc in read(handle)
284 DTDs = os.path.join(__path__[0], "DTDs")
285 handler = DataHandler(DTDs)
--> 286 record = handler.run(handle)
287 return record
288
/home/gioby/usr/share/biopython/Bio/Entrez/Parser.py in run(self, handle)
93 self.parser.CharacterDataHandler = self.characters
94 self.parser.ExternalEntityRefHandler =
self.external_entity_ref_handler
---> 95 self.parser.ParseFile(handle)
96 self.parser = None
97 return self.object
/home/gioby/usr/share/biopython/Bio/Entrez/Parser.py in startElement(self,
name, attrs)
129 self.attributes = attrs
130 return
--> 131 if object!="":
132 object.tag = name
133 if attrs:
UnboundLocalError: local variable 'object' referenced before assignment
Try this code also, it will return a different error:
>>> handle = Entrez.efetch(db='snp', id='9996597') # retmode is HTML
>>> result = Entrez.read(handle)
--
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