<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks a lot Chris,<div class=""><br class=""><div class="">Your code example is much more instructive than the text I found on the IO man pages.</div><div class="">If someone has access to (<a href="http://bioperl.org/howtos/SeqIO_HOWTO.html" class="">http://bioperl.org/howtos/SeqIO_HOWTO.html</a>) and could edit some examples for saving to bgzip it would probably help others.</div><div class="">My code now works like a charm and I generate smaller compressed and tabix index-able bgzip Fasta instead of huge plain files.</div><div class=""><br class=""></div><div class="">THANKS to ALL who helped me</div><div class=""><br class=""></div><div class="">Stephane</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 31 May 2016, at 20:59, Fields, Christopher J <<a href="mailto:cjfields@illinois.edu" class="">cjfields@illinois.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">If you are using a piped command you should use a file handle as input, not a file.  Something like:<br class=""><br class="">open(my $fh,  "  | $bgzip -c >  $outfile\.gz”);<br class="">$seq_out = Bio::SeqIO->new( -format => 'Fasta', -fh => $fh);<br class=""><br class="">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.<br class=""><br class="">chris<br class=""><br class=""><blockquote type="cite" class="">On May 31, 2016, at 9:06 AM, Stephane Plaisance | VIB | <<a href="mailto:stephane.plaisance@vib.be" class="">stephane.plaisance@vib.be</a>> wrote:<br class=""><br class="">Dear,<br class="">I try to bgzip my fasta outpmut fbut have an issue<br class=""><br class=""><br class="">my $seq_out;<br class="">if ( defined($zipit) ) {<br class=""><span class="Apple-tab-span" style="white-space:pre">      </span>my $bgzip = `which bgzip`;<br class=""><span class="Apple-tab-span" style="white-space:pre">     </span>chomp($bgzip);<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>die "No bgzip command available\n" unless ( $bgzip );<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>$seq_out = Bio::SeqIO -> newFh( -format => 'Fasta', -file => "  | $bgzip -c >  $outfile\.gz");<br class="">} else {<br class=""><span class="Apple-tab-span" style="white-space:pre">    </span>$seq_out = Bio::SeqIO -> newFh( -format => 'Fasta', -file => ">$outfile" );<br class="">}<br class=""><br class="">the code fails although bgzip is in my path and the  $bgzip variable sets it right<br class="">Any help is very welcome<br class=""><br class="">Stephane<br class="">_______________________________________________<br class="">Bioperl-l mailing list<br class=""><a href="mailto:Bioperl-l@mailman.open-bio.org" class="">Bioperl-l@mailman.open-bio.org</a><br class="">http://mailman.open-bio.org/mailman/listinfo/bioperl-l<br class=""></blockquote><br class=""></div></blockquote></div><br class=""></div></div></body></html>