[BioPython] windows : reading local blast output

Michiel De Hoon mdehoon at c2b2.columbia.edu
Tue Nov 20 00:57:59 UTC 2007


It looks like you are trying to parse Blast plain-text output. It is not
necessarily related to the \r\n problem, it may be that you are running a
different Blast version on Windows. Differences between Blast versions tend
to break the plain-text Blast output parser.
How about trying to parse Blast output in XML format? See the tutorial for
more information.

--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 lists.open-bio.org on behalf of Srinivas Iyyer
Sent: Mon 11/19/2007 5:34 PM
To: biopython at biopython.org
Subject: [BioPython] windows : reading local blast output
 
Dear group, 

I am using Python (2.4) and biopython(1.44) in
windows. I installed a local blast version for
windows. 

The following code breaks down and throws the error
pasted below for convenience:
This part of the code works when used on Linux based
blast output.  Obviously I suspect the '\r\n' for
windows.


Code:

from Bio import Blast
from Bio.Blast import NCBIStandalone

blast_out = open('C:\human\prb_blast.out','U')
result = []
b_parser = NCBIStandalone.BlastParser()
b_iterator =
NCBIStandalone.Iterator(blast_out,b_parser)
b_record = b_iterator.next()

I tried opening file handle with  'r', 'rU' and 'U'
options. Yet there is no success. 

Could you help me here. I never had this issue before
because I never used windows for blast. 

Thanks
Srini

Error report:
>>> 
Traceback (most recent call last):
  File "C:\Python24\blast_parser.py", line 8, in ?
    b_record = b_iterator.next()
  File
"C:\Python24\Lib\site-packages\Bio\Blast\NCBIStandalone.py",
line 1553, in next
    return self._parser.parse(File.StringHandle(data))
  File
"C:\Python24\Lib\site-packages\Bio\Blast\NCBIStandalone.py",
line 746, in parse
    self._scanner.feed(handle, self._consumer)
  File
"C:\Python24\Lib\site-packages\Bio\Blast\NCBIStandalone.py",
line 99, in feed
    self._scan_rounds(uhandle, consumer)
  File
"C:\Python24\Lib\site-packages\Bio\Blast\NCBIStandalone.py",
line 229, in _scan_rounds
    self._scan_alignments(uhandle, consumer)
  File
"C:\Python24\Lib\site-packages\Bio\Blast\NCBIStandalone.py",
line 363, in _scan_alignments
    self._scan_pairwise_alignments(uhandle, consumer)
  File
"C:\Python24\Lib\site-packages\Bio\Blast\NCBIStandalone.py",
line 373, in _scan_pairwise_alignments
    self._scan_one_pairwise_alignment(uhandle,
consumer)
  File
"C:\Python24\Lib\site-packages\Bio\Blast\NCBIStandalone.py",
line 385, in _scan_one_pairwise_alignment
    self._scan_hsp(uhandle, consumer)
  File
"C:\Python24\Lib\site-packages\Bio\Blast\NCBIStandalone.py",
line 420, in _scan_hsp
    self._scan_hsp_alignment(uhandle, consumer)
  File
"C:\Python24\Lib\site-packages\Bio\Blast\NCBIStandalone.py",
line 454, in _scan_hsp_alignment
    read_and_call_while(uhandle, consumer.noevent,
blank=1)
  File
"C:\Python24\Lib\site-packages\Bio\ParserSupport.py",
line 314, in read_and_call_while
    line = safe_readline(uhandle)
  File
"C:\Python24\Lib\site-packages\Bio\ParserSupport.py",
line 411, in safe_readline
    raise SyntaxError, "Unexpected end of stream."
SyntaxError: Unexpected end of stream.


 
_____________________________________________________________________________
_______
Be a better sports nut!  Let your teams follow you 
with Yahoo Mobile. Try it now.
http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
_______________________________________________
BioPython mailing list  -  BioPython at lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/biopython





More information about the Biopython mailing list