[Bioperl-l] reading gz fastq File

59 views
Skip to first unread message

shalu sharma

unread,
Feb 25, 2019, 11:04:10 AM2/25/19
to biop...@mailman.open-bio.org
Hi Everyone,
    So i am trying to work on gzip fastq files. In past my script used to work fine. Now when i ran the same script it gives me an error.
I am just pasting few lines for example and an error message.
Would really appreciate your help.

use Bio::SeqIO;

use Bio::Seq::Quality;

$in = Bio::SeqIO->new(-file => "gunzip -c $ARGV[0]|", -format => 'fastq');           

while(my $seq = $in->next_seq){

      my $id = $seq->id;

      print "$id\n";

}


Error message:

MSG: Could not read file 'gunzip -c com.fastq.gz|': No such file or directory

STACK: Error::throw

STACK: Bio::Root::Root::throw /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/Root/Root.pm:447

STACK: Bio::Root::IO::_initialize_io /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/Root/IO.pm:268

STACK: Bio::SeqIO::_initialize /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/SeqIO.pm:513

STACK: Bio::SeqIO::fastq::_initialize /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/SeqIO/fastq.pm:30

STACK: Bio::SeqIO::new /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/SeqIO.pm:389

STACK: Bio::SeqIO::new /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/SeqIO.pm:435

STACK: testGZ.pl:5


Thanks

Shalu

Roy Chaudhuri

unread,
Feb 27, 2019, 8:13:59 AM2/27/19
to shalu sharma, biop...@mailman.open-bio.org
Hi Shalu,

Yes, I can replicate this error with bioperl 1.7.1, but 1.6.923 works as
expected. I think it's a bug since the docs suggest that it should work.

As a workaround you can use:

open my $fh, "gunzip -c $ARGV[0]|" or die $!;
my $in=Bio::SeqIO->new(-fh=>$fh, -format=>'fastq');

Cheers,
Roy.

On 25/02/2019 16:00, shalu sharma wrote:
> Hi Everyone,
>     So i am trying to work on gzip fastq files. In past my script used
> to work fine. Now when i ran the same script it gives me an error.
> I am just pasting few lines for example and an error message.
> Would really appreciate your help.
>
> use Bio::SeqIO;
>
> use Bio::Seq::Quality;
>
> $in = Bio::SeqIO->new(-file => "gunzip -c $ARGV[0]|", -format => 'fastq');
>
> while(my $seq = $in->next_seq){
>
> my $id = $seq->id;
>
> print "$id\n";
>
> }
>
>
> Error message:
>
> MSG: Could not read file 'gunzip -c com.fastq.gz|': No such file or
> directory
>
> STACK: Error::throw
>
> STACK: Bio::Root::Root::throw
> /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/Root/Root.pm:447
>
> STACK: Bio::Root::IO::_initialize_io
> /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/Root/IO.pm:268
>
> STACK: Bio::SeqIO::_initialize
> /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/SeqIO.pm:513
>
> STACK: Bio::SeqIO::fastq::_initialize
> /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/SeqIO/fastq.pm:30

> <http://fastq.pm:30>


>
> STACK: Bio::SeqIO::new
> /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/SeqIO.pm:389
>
> STACK: Bio::SeqIO::new
> /usr/local/apps/eb/BioPerl/1.7.1-foss-2016b-Perl-5.24.1/lib/perl5/site_perl/5.24.1/Bio/SeqIO.pm:435
>
> STACK: testGZ.pl:5
>
>
> Thanks
>
> Shalu
>
>

> _______________________________________________
> Bioperl-l mailing list
> Biop...@mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/bioperl-l
>
_______________________________________________
Bioperl-l mailing list
Biop...@mailman.open-bio.org
http://mailman.open-bio.org/mailman/listinfo/bioperl-l

Roy Chaudhuri

unread,
Feb 27, 2019, 8:27:41 AM2/27/19
to shalu sharma, biop...@mailman.open-bio.org
Correction - it's not a bug since the SeqIO documentation for 1.7.1 now
states "To read from or write to a piped command, open a filehandle and
use the -fh option.".

The relevant (closed) bug is here:
https://github.com/bioperl/bioperl-live/issues/117

Cheers,
Roy.

Reply all
Reply to author
Forward
0 new messages