[Bioperl-l] Writing embl entry to string

Peter van Heusden pvh at egenetics.com
Tue Sep 21 09:23:34 EDT 2004


TAPO (Thomas Agersten Poulsen) wrote:

>Dear List,
>
>	I am writing a small script to split embl-files into smaller file of a given maximum file size. 
>
>To this end, I would like to get the output from Bio::SeqIO->write_seq into a string (so I can evaluate length() on it). Would anybody out there know if this is posible????
>
>  
>
There's an example describing how to do this in the SeqIO howto at 
http://bioperl.org/HOWTOs/SeqIO/string.html:

       use IO::String;
       use Bio::SeqIO;
       
       my $str;
       my $io = IO::String->new(\$str);
       my $seqOut = Bio::SeqIO->new(-format => 'swiss', 
                                    -fh     => $io );
       $seqOut->write_seq($seq_obj);
       print $str;

Peter


More information about the Bioperl-l mailing list