[BioPython] Problem with BLAST parser in NCBIStandalone

Chris Francis cjfrancis@hotmail.com
Thu, 09 May 2002 11:51:43 +1000


I'm having problems parsing output blast files using the 
NCBIStandalone.BlastParser.

>>>blast_results = open('TRblast.out','r')
>>>br = cStringIO.StringIO(blast_results.read())
>>>b_parser = NCBIStandalone.BlastParser()
>>>b_record = b_parser.parse(br)

This gives:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/site-packages/Bio/Blast/NCBIStandalone.py", line 
515, in parse
    self._scanner.feed(handle, self._consumer)
  File "/usr/lib/python2.2/site-packages/Bio/Blast/NCBIStandalone.py", line 
84, in feed
    self._scan_rounds(uhandle, consumer)
  File "/usr/lib/python2.2/site-packages/Bio/Blast/NCBIStandalone.py", line 
140, in _scan_rounds
    self._scan_alignments(uhandle, consumer)
  File "/usr/lib/python2.2/site-packages/Bio/Blast/NCBIStandalone.py", line 
261, in _scan_alignments
    self._scan_masterslave_alignment(uhandle, consumer)
  File "/usr/lib/python2.2/site-packages/Bio/Blast/NCBIStandalone.py", line 
364, in _scan_masterslave_alignment
    consumer.multalign(line)
  File "/usr/lib/python2.2/site-packages/Bio/Blast/NCBIStandalone.py", line 
769, in multalign
    name = string.rstrip(line[:self._name_length])
TypeError: sequence index must be integer

Alternatively, with using cStringIO I get:

>>>b_record = b_parser.parse(blast_results)

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/site-packages/Bio/Blast/NCBIStandalone.py", line 
515, in parse
    self._scanner.feed(handle, self._consumer)
  File "/usr/lib/python2.2/site-packages/Bio/Blast/NCBIStandalone.py", line 
81, in feed
    read_and_call_until(uhandle, consumer.noevent, contains='BLAST')
  File "/usr/lib/python2.2/site-packages/Bio/ParserSupport.py", line 366, in 
read_and_call_until
    line = safe_readline(uhandle)
  File "/usr/lib/python2.2/site-packages/Bio/ParserSupport.py", line 442, in 
safe_readline
    raise SyntaxError, "Unexpected end of stream."
SyntaxError: Unexpected end of stream.

My input blast file isn't formatted in HTML, is this an issue? I sincerely 
appreciate any assistance with this problem.

C.Francis






_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx