[BioPython] Blast parser missing first record
Jeffrey Chang
jeffrey_chang at stanfordalumni.org
Fri Jul 16 23:33:04 EDT 2004
On Jul 16, 2004, at 9:34 PM, Bzy Bee wrote:
> Hi everyone
>
> My program that uses NCBI standalone blast parser
> works just fine, well almost!
>
> The only problem is that it misses first record (i.e.
> all the details and hits of first query sequence) and
> starts from the second query. Has anyone come across
> this one before? Below is a sample code:
>
> ------------------------------------
> from Bio.Blast import NCBIStandalone
> import sys,os,string
>
>
> in_file = 'myblast.txt'
>
> def testp(blast_res):
> bf = open(blast_res)
> parser = NCBIStandalone.BlastParser()
> iter = NCBIStandalone.Iterator(bf, parser)
> myrec = parser.parse(bf)
Get rid of this line. You're parsing the results from the first query
sequence...
> while 1:
> myrec = iter.next()
> if myrec is None:
> break
... and then immediately discarding it by assigning the second record
to the same variable.
Jeff
More information about the BioPython
mailing list