[Bioperl-l] Seq objects from string

Jason Stajich jason@cgt.mc.duke.edu
Fri, 18 Oct 2002 09:41:29 -0400 (EDT)


Directly from the FAQ


   Q2.4: How can I use SeqIO to parse sequence data from a string?

      A:
           use IO::String;
           use Bio::SeqIO;
           my $stringfh = new IO::String($string);

           my $seqio = new Bio::SeqIO(-fh => $stringfh,
                                      -format => 'fasta');
           while( my $seq = $seqio->next_seq ) { # process each seq
           }


On Fri, 18 Oct 2002, Mick Watson wrote:

> Hi
>
> I realise I'm at risk of being "flamed" here for asking a question thats
> been answered before, but can anyone give me a quick pointer on how to
> use SeqIO with my sequences (formatted as Fasta) as a string held in a
> variable, $sequence.
>
> I know i can use Bio::Seq->new('-seq'=>'$sequence' .... etc but I have
> many sequences in a single string and I quite like the idea that SeqIO
> might parse it for me.
>
> Thanks
> Mick
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>

-- 
Jason Stajich
Duke University
jason at cgt.mc.duke.edu