Class: Chem::MDL::MdlReaction

Inherits:
Object
  • Object
show all
Includes:
Chem::Molecule, Reaction, Enumerable
Defined in:
lib/chem/db/mdl.rb

Constant Summary

Constants included from Chem::Molecule

Chem::Molecule::EpsHeader, Chem::Molecule::MDLCountLineFormat

Instance Attribute Summary collapse

Attributes included from Chem::Molecule

#name, #source

Attributes included from Graph

#adjacencies

Instance Method Summary collapse

Methods included from Reaction

#to_mdl_rxn

Methods included from Chem::Molecule

#-, #assign_2d_geometry, #breadth_first_search, #canonical_ring, #composition, #connected?, #deep_dup, #delete, #delete_bond, #depth_first_search, #divide, #find_smallest_ring, #find_sssr, #induced_sub, #molecular_weight, #n_hydrogen, #oxidation_number, #save, #save_as_mdl, #save_as_pdf, #search_pubchem, #subset_in_composition?, #to_cansmi, #to_eps, #to_sybyl, #trim

Methods included from Graph

#adj_matrix, #adjacency_list, #adjacent_to, #clustering_coefficient, #connection, #each, #match_by_adj_mat, #match_by_ullmann, #match_exhaustively, #matchable, #matchable_old, #morgan

Constructor Details

#initializeMdlReaction

Returns a new instance of MdlReaction.



289
290
291
292
293
294
# File 'lib/chem/db/mdl.rb', line 289

def initialize
  @nodes = []
  @edges = []
  @reactants = []
  @products  = []
end

Instance Attribute Details

#edgesObject (readonly)

Returns the value of attribute edges.



287
288
289
# File 'lib/chem/db/mdl.rb', line 287

def edges
  @edges
end

#filenameObject (readonly)

Returns the value of attribute filename.



296
297
298
# File 'lib/chem/db/mdl.rb', line 296

def filename
  @filename
end

#nodesObject (readonly)

Returns the value of attribute nodes.



287
288
289
# File 'lib/chem/db/mdl.rb', line 287

def nodes
  @nodes
end

Instance Method Details

#open_rxn(filename) ⇒ Object



297
298
299
300
301
302
303
304
305
# File 'lib/chem/db/mdl.rb', line 297

def open_rxn(filename)
  @filename = filename
  input = File.open(filename)
  n_reactants, n_products = parse_header(input)
  read_mol(input, n_reactants, @reactants, @r_atoms = {})
  read_mol(input, n_products,  @products,  @p_atoms = {})
  construct
  self
end