[BioRuby] Error reading GenBank file

Toshiaki Katayama ktym at hgc.jp
Wed Dec 7 04:13:41 EST 2005


Hi,

Your file contains extra "\n" after the GenBank delimiter //.
If you strip the last empty line from the input file, this bug won't occur.

And the following code also works.

  require 'bio'
  gb = Bio::GenBank.new(ARGF.read)
  p gb.naseq.class

So, it is a problem with Bio::FlatFile module.
I'll talk with Goto-san, the maintainer, on this.

Thanks,
Toshiaki

On 2005/12/07, at 17:39, Urban Hafner wrote:

> On 7 Dec 2005, at 04:37, Toshiaki Katayama wrote:
>
> I could not reproduce this error with this entry.
>
> Strange.
>
> I suspect that your input file is not in GenBank format but, for example,
> saved in HTML or something?
>
> OK. Here's the code again:
>
> require 'bio'
> fn = 'AJ271885.gb'
> ff = Bio::FlatFile.auto(fn)
> ff.each_entry do |gb|
>   p gb.naseq.class
> end
>
> And that's what I get:
>
> Bio::Sequence::NA
> NoMethodError: undefined method `[]=' for nil:NilClass
>         from /opt/local/lib/ruby/site_ruby/1.8/bio/db.rb:223:in `tag_cut'
>         from
> /opt/local/lib/ruby/site_ruby/1.8/bio/db/genbank/common.rb:239:in
> `origin'
>         from
> /opt/local/lib/ruby/site_ruby/1.8/bio/db/genbank/genbank.rb:72:in
> `naseq'
>         from (irb):10
>         from (irb):9:in `each_entry'
>         from (irb):9
>
> To download the file I used the 'Save to file' drop down on the site.
> (http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?db=nucleotide&val=11342587).
> Just to make sure, here's the file I used:
> http://bettong.net/mail/AJ271885.gb.gz
>
> Thanks again for the help. I very much appreciate it.
>
> Urban
>
> _______________________________________________
> BioRuby mailing list
> BioRuby at open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioruby



More information about the BioRuby mailing list