[BioPython] Syntax error while parsing Blast output

Peter biopython at maubp.freeserve.co.uk
Tue Oct 23 22:48:28 UTC 2007


David Garfield wrote:
> 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).

So it is.  Michiel - do you fancy tweaking that section of the tutorial?

> 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.

Biopython 1.43 switched the default from text to XML, because we really 
wanted to encourage people to use the XML output by default as 
maintaining the text format parser is such an ongoing maintainance 
effort.  The release notes did mention this, but it was bound to catch 
someone out.

There is an option to override this...

from Bio.Blast import NCBIStandalone
help(NCBIStandalone.blastall)

You need the align_view option (what the NCBI refers to as the alignment 
view), corresponding to the -m command line option of the NCBI blastall 
tool.  Biopython currently defaults to seven to get XML output.

alignment view options:
0 = pairwise,
1 = query-anchored showing identities,
2 = query-anchored no identities,
3 = flat query-anchored, show identities,
4 = flat query-anchored, no identities,
5 = query-anchored no identities and blunt ends,
6 = flat query-anchored, no identities and blunt ends,
7 = XML Blast output,
8 = tabular,
9 tabular with comment lines
10 ASN, text
11 ASN, binary [Integer]

Peter




More information about the Biopython mailing list