[BioPython] qblast fails on parsing XML results

Michiel De Hoon mdehoon at c2b2.columbia.edu
Mon Feb 27 13:16:47 EST 2006


There is a simpler solution to this, which is to use urllib instead of the
socket library in the function _send_to_qblast and _send_to_blasturl. If we
use urllib, we get the results automatically without the HTTP header.

So .... does anybody know why socket is used instead of urllib? If it's
because older Python versions didn't have urllib, we can just replace socket
by urllib to solve this problem. Or am I missing something?

--Michiel.

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
 
Hi,
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.

Ilya

_______________________________________________
BioPython mailing list  -  BioPython at biopython.org
http://biopython.org/mailman/listinfo/biopython




More information about the BioPython mailing list