Class: Chem::KEGG::KCFMolecule

Inherits:
Object
  • Object
show all
Includes:
Molecule
Defined in:
lib/chem/db/kcf.rb

Constant Summary

Constants included from Molecule

Molecule::DESCRIPTORNAME, Molecule::ELEMNUM, Molecule::EpsHeader, Molecule::MDLCountLineFormat, Molecule::MDLHeaderLine2Format

Instance Attribute Summary collapse

Attributes included from Molecule

#cdk2atom, #cdk_mol, #name, #ob_mol, #source

Attributes included from Graph

#adjacencies, #edges, #nodes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Molecule

#-, #adjacent_index, #assign_2d_geometry, #bit_mat, #box_size, #breadth_first_search, #canonical_ring, #cdk_BCUT, #cdk_CPSA, #cdk_RotatableBondsCount, #cdk_calc_descriptor, #cdk_calc_descriptors, #cdk_find_all_rings, #cdk_fingerprint, #cdk_gasteiger_marsili_partial_charges, #cdk_generate_2D, #cdk_generate_randomly, #cdk_generate_vicinity, #cdk_hose_code, #cdk_hueckel, #cdk_mcs, #cdk_properties, #cdk_rule_of_file, #cdk_save_as, #cdk_setup, #cdk_sssr, #cdk_wiener_numbers, #cdk_xlogp, #composition, #connected?, #deep_dup, #delete, #delete_bond, #depth_first_search, #divide, #f_dfs, #find_smallest_ring, #find_sssr, #fingerprint, #generate_pubchem_subskey, #hilight, #induced_sub, #match, #match_by_ullmann, #method_missing, #molecular_weight, #n_hydrogen, #ob_export_as, #ob_save_as, #oxidation_number, #pubchem_subskeys, #remove_hydrogens!, #save, #save_as_mdl, #save_as_pdf, #subset_in_composition?, #to_cansmi, #to_eps, #to_inchi, #to_sybyl, #typ_str, #use_open_babel

Methods included from Graph

#adjacent_to, #clustering_coefficient, #each, #morgan, #terminal_nodes

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Chem::Molecule

Instance Attribute Details

#a_noObject

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