[BioRuby] GFF3 attribute parser problems
Ben Woodcroft
donttrustben at gmail.com
Sun Jun 29 01:57:39 UTC 2008
I have attempted a fix, and pushed it to github. I forked the main
branch, not the testing one, because I class this as a bug fix, not a
new feature. Available at
http://github.com/wwood/bioruby/tree/master
I actually had to create a new class
Bio::GFF::GFF3::Record<Bio::GFF::Record because the parsing of the
attributes happens inside the record, not the parser. I'm not sure
this is the most sensible way, but I'm following the laziness virtue
for now.
I hope these kinds of commits get added to the main repo..
Thanks,
ben
2008/6/28 Ben Woodcroft <donttrustben at gmail.com>:
> not fixed as of most recent git commit, either
> http://github.com/bioruby/bioruby/tree/master/lib/bio/db/gff.rb
>
> line 120
>
> 2008/6/28 Ben Woodcroft <donttrustben at gmail.com>:
>> Hi,
>>
>> I noticed there is a problem with the Bio::GFF::GFF3 class. Using bioruby 1.2.1
>>
>> class GFF3 < GFF
>> VERSION = 3
>>
>> private
>>
>> def parse_attributes(attributes)
>> hash = Hash.new
>> attributes.split(/[^\\];/).each do |atr|
>> key, value = atr.split('=', 2)
>> hash[key] = value
>> end
>> return hash
>> end
>>
>> My problem is with the split([/^\\]) bit, because it chops off an
>> extra character at the end of the key:
>>
>> irb(main):001:0> 'abc=def;one=two'.split(/[^\\];/)
>> => ["abc=de", "one=two"]
>>
>> where we want
>> => ["abc=def", "one=two"]
>>
>>
>>
>> I took a shortcut to solve it and ignored the escaping of the ; and
>> just did this
>>
>> hash = Hash.new
>> attributes.split(/;/).each do |atr|
>> key, value = atr.split('=', 2)
>> hash[key] = value
>> end
>> return hash
>>
>>
>> Thanks,
>> ben
>>
>
>
>
> --
> FYI: My email addresses at unimelb, uq and gmail all redirect to the same place.
>
--
FYI: My email addresses at unimelb, uq and gmail all redirect to the same place.
More information about the BioRuby
mailing list