[Bioperl-l] issue writing to pipe with bio sequoia
Fields, Christopher J
cjfields at illinois.edu
Tue May 31 18:59:36 UTC 2016
If you are using a piped command you should use a file handle as input, not a file. Something like:
open(my $fh, " | $bgzip -c > $outfile\.gz”);
$seq_out = Bio::SeqIO->new( -format => 'Fasta', -fh => $fh);
The newFh() method is used for *returning* a tied filehandle for I/O; IMHO I don't recommend this, as it’s pretty confusing and hard to debug (I avoid most anything related to tied variables for the same reason unless it’s absolutely necessary). It is not used for dealing with a file handle input.
chris
> On May 31, 2016, at 9:06 AM, Stephane Plaisance | VIB | <stephane.plaisance at vib.be> wrote:
>
> Dear,
> I try to bgzip my fasta outpmut fbut have an issue
>
>
> my $seq_out;
> if ( defined($zipit) ) {
> my $bgzip = `which bgzip`;
> chomp($bgzip);
> die "No bgzip command available\n" unless ( $bgzip );
> $seq_out = Bio::SeqIO -> newFh( -format => 'Fasta', -file => " | $bgzip -c > $outfile\.gz");
> } else {
> $seq_out = Bio::SeqIO -> newFh( -format => 'Fasta', -file => ">$outfile" );
> }
>
> the code fails although bgzip is in my path and the $bgzip variable sets it right
> Any help is very welcome
>
> Stephane
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/bioperl-l
More information about the Bioperl-l
mailing list