[Bioperl-l] a PerlIO layer for Bio::SeqIO

Mark A. Jensen maj at fortinbras.us
Thu Oct 22 23:44:10 UTC 2009


This is definitely doable. I will investigate. There is at least one
PerlIO via layer for compression (bzip2); the cool thing about
layers is you should be able to do something like

 open($cfh, '>:via(SeqIO::embl):via(bzip2)', 'my.embl.bz2')

A quick test of passing an IO::Compress handle to via(SeqIO)
indicates I have more a little more work to do. (Gotta fill that
spare time,RS!)
cheers MAJ
----- Original Message ----- 
From: "Florent Angly" <florent.angly at gmail.com>
To: "Mark A. Jensen" <maj at fortinbras.us>
Cc: "Smithies, Russell" <Russell.Smithies at agresearch.co.nz>; "'BioPerl List'" 
<bioperl-l at bioperl.org>
Sent: Thursday, October 22, 2009 7:14 PM
Subject: Re: [Bioperl-l] a PerlIO layer for Bio::SeqIO


> Sounds cool Mark! After all, UNIX is based on the notion on piping data from 
> one program to another using filehandles.
> Any chance that this could also work for compressed files like *.gz ?? I don't 
> think that Bio::Root::Utilities::compress and uncompress can deal with 
> filehandles, can it?
> Florent
>
> Mark A. Jensen wrote:
>> Because it's fun! Also:
>>
>> use CGI;
>> use PerlIO::via::SeqIO;
>> use strict;
>> use warnings;
>> my $q = new CGI;
>> my ($seqfh, $dup);
>> open($seqfh, "<:via(SeqIO)", 'test.fas');
>> open(STDOUT, ">:via(SeqIO::fasta)");
>>
>> my $s = <$seqfh>;
>>
>> print (
>>    $q->start_html,
>>    "Copy the desired format from the boxes below:<br><br>",
>>    $q->div({-style=>"border:solid 1px black"},
>>     $q->h3("FASTA\n"),
>>     $q->pre($s))
>>    );
>> (tied *STDOUT)->set_write_format('embl');
>> print (
>>    $q->div({-style=>"border:solid 1px black"},
>>     $q->h3("EMBL"),
>>     $q->pre($s))
>>    );
>> (tied *STDOUT)->set_write_format('gcg');
>> print (
>>    $q->div({-style=>"border:solid 1px black"},
>>     $q->h3("GCG"),
>>     $q->pre($s)),
>>    $q->end_html
>>    );
>> 1;
>>
>> ----- Original Message ----- From: "Smithies, Russell" 
>> <Russell.Smithies at agresearch.co.nz>
>> To: "'Mark A. Jensen'" <maj at fortinbras.us>; "'BioPerl List'" 
>> <bioperl-l at bioperl.org>
>> Sent: Thursday, October 22, 2009 6:57 PM
>> Subject: RE: [Bioperl-l] a PerlIO layer for Bio::SeqIO
>>
>>
>> Why anyone would want to do it this way is the only thing that's bugging me 
>> ;-)
>> Maybe I'm a bit dense this morning but what's the advantage?
>>
>> --Russell
>> (I need more coffee)
>>
>>> -----Original Message-----
>>> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
>>> bounces at lists.open-bio.org] On Behalf Of Mark A. Jensen
>>> Sent: Friday, 23 October 2009 11:24 a.m.
>>> To: BioPerl List
>>> Subject: [Bioperl-l] a PerlIO layer for Bio::SeqIO
>>>
>>> Hi All:
>>>
>>> Have you ever wanted to do this?
>>>
>>>  open($f, "<:via(SeqIO)", "my.fas");
>>>  open($g, ">:via(SeqIO::embl)", "my.fas.embl");
>>>  while (<$f>) { print $g $_; }
>>>
>>> Or this?
>>>
>>>  open($f, "<:via(SeqIO)", "my.fas");
>>>  open(STDOUT, ">:via(SeqIO::fasta)");
>>>  $seq = <$f>;
>>>  print "The following is an example of FASTA format:", $seq;
>>>
>>> Or even this?
>>>
>>>  (tied *STDOUT)->set_write_format('gcg');
>>>  print "While this is an example of GCG:", $seq;
>>>
>>> Now you can, and much more. See
>>> http://search.cpan.org/search?query=PerlIO::via::SeqIO
>>>
>>> Send me the bugs.
>>> cheers,
>>> MAJ
>>>
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at lists.open-bio.org
>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>> =======================================================================
>> Attention: The information contained in this message and/or attachments
>> from AgResearch Limited is intended only for the persons or entities
>> to which it is addressed and may contain confidential and/or privileged
>> material. Any review, retransmission, dissemination or other use of, or
>> taking of any action in reliance upon, this information by persons or
>> entities other than the intended recipients is prohibited by AgResearch
>> Limited. If you have received this message in error, please notify the
>> sender immediately.
>> =======================================================================
>>
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>
>
> 




More information about the Bioperl-l mailing list