[BioPython] Blast parser error

Jeffrey Chang jeffrey_chang at stanfordalumni.org
Mon Mar 15 00:14:24 EST 2004


It is likely because the BLAST format has changed.  If you can send the 
BLAST output file that is causing the problem, I can take a look at it 
for you.  Otherwise, you will need to figure out which line is causing 
the problem and update the parser to deal with it properly.

Jeff



On Mar 14, 2004, at 7:47 PM, Maqbool, Nauman wrote:

> Hi
>
> I am new to biopython and am trying out the NCBI Standalone Blast
> parser. While trying the blast parsing methods from the cookbook
> (parsing standalone Blastn output) I got the following error message:
>
>>>> ================================ RESTART
> ================================
>>>>
>
> Traceback (most recent call last):
>   File "C:/Python/NM Python work/SV/sing_blst_SVparse.py", line 26, in
> -toplevel-
>     testparser(in_file)
>   File "C:/Python/NM Python work/SV/sing_blst_SVparse.py", line 11, in
> testparser
>     b_record = b_iterator.next()
>   File "C:\Python23\Lib\site-packages\Bio\Blast\NCBIStandalone.py", 
> line
> 1332, in next
>     return self._parser.parse(File.StringHandle(data))
>   File "C:\Python23\Lib\site-packages\Bio\Blast\NCBIStandalone.py", 
> line
> 557, in parse
>     self._scanner.feed(handle, self._consumer)
>   File "C:\Python23\Lib\site-packages\Bio\Blast\NCBIStandalone.py", 
> line
> 97, in feed
>     self._scan_rounds(uhandle, consumer)
>   File "C:\Python23\Lib\site-packages\Bio\Blast\NCBIStandalone.py", 
> line
> 153, in _scan_rounds
>     self._scan_alignments(uhandle, consumer)
>   File "C:\Python23\Lib\site-packages\Bio\Blast\NCBIStandalone.py", 
> line
> 287, in _scan_alignments
>     self._scan_pairwise_alignments(uhandle, consumer)
>   File "C:\Python23\Lib\site-packages\Bio\Blast\NCBIStandalone.py", 
> line
> 297, in _scan_pairwise_alignments
>     self._scan_one_pairwise_alignment(uhandle, consumer)
>   File "C:\Python23\Lib\site-packages\Bio\Blast\NCBIStandalone.py", 
> line
> 309, in _scan_one_pairwise_alignment
>     self._scan_hsp(uhandle, consumer)
>   File "C:\Python23\Lib\site-packages\Bio\Blast\NCBIStandalone.py", 
> line
> 337, in _scan_hsp
>     self._scan_hsp_alignment(uhandle, consumer)
>   File "C:\Python23\Lib\site-packages\Bio\Blast\NCBIStandalone.py", 
> line
> 368, in _scan_hsp_alignment
>     read_and_call(uhandle, consumer.query, start='Query')
>   File "C:\Python23\Lib\site-packages\Bio\ParserSupport.py", line 300,
> in read_and_call
>     raise SyntaxError, errmsg
> SyntaxError: Line does not start with 'Query':
> ncbiClient.20040311_1242_9391.log
>
>>>>
>
> The version of Blast we are running is: 2.2.6 [Apr-09-2003]. I found a
> similar blast parser error in the biopython archives but that was
> referring to the output format change in blastx. I don't think that the
> Blastn output has changed in the recent past, so it might be due to
> something that I might be missing in my script, here is the script that
> I am running:
>
>
> from Bio.Blast import NCBIStandalone
>
> in_file = 'test.blast'
>
> def testparser(blastfile):
>     blast_out = open(blastfile, "r")
>     b_parser = NCBIStandalone.BlastParser()
>     b_iterator = NCBIStandalone.Iterator(blast_out, b_parser)
>
>     while 1:
>         b_record = b_iterator.next()
>
>         if b_record is None:
>             break
>
>         E_VALUE_THRESH = 0.05
>         for alignment in b_record.alignments:
>             for hsp in alignments.hsp:
>                 if hsp.expect < E_VALUE_THRESH:
>                     print '*****Alignmnent*****'
>                     print 'sequence:', alignment.title
>                     print 'length:', alignment.length
>                     print 'e value:', hsp.expect
>
> # Main
> testparser(in_file)
>
>
> Any help will be highly appreciated.
>
> Regards
>
> Nauman
>
> ********************************************
> Nauman J Maqbool PhD
> Bioinformatics Group
> AgResearch Invermay
> Private Bag 50034
> Puddle Alley
> Mosgiel
> New Zealand
> email: nauman.maqbool at agresearch.co.nz
> Tel: +64-3-489 9031
> Fax: +64-3-489 3739
> ********************************************
>
> =======================================================================
> Attention: The information contained in this message and/or attachments
> from AgResearch Limited is intended only for the persons or entities
> to which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipients is prohibited by AgResearch
> Limited. If you have received this message in error, please notify the
> sender immediately.
> =======================================================================
>
> _______________________________________________
> BioPython mailing list  -  BioPython at biopython.org
> http://biopython.org/mailman/listinfo/biopython



More information about the BioPython mailing list