[BioRuby] GFF3 attribute parser problems

Ben Woodcroft donttrustben at gmail.com
Sat Jun 28 04:45:40 UTC 2008


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.



More information about the BioRuby mailing list