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.



472
473
474
# File 'lib/chem/db/kegg.rb', line 472

def initialize filename
  @input = open(filename)
end

Instance Method Details

#eachObject



476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
# File 'lib/chem/db/kegg.rb', line 476

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