Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Alexey Morozov <alexeymorozov1991 <at> gmail.com>
Subject: Re: Why reading from generic object?
Newsgroups: gmane.comp.lang.perl.bio.general
Date: Thursday 25th July 2013 05:35:41 UTC (over 3 years ago)
Thanks. It's a shame to miss such mistakes.


2013/7/25 longbow leo 

> Hi Alexey,
>
>
> In the row:
>
> my $seq=Bio::SeqIO->next_seq;
>
> Here an object would be used, rather than the class.
>
> The correct statement would be:
>
> my $seq = $seqio->next_seq;
>
>
>
> All the best,
>
> Haizhou
>
>
> On Thu, Jul 25, 2013 at 1:24 PM, Alexey Morozov <
> [email protected]> wrote:
>
>> 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 (@ARGV)
>>     {
>>     my $format=( $file~~m/.*\.gb$/ ?'genbank':'fasta');
>>     my $seqio=Bio::SeqIO->new(-file=>"<$file", -format=>"$format");
>>     my $seq=Bio::SeqIO->next_seq;
>>     $out->write_seq($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/Root.pm:472
>> STACK: Bio::SeqIO::next_seq /usr/share/perl5/Bio/SeqIO.pm:506
>> STACK: join_fa:13
>> -----------------------------------------------------------
>>
>> Can someone please explain me where I messed up?
>>
>>
>> --
>> Alexey Morozov,
>> LIN SB RAS, bioinformatics group.
>> Irkutsk, Russia.
>> _______________________________________________
>> Bioperl-l mailing list
>> [email protected]
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>
>


-- 
Alexey Morozov,
LIN SB RAS, bioinformatics group.
Irkutsk, Russia.
 
CD: 3ms