[BioRuby] fastacmd.rb: iteration
Toshiaki Katayama
k at bioruby.org
Sun Mar 26 00:46:18 UTC 2006
Goto-san,
# post testing for new open-bio.org server :)
I've suggested to release 1.0.1 (or create a stable branch?)
How do you think?
This bug causes Bio::FlatFile with ARGF to fail at the last iteration
and it may be fairly serious problem for many users.
By the way, Bio::FlatFile.auto and Bio::FlatFile.open accept a block but
Bio::FlatFile.new doesn't. Is there any reason to disallow the feature?
Toshiaki
--------------------------------------------------
% cat test_ff.rb
require 'bio'
ff = Bio::FlatFile.new(Bio::FastaFormat, ARGF)
ff.each do |e|
p e.definition
end
% cat test.fa
>b0002
atgcgagtgtt
>b0003
atggttaaagt
>b0004
atgaaactcta
% ruby test_ff.rb test.fa
"b0002"
"b0003"
"b0004"
/usr/local/lib/ruby/site_ruby/1.8/bio/io/flatfile.rb:118:in `pos': no stream to tell (ArgumentError)
from /usr/local/lib/ruby/site_ruby/1.8/bio/io/flatfile.rb:118:in `pos'
from /usr/local/lib/ruby/site_ruby/1.8/bio/io/flatfile.rb:342:in `get_entry'
from /usr/local/lib/ruby/site_ruby/1.8/bio/io/flatfile.rb:573:in `next_entry'
from /usr/local/lib/ruby/site_ruby/1.8/bio/io/flatfile.rb:609:in `each'
from test_ff.rb:4
--------------------------------------------------
On 2006/03/22, at 19:29, GOTO Naohisa wrote:
> Hi jan,
>
> I found a bug in the Bio::FlatFile. Because io/fastacmd.rb
> internally uses FlatFile, the bug may be related to the problem.
>
> The bug is that IO#pos raises error when the IO object isn't
> a regular file (e.g. pipe) but FlatFile always tried to get pos.
> It is fixed in the CVS now.
>
> On Tue, 21 Mar 2006 12:38:30 -0000
> "jan aerts \(RI\)" <jan.aerts at bbsrc.ac.uk> wrote:
>
>> Hi,
>>
>> Could someone please have a look at the each_entry method of
>> io/fastacmd.rb (in cvs)? The code below gives the sequences of
>> 'id_of_entry1' and 'id_of_entry2', but the each_entry method gives no
>> output. Any ideas?
>>
>> fastacmd = Bio::Blast::Fastacmd.new("/path_to_my_db/db_name")
>> seqs = fastacmd.fetch(['id_of_entry1','id_of_entry2'])
>> seqs.each do |seq|
>> puts seq => works fine
>> end
>>
>> fastacmd.each_entry do |fasta|
>> puts 'hi' => it never seems to get here...
>> end
>>
>> Thanks,
>> Jan Aerts, PhD
>> Bioinformatics Group
>> Roslin Institute
>> Roslin, Scotland, UK
>> +44 131 527 4200
>>
>> ---------The obligatory disclaimer--------
>> The information contained in this e-mail (including any attachments) is
>> confidential and is intended for the use of the addressee only. The
>> opinions expressed within this e-mail (including any attachments) are
>> the opinions of the sender and do not necessarily constitute those of
>> Roslin Institute (Edinburgh) ("the Institute") unless specifically
>> stated by a sender who is duly authorised to do so on behalf of the
>> Institute.
>
> --
> Naohisa GOTO
> ngoto at gen-info.osaka-u.ac.jp
> Department of Genome Informatics, Genome Information Research Center,
> Research Institute for Microbial Diseases, Osaka University, Japan
> _______________________________________________
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby
More information about the BioRuby
mailing list