[Bioperl-l] issue writing to pipe with bio sequoia

Roy Chaudhuri roy.chaudhuri at gmail.com
Tue May 31 15:39:36 UTC 2016


Hi Stephane,

Please remember to copy in the mailing list on replies. In my tests, a 
leading space doesn't make any difference to the issue - Bio::SeqIO 
still tries to read from the pipe rather than writing to it.

Mark - I have opened an issue on github:
https://github.com/bioperl/bioperl-live/issues/153

I think the issue is the regex in Bio::Root::IO->cleanfile not 
recognising a leading pipe character as indicating a "write" filehandle.

Cheers,
Roy.

On 31/05/2016 15:58, Stephane Plaisance | VIB | wrote:
> Thanks a lot Roy,
>
> I found that a leading space before the pipe and possibly the space directly after it were guilty, leading to the executable not found although fully provided with path ??? what works is
>>> -file => " |$bgzip -c >  $outfile\.gz")
>
> but you fh version is precious and I will record it for future use.
>
> Thanks!
> stephane
>
>> On 31 May 2016, at 16:45, Roy Chaudhuri <roy.chaudhuri at gmail.com> wrote:
>>
>> Hi Stephane,
>>
>> According to the SeqIO docs your way should work, so this is probably a bug. However, Bio::SeqIO can accept a filehandle instead using the -fh option, so as a workaround you could try something like this:
>>
>> open my $fh, '|$bgzip -c > $outfile.gz' or die $!;
>> $seq_out=Bio::SeqIO->newFh(-format=>'fasta', -fh=>$fh);
>>
>> Cheers,
>> Roy.
>>
>> On 31/05/2016 15:06, Stephane Plaisance | VIB | 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