Class: ChemScanner::ChemDraw::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/chem_scanner/chem_draw/parser.rb

Direct Known Subclasses

ChemScanner::Cdx, ChemScanner::Cdxml

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParser

Returns a new instance of Parser.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/chem_scanner/chem_draw/parser.rb', line 25

def initialize
  # Start a new tempid to avoid duplicate with existed id
  @tempid = 10_000_000

  # Value from ChemDraw file, no OBMol yet
  @fragment_map = ElementMap.new
  @fragment_group_map = ElementMap.new

  @geometry_map = ElementMap.new
  @graphic_map = ElementMap.new

  @text_map = ElementMap.new
  @bracket_map = ElementMap.new

  # Real output
  @reactions = []
  @molecules = []

  # parser type (cdx, cdxml)
  @type = ""
end

Instance Attribute Details

#bracket_mapObject (readonly)

Returns the value of attribute bracket_map.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def bracket_map
  @bracket_map
end

#color_tableObject (readonly)

Returns the value of attribute color_table.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def color_table
  @color_table
end

#font_tableObject (readonly)

Returns the value of attribute font_table.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def font_table
  @font_table
end

#fragment_group_mapObject (readonly)

Returns the value of attribute fragment_group_map.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def fragment_group_map
  @fragment_group_map
end

#fragment_mapObject (readonly)

Returns the value of attribute fragment_map.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def fragment_map
  @fragment_map
end

#geometry_mapObject (readonly)

Returns the value of attribute geometry_map.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def geometry_map
  @geometry_map
end

#graphic_mapObject (readonly)

Returns the value of attribute graphic_map.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def graphic_map
  @graphic_map
end

#moleculesObject (readonly)

Returns the value of attribute molecules.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def molecules
  @molecules
end

#reactionsObject (readonly)

Returns the value of attribute reactions.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def reactions
  @reactions
end

#readerObject (readonly)

Returns the value of attribute reader.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def reader
  @reader
end

#tempidObject (readonly)

Returns the value of attribute tempid.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def tempid
  @tempid
end

#text_mapObject (readonly)

Returns the value of attribute text_map.



20
21
22
# File 'lib/chem_scanner/chem_draw/parser.rb', line 20

def text_map
  @text_map
end

Instance Method Details

#fragment_as_lineObject



58
59
60
# File 'lib/chem_scanner/chem_draw/parser.rb', line 58

def fragment_as_line
  @scheme&.fragment_as_line
end

#get_tempidObject



49
50
51
52
# File 'lib/chem_scanner/chem_draw/parser.rb', line 49

def get_tempid
  @tempid += 1
  @tempid - 1
end

#n_atomsObject



54
55
56
# File 'lib/chem_scanner/chem_draw/parser.rb', line 54

def n_atoms
  @scheme&.n_atoms
end

#readObject



47
# File 'lib/chem_scanner/chem_draw/parser.rb', line 47

def read; end