[Bioperl-l] possible bug in Bio::SeqIO::fastq

Albert Vilella avilella at gmail.com
Tue Oct 12 12:34:14 UTC 2010


Hi,

I found what seems to me could be a bug in the fastq module, which is
that if the
last line of the raw_quality section is a single "0" character, a
"if($line)" isn't
returning it properly, because it should be "if(defined $line)" instead.

Find here a test case and the line in question:

----
use strict;
use Bio::SeqIO;

my $consio = Bio::SeqIO->new
  (-format => 'fastq',
   -fh => \*DATA);

my $onelineconsout = Bio::SeqIO->new
  (-format => 'fastq',
   -fh => \*STDOUT);

while (my $seq = $consio->next_seq) {
  next if ($seq->seq =~ /^n+$/);
  $seq->seq(uc($seq->seq));
  $onelineconsout->write_seq($seq);
}
$consio->close;
$onelineconsout->close;

__DATA__
@SRR031652.634472
agtgcgctgatctgtggcccgtattgcctcaacgcaagctcaatagcttgagtatattaa
a
+
01111111111111100111111--,,011111101111111110111111111111110
0
----

--- /homes/avilella/src/BioPerl-1.6.1/Bio/SeqIO/fastq.pm
2010-10-12 13:26:06.491743000 +0100
+++ /homes/avilella/src/BioPerl-1.6.1/Bio/SeqIO/fastq.pm~
2010-10-12 13:07:27.462833000 +0100
@@ -80,7 +80,7 @@
                 last FASTQ
             }
             chomp $line;
-            if (!defined($line)) {
+            if (!$line) {
                 delete $self->{lastline};
                 last FASTQ;
             }



More information about the Bioperl-l mailing list