Class: Chem::KEGG::KeggGlycanParser

Inherits:
Object
  • Object
show all
Includes:
KeggFormat, Enumerable
Defined in:
lib/chem/db/kegg.rb

Overview

Parses KEGG Glycan format www.genome.jp/ligand/kcam/kcam/kcf.html Not fully implemented

Instance Method Summary collapse

Methods included from KeggFormat

#compound_folder=, #each_entry

Constructor Details

#initialize(filename) ⇒ KeggGlycanParser

Returns a new instance of KeggGlycanParser.



438
439
440
# File 'lib/chem/db/kegg.rb', line 438

def initialize filename
  @input = open(filename)
end

Instance Method Details

#eachObject



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/chem/db/kegg.rb', line 442

def each
  glycan = nil
  each_entry do |str, state|
    case state
    when "ENTRY"
      glycan = KeggGlycan.new
#            glycan = Compound.find(:first, :conditions => ["glycan_entry = ?", str.split[0]])
      if glycan == nil
#              glycan = Compound.new
        glycan.entry = str.split[0]
      end
    when "NAME"
      if glycan.name
        glycan.name = glycan.name + str.split("\n").join if str
      else
        glycan.name = str.split("\n").join if str
      end
    when "///"
      #          glycan.save
    end
  end
end