[Biopython] help with NCBIXML.parse

ferreirafm at usp.br ferreirafm at usp.br
Wed Mar 28 14:59:52 UTC 2012


Citando Peter Cock <p.j.a.cock at googlemail.com>:

> Try using the -max_target_seqs argument.

I have already tried it.
I issued blast with -max_target_seq 1 on a muit-fasta file.  See  
resulats my last post.


>
> That is not allowed in XML. On re-reading your code, I see
> this happens because you are effectively concatenating the
> output for several BLAST runs (via stdout) into the one file.
>
> Historically the NCBI BLAST tools used to do something like
> this but with <?xml version="1.0"?> on a new line, so we do
> have some special case code to cope with that. You could
> try making this small change:
>
>  outf.write(stdout)
>
> to:
>
>  outf.write(stdout)
>  outf.write("\n")

Yep, it works.

>
> That might work. However that isn't an elegant solution
>  because if it works it relies on some special case code
> in Biopython for an NCBI bug.
>
> Instead you could parse each output inside the for loop?

That's a solution, but this way I would have to do it several times  
which would be even less pythonic

>
> Peter
>





More information about the Biopython mailing list