Class: Chem::PdbDic::PdbDicAtom

Inherits:
Atom
  • Object
show all
Defined in:
lib/chem/db/pdb_dic.rb

Constant Summary

Constants included from Atom

Atom::MDLAtomLineFormat

Instance Attribute Summary collapse

Attributes included from Atom

#cdk_atom, #charge, #color, #element, #label, #mass, #ob_atom, #rings, #v_pos, #visible, #x, #y, #z

Instance Method Summary collapse

Methods included from Atom

#atomic_number, #electro_negativity, #method_missing, #natural_bond_order, #to_mdl, #to_sybyl, #weight

Methods included from Transform::ThreeDimension

#z, #z=

Methods included from Transform::TwoDimension

#pos, #x, #x=, #y, #y=

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_idObject (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

#neighborObject (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_elementObject


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