Class: Chem::KEGG::KCFMolecule
- Inherits:
-
Object
- Object
- Chem::KEGG::KCFMolecule
- Includes:
- Molecule
- Defined in:
- lib/chem/db/kcf.rb
Constant Summary
Constants included from Molecule
Molecule::EpsHeader, Molecule::MDLCountLineFormat
Instance Attribute Summary collapse
-
#a_no ⇒ Object
Returns the value of attribute a_no.
Attributes included from Molecule
Attributes included from Graph
Class Method Summary collapse
Instance Method Summary collapse
Methods included from 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
Instance Attribute Details
#a_no ⇒ Object
Returns the value of attribute a_no.
345 346 347 |
# File 'lib/chem/db/kcf.rb', line 345 def a_no @a_no end |
Class Method Details
.open(file) ⇒ Object
362 363 364 365 |
# File 'lib/chem/db/kcf.rb', line 362 def KCFMolecule.open file input = File.open(file, 'r') KCFMolecule.new.read(input) end |
.write_kcf(molecule) ⇒ Object
347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/chem/db/kcf.rb', line 347 def KCFMolecule.write_kcf molecule n_atom = 1 molecule.atoms.each do |k, atom| puts atom.kcf n_atom += 1 end n_bond = 1 molecule.bonds.each do |bond| # 1 2 1 1 #UP kcf.number = 48 puts bond.kcf_line n_bond += 1 end end |
Instance Method Details
#read(input) ⇒ Object
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/chem/db/kcf.rb', line 367 def read input @entry = input.readline number_of_atom = input.readline.split[1].to_i 1.upto(number_of_atom) do |n| atom = KCFAtom.new atom.number, atom.kcf_type, atom.element, atom.x, atom.y, = input.readline.scanf("%d%s%s%f%f%s") @atoms[atom.number] = atom end number_of_bond = input.readline.split[1].to_i 1.upto(number_of_bond) do |n| bond = KCFBond.new no, b, e, bond.multiplicity, prop = input.readline.scanf("%d%d%d%d%s") bond.b = @atoms[b] bond.e = @atoms[e] @bonds.push(bond) end self end |