[BioPython] Bio.SeqIO and files with one record

Chris Fields cjfields at uiuc.edu
Wed Jul 11 11:58:50 UTC 2007


On Jul 11, 2007, at 5:32 AM, Martin MOKREJŠ wrote:

> ...
> Once people learn to wrap the iterator in a loop it is not  
> necessary, but I think
> if you have the time to do this ... ;-)
> Martin

Wrapping the iterator in a while loop works for bioperl as it only  
works when the expression evals to true (and assigning undef evals as  
false).  It's a common bioperl idiom to do something like:

my $seqio = Bio::SeaIO->new(-format => 'genbank',
                             -file => 'myfile.gb');

while (my $seq = $seqio->next_seq) {
     # do stuff here ....
}

chris




More information about the Biopython mailing list