[BioRuby] Error reading ABIF SangerChromatogram data
Naohisa GOTO
ngoto at gen-info.osaka-u.ac.jp
Fri Jun 8 13:28:51 UTC 2012
Hi Bryan,
It may be possible that default file open mode on Windows is ASCII
and the line feed code conversion from CR+LF to LF brakes read data.
Please try the following workaround code:
require 'bio'
f = File.open("120605M4_05H_9.ab1", "rb")
chromatogram_ff = Bio::Abif.open(f)
chromatogram = chromatogram_ff.next_entry
This will be fixed in the next version: default file open mode
of Bio::FlatFile is changed to binary.
Naohisa Goto
ngoto at gen-info.osaka-u.ac.jp / ng at bioruby.org
On Thu, 7 Jun 2012 14:24:36 -0500
Bryan Sibert <sibert at wisc.edu> wrote:
> Hello,
>
> I am using BioRuby 1.4.2 on Ruby 1.9.3 installed on a 64-bit Windows Vista
> machine. I am trying to read some .ab1 files using the BioRuby ABIF class
> which inherits SangerChromatogram. Ruby raises a NoMethodError when I
> attempt this. Below is a simple program based up on the example usage
> provided in the documentation:
>
> require 'bio'
> chromatogram_ff = Bio::Abif.open("120605M4_05H_9.ab1")
> chromatogram = chromatogram_ff.next_entry
>
> This raises the following error:
>
> C:\...\Desktop>test
>
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/bio-1.4.2/lib/bio/db/sanger_chromatogram/abif.rb:107:in
> `get_entry_data': undefined method `match' for nil:NilClass (NoMethodError)
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/bio-1.4.2/lib/bio/db/sanger_chromatogram/abif.rb:85:in
> `block in get_directory_entries'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/bio-1.4.2/lib/bio/db/sanger_chromatogram/abif.rb:77:in
> `times'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/bio-1.4.2/lib/bio/db/sanger_chromatogram/abif.rb:77:in
> `get_directory_entries'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/bio-1.4.2/lib/bio/db/sanger_chromatogram/abif.rb:42:in
> `initialize'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/bio-1.4.2/lib/bio/io/flatfile/splitter.rb:55:in
> `new'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/bio-1.4.2/lib/bio/io/flatfile/splitter.rb:55:in
> `get_parsed_entry'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/bio-1.4.2/lib/bio/io/flatfile.rb:288:in
> `next_entry'
> from C:/.../Desktop/test.rb:3:in `<main>'
>
>
> I am at a loss as to how to fix this. If you have any ideas, please let me
> know.
>
> Thanks,
>
> Bryan
> _______________________________________________
> BioRuby Project - http://www.bioruby.org/
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby
More information about the BioRuby
mailing list