Class: Chem::PdbDic::PdbDicAtom
Constant Summary
Constants included from Atom
Instance Attribute Summary collapse
-
#atom_id ⇒ Object
readonly
Returns the value of attribute atom_id.
-
#neighbor ⇒ Object
readonly
Returns the value of attribute neighbor.
Attributes included from Atom
#cdk_atom, #charge, #color, #element, #label, #mass, #ob_atom, #rings, #v_pos, #visible, #x, #y, #z
Instance Method Summary collapse
-
#initialize(atom_id) ⇒ PdbDicAtom
constructor
A new instance of PdbDicAtom.
- #set_element ⇒ Object
Methods included from Atom
#atomic_number, #electro_negativity, #method_missing, #natural_bond_order, #to_mdl, #to_sybyl, #weight
Methods included from Transform::ThreeDimension
Methods included from Transform::TwoDimension
Constructor Details
#initialize(atom_id) ⇒ PdbDicAtom
Returns a new instance of PdbDicAtom.
7 8 9 10 11 12 |
# File 'lib/chem/db/pdb_dic.rb', line 7 def initialize atom_id @bonds = [] @neighbor = [] @atom_id = atom_id set_element end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Chem::Atom
Instance Attribute Details
#atom_id ⇒ Object (readonly)
Returns the value of attribute atom_id.
6 7 8 |
# File 'lib/chem/db/pdb_dic.rb', line 6 def atom_id @atom_id end |
#neighbor ⇒ Object (readonly)
Returns the value of attribute neighbor.
6 7 8 |
# File 'lib/chem/db/pdb_dic.rb', line 6 def neighbor @neighbor end |
Instance Method Details
#set_element ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/chem/db/pdb_dic.rb', line 13 def set_element # Heuristically set element. Any idea? case @atom_id.gsub(/(\d|[*'\"])/, '').upcase when /S/ @element = 'S' when 'B' @elmenet = 'B' when /^BR/ @element = 'Br' when /^MO/ @element = 'MO' when /^W/ @element = 'W' when /^I/ @element = 'I' when /CL/ @element = 'Cl' when /^A?B?C/ @element = 'C' when /^A?B?H/ @element = 'H' when /^A?N/ @element = 'N' when /^A?O/ @element = 'O' when /^A?P/ @element = 'P' when /^F/ @element = 'F' else puts @atom_id end end |