[BioPython] Help for BLAST

Jeffrey Chang jeffrey_chang at stanfordalumni.org
Tue Jul 27 11:13:00 EDT 2004


Hi Sameet,

There are two things going on here.  First, the output from qblast is 
slightly different from the standard blast output.  Therefore, I have 
updated the parser to handle the new output.  Second, please use the 
Text format out, as the HTML is much messier and harder to parse.  So 
in your qblast call, you need to add format_type="Text" and change the 
NCBIWWW.BlastParser to NCBIStandalone.BlastParser, making sure to 
import the NCBIStandalone module before you use it.

Jeff


On Jul 27, 2004, at 12:56 AM, Sameet Mehta wrote:

> Hi,
> I want to do a NCBIWWW BLAST, from a set of files that i havve.  The
> sequences are in FASTA format.  The Blast Runs perfectly, however, i 
> have
> problems parsing the output.  I am doing the following :
>
>>>> from Bio import Fasta
>>>> from Bio.Blast import NCBIWWW
>>>> file_to_blast = open('C:\Sameet\Data\H9.txt', 'r')
>>>> f_iterator = Fasta.Iterator(file_to_blast)
>>>> f_record = f_iterator.next()
>>>> b_result = NCBIWWW.qblast('blastn', 'nr', f_record, descriptions=20,
> alignments=20)
>>>> b_parser = NCBIWWW.BlastParser()
>>>> b_record = b_parser.parse(b_result)
>
> I am getting the follwing error
> Traceback (most recent call last):
>   File "<pyshell#8>", line 1, in -toplevel-
>     b_record = b_parser.parse(b_result)
>   File "C:\Python23\lib\site-packages\Bio\Blast\NCBIWWW.py", line 47, 
> in
> parse
>     self._scanner.feed(handle, self._consumer)
>   File "C:\Python23\lib\site-packages\Bio\Blast\NCBIWWW.py", line 101, 
> in
> feed
>     self._scan_rounds(uhandle, consumer)
>   File "C:\Python23\lib\site-packages\Bio\Blast\NCBIWWW.py", line 244, 
> in
> _scan_rounds
>     self._scan_alignments(uhandle, consumer)
>   File "C:\Python23\lib\site-packages\Bio\Blast\NCBIWWW.py", line 327, 
> in
> _scan_alignments
>     self._scan_pairwise_alignments(uhandle, consumer)
>   File "C:\Python23\lib\site-packages\Bio\Blast\NCBIWWW.py", line 350, 
> in
> _scan_pairwise_alignments
>     self._scan_one_pairwise_alignment(uhandle, consumer)
>   File "C:\Python23\lib\site-packages\Bio\Blast\NCBIWWW.py", line 381, 
> in
> _scan_one_pairwise_alignment
>     self._scan_alignment_header(uhandle, consumer)
>   File "C:\Python23\lib\site-packages\Bio\Blast\NCBIWWW.py", line 419, 
> in
> _scan_alignment_header
>     raise SyntaxError, "I missed the Length in an alignment header"
> SyntaxError: I missed the Length in an alignment header
>
> Am i missing something or doing something wrong.  I need this 
> information
> urgently.
>
> Regards
> sameet
>
> --
> National Centre for Cell Science, Pune
>
> _______________________________________________
> BioPython mailing list  -  BioPython at biopython.org
> http://biopython.org/mailman/listinfo/biopython



More information about the BioPython mailing list