class EupathDBGFFRecord

Public Instance Methods

parse_attributes(attributes_string) click to toggle source

eg. ID=apidb|X95275;Name=X95275;description=Plasmodium+falciparum+complete+gene+map+of+plastid-like+DNA+%28IR-A%29.

# File lib/eupathdb_gff.rb, line 188
def parse_attributes(attributes_string)
  @attributes = Hash.new
  parts = attributes_string.split ';'
  if parts
    parts.each {|couple|
      cs = couple.split '='
      #deal with attributes like 'Note=;' by ignoring them
      # I once found one of these in the yeast genome gff
      next if cs.length == 1 and couple.match(/=/)
      if cs.length != 2
        raise Exception, "Badly handled attributes bit in api db gff: '#{cs}' from '#{attributes_string}'"
      end
      @attributes[cs[0]] = cs[1]
    }
  end
end