1.

How Can I Use Bio::seqio To Parse Sequence Data To Or From A String?

Answer»

Use this code to PARSE sequence records from a string:

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
}
And here is how to write to a string:
use IO::String;
use Bio::SeqIO;
my $s;
my $io = IO::String->new($s);
my $seqOut = new Bio::SeqIO(-format =>'swiss', -fh =>$io);
$seqOut->write_seq($seq1);
print $s; # $s contains the record in swissprot format and is stored in the string

Use this code to parse sequence records from a string:

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
}
And here is how to write to a string:
use IO::String;
use Bio::SeqIO;
my $s;
my $io = IO::String->new($s);
my $seqOut = new Bio::SeqIO(-format =>'swiss', -fh =>$io);
$seqOut->write_seq($seq1);
print $s; # $s contains the record in swissprot format and is stored in the string



Discussion

No Comment Found