[BioPython] windows : reading local blast output

Srinivas Iyyer srini_iyyer_bio at yahoo.com
Mon Nov 19 17:34:53 EST 2007


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


More information about the BioPython mailing list