[Bioperl-l] Re: SeqIO bug report

Kris Boulez krbou@pgsgent.be
Wed, 20 Dec 2000 10:59:06 +0100


Quoting Hilmar Lapp (hlapp@gmx.net):
> bioperl-bug-admin@bioperl.org wrote:
> > 
> > 
> > The following program (change the location of the test
> > genbank file)
> > 
> > -------------- program ------------------------
> > #!/usr/local/bin/perl -w
> > 
> > use strict;
> > use Bio::SeqIO;
> > 
> > my $genbank_file = "/home/kris/src/cvs/bioperl/bioperl-live/t/test.genbank";
> > my $seqin = Bio::SeqIO->new(-file => $genbank_file, -format => 'genbank');
> > my $seqout = Bio::SeqIO->new(-file => ">pir.out", -format => 'pir');
> >         while (my $seq = $seqin->next_seq() ) {
> >                 $seqout->write_seq($seq);
> >         }
> > print STDOUT "wrote pir file\n";
> > my $seqin = Bio::SeqIO->new(-file => "pir.out", -format => 'pir');
> 
> I suppose this is not the cause of the error you see but be aware that
> opening a stream on a file you haven't closed yet may give unexpected
> results. You should either first
> 
> 	$seqout = undef;
> 
> or (cleaner) call
> 
> 	$seqout->close();
> 
> With either of these in effect, does the error persist? (Probably it
> does.)
> 

Minutes after submitting the bug report I realized this myself (the
stress testing script I used to detect these, does it). When adding 

$seqout->close();
system ("cat pir.out");


I get

--------- output --------------------
wrote pir file
>P1;DDU63596
Dictyostelium discoideum Tdd-4 transposable element flanking sequence,
clone p427/428 right end.
>P1;DDU63596

GTGACAGTTG GCTGTCAGAC ATACAATGAT TGTTTAGAAG AGGAGAAGAT TGATCCGGAG 
TACCGTGATA GTATTTTAAA AACTATGAAA GCGGGAATAC TTAATGGTAA ACTAGTTAGA 
[ ... ]
TTACGGCGAG ATGGTTTCTC CTCGCCTGGC CACTCAGCCT TAGTTGTCTC TGTTGTCTTA 
TAGAGGTCTA CTTGAAGAAG GAAAAACAGG GGTCATGGTT TGACTGTCCT GTGAGCCCTT 
CTTCCCTGCC TCCCCCACTC ACAGTGACCC GGAATCTGCA GTGCTAGTCT CCCGGAACTA 
TC

-------------------- EXCEPTION --------------------
MSG: 
CONTEXT: Error in uNKNOWN CONTEXT
SCRIPT: seqtest_pir.pl
STACK: 
Bio::Root::RootI::new(87)
Bio::SeqIO::pir::next_seq(111)
main::seqtest_pir.pl(18)
---------------------------------------------------


------------ end of output ---------------------