Alexey Morozov | 25 Jul 07:24 2013

Why reading from generic object?

I've made this primitive script for joining seqs that are stored in lots of
files (some of them in a genbank format) into a single fasta:

my $out=Bio::SeqIO->new(-fh=>\*STDOUT, -format=>'fasta');
foreach my $file ( <at> ARGV)
    my $format=( $file~~m/.*\.gb$/ ?'genbank':'fasta');
    my $seqio=Bio::SeqIO->new(-file=>"<$file", -format=>"$format");
    my $seq=Bio::SeqIO->next_seq;

It correctly tells a format, finds files and they're open for reading.
There seems to be literally no place for the error, yet it throws:

------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Sorry, you cannot read from a generic Bio::SeqIO object.
STACK: Error::throw
STACK: Bio::Root::Root::throw /usr/share/perl5/Bio/Root/
STACK: Bio::SeqIO::next_seq /usr/share/perl5/Bio/
STACK: join_fa:13

Can someone please explain me where I messed up?


Alexey Morozov,
LIN SB RAS, bioinformatics group.
Irkutsk, Russia.