[BioPython] qblast fails on parsing XML results

Michiel De Hoon mdehoon at c2b2.columbia.edu
Sat Mar 4 15:33:36 EST 2006

Fixed in CVS using urllib2. Thanks to Alexander Morgan for providing the
code. Please let us know if there is still a problem with qblast.


Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1150 St Nicholas Avenue
New York, NY 10032

-----Original Message-----
From: biopython-bounces at portal.open-bio.org on behalf of Ilya Soifer
Sent: Mon 2/27/2006 10:38 AM
To: biopython at biopython.org
Subject: [BioPython] qblast fails on parsing XML results
I hope that I send it to the correct list.
When I run qblast I get

>>> res1 = NCBIWWW.qblast("blastn", "nr", seq1)

Traceback (most recent call last):
 File "<pyshell#24>", line 1, in -toplevel-
   res1 = NCBIWWW.qblast("blastn", "nr", seq1)
 File "C:\Python24\Lib\site-packages\Bio\Blast\NCBIWWW.py", line
1130, in qblast
   i = results.index("Connection: close")
ValueError: substring not found

This happens since the results that Blast return no longer have this header

   # HTTP/1.1 200 OK
   # Date: Wed, 05 Oct 2005 02:13:33 GMT
   # Server: Nde
   # Content-Type: text/plain
   # Connection: close

but this one

HTTP/1.0 200 OK
Date: Mon, 27 Feb 2006 11:54:40 GMT
Content-Type: application/xml
Server: Nde
Via: 1.1 proxy7 (NetCache NetApp/6.0.2)

I guess it might be better to look for something like "<?xml" etc. in
order to remove the annoying header.


BioPython mailing list  -  BioPython at biopython.org

More information about the BioPython mailing list