[BioPython] blast output xml

Javier Díez jdiezperezj at gmail.com
Wed Aug 1 08:13:24 UTC 2007


Hy Peter,
I followed the tutorial cookbook steps but I got the same exception (see
below). The output I got running blast locally is not XML but text. I guess
it might be related to the version I'm using (python 2.5, biopython
1.42.2on ubuntu
7.4). Any idea?
On the other hand I think there is a mistake in the cookbook, instead of:
>>> from Bio.Blast import NCBIXML
>>> blast_records = NCBIXML.parse(result_handle)
I think it should be:
>>> blast_parser= NCBIXML.BlastParser()
>>> blast_result=blast_parser.parse(result_handle)
Thanks
Javi

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/var/lib/python-support/python2.5/Bio/Blast/NCBIXML.py", line 112,
in parse
    self._parser.parse(handler)
  File "/usr/lib/python2.5/site-packages/_xmlplus/sax/expatreader.py", line
109, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python2.5/site-packages/_xmlplus/sax/xmlreader.py", line
125, in parse
    self.close()
  File "/usr/lib/python2.5/site-packages/_xmlplus/sax/expatreader.py", line
226, in close
    self.feed("", isFinal = 1)
  File "/usr/lib/python2.5/site-packages/_xmlplus/sax/expatreader.py", line
220, in feed
    self._err_handler.fatalError(exc)
  File "/usr/lib/python2.5/site-packages/_xmlplus/sax/handler.py", line 38,
in fatalError
    raise exception
xml.sax._exceptions.SAXParseException: <fdopen>:1:0: no element found


On 7/31/07, Peter <biopython at maubp.freeserve.co.uk> wrote:
>
> Javier Díez wrote:
> > Hi,
> > Does anyone knows if is it possible to get blast-xml output running
> blast
> > from biopython scripts?
> > How can I do that?
> > Thanks
> > Javi
>
> Yes, you can run standalone blast from Biopython, and parse its XML
> output. See "Chapter 3 BLAST" of the tutorial:
>
> http://biopython.org/DIST/docs/tutorial/Tutorial.html
>
> Note that while parsing the plain text worked well with older versions
> of BLAST. We don't recommend using this anymore - use the XML output.
>
> Peter
>




More information about the Biopython mailing list