[BioPython] Syntax error while parsing Blast output
David Garfield
dag23 at duke.edu
Tue Oct 23 21:59:33 UTC 2007
Thanks, Peter. You've found the problem exactly.
Interestingly, the code I presented was taken directly from the
BioPython cookbook (including the "while 1" bit).
Somewhere in the subsequent versions since that document was
released, the output of NCBIStandalone has changed from text to XML
and the NCBIStandalone Iterators and Parser either no longer seem to
work with the output of NCBIStandalone.blastall or there is an option
not mentioned in the Cookbook to ensure that the output is in text
rather than XML.
In any event, the problem is now fixed. Thanks!
--DG
On Oct 23, 2007, at 5:45 PM, Peter wrote:
> David Garfield wrote:
>> Hey list,
>> I'm having an issue with the BlastParser and Iterator from
>> NCBIStandalone. I assume its because NCBI has gone and changed
>> the output file (again)...or I'm an idiot....but maybe there's a
>> real problem here.
>
> The code you gave uses the NCBIStandalone parser/iterator, which
> expects plain text output - yet you say later the raw file looks
> like a perfectly good XML file. If you have an XML file (which we
> recommend over the plain text) then you should use the NCBIXML
> module instead.
>
> Also, a style point - I personally much prefer this:
>
> b_iterator = NCBIStandalone.Iterator(blast_results, b_parser)
> for b_record in b_iterator :
> #etc
>
> over this:
>
> b_iterator = NCBIStandalone.Iterator(blast_results, b_parser)
> while 1:
> b_record = b_iterator.next()
> if b_record is None: break
> #etc
>
> Peter
>
More information about the Biopython
mailing list