[BioRuby] Error reading GenBank file

Toshiaki Katayama ktym at hgc.jp
Wed Dec 7 06:27:34 EST 2005


On 2005/12/07, at 19:03, Pjotr Prins wrote:

> On Wed, Dec 07, 2005 at 06:55:16PM +0900, Toshiaki Katayama wrote:
>> What is the best interface for the empty or incomplete entry?
>> raise an exception? or just returns empty string?
>>
>>   irb> gb = Bio::GenBank.new('')
>>   irb> p gb.naseq
>>   NoMethodError: undefined method `[]=' for nil:NilClass
>
> Why not return a nil? Or raise an exception at initialization if
> illegal tags are not allowed.
>
> Pj.

I just commited a patch to make the following code will work
without errors even if the input file contains an empty entry
(e.g. file attached in Urban's post).

Toshiaki

Bio::FlatFile.auto(ARGF) do |ff|
  ff.each_entry do |gb|
    # genbank/genbank.rb
    p gb.entry_id
    p gb.length
    p gb.strand
    p gb.natype
    p gb.circular
    p gb.division
    p gb.date
    p gb.basecount

    # genbank/common.rb
    p gb.definition
    p gb.versions
    p gb.accessions
    p gb.acc_version
    p gb.accession
    p gb.version
    p gb.gi
    p gb.nid
    p gb.keywords
    p gb.segment
    p gb.source
    p gb.common_name
    p gb.organism
    p gb.taxonomy
    p gb.references
    p gb.comment
    p gb.features
    p gb.origin
    p gb.naseq
  end
end




More information about the BioRuby mailing list