Class Bio::PDB::ChemicalComponent
In: lib/bio/db/pdb/chemicalcomponent.rb
Parent: Object

Bio::PDB::ChemicalComponet is a parser for a entry of the PDB Chemical Component Dictionary.

The PDB Chemical Component Dictionary is available in deposit.pdb.org/het_dictionary.txt

Methods

conect   entry_id   formul   hetnam   hetsyn   new   record  

Classes and Modules

Class Bio::PDB::ChemicalComponent::Record

Constants

DELIMITER = RS = "\n\n"   delimiter for reading via Bio::FlatFile

Attributes

data  [R]  all records in this entry as an array.
hash  [R]  all records in this entry as an hash accessed by record names.

Public Class methods

Creates a new object.

[Source]

     # File lib/bio/db/pdb/chemicalcomponent.rb, line 123
123:       def initialize(str)
124:         @data = str.split(/[\r\n]+/)
125:         @hash = {}
126: 
127:         #Flag to say whether the current line is part of a continuation
128:         cont = false
129:         
130:         #Goes through each line and replace that line with a PDB::Record
131:         @data.collect! do |line|
132:           #Go to next if the previous line was contiunation able, and
133:           #add_continuation returns true. Line is added by add_continuation
134:           next if cont and cont = cont.add_continuation(line)
135: 
136:           #Make the new record
137:           f = Record.get_record_class(line).new.initialize_from_string(line)
138:           #p f
139:           #Set cont
140:           cont = f if f.continue?
141:           #Set the hash to point to this record either by adding to an
142:           #array, or on it's own
143:           key = f.record_name
144:           if a = @hash[key] then
145:             a << f
146:           else
147:             @hash[key] = [ f ]
148:           end
149:           f
150:         end #each
151:         #At the end we need to add the final model
152:         @data.compact!
153:       end

Public Instance methods

Returns an hash of bindings of atoms. Note that each white spaces are stripped for atom symbols.

[Source]

     # File lib/bio/db/pdb/chemicalcomponent.rb, line 192
192:       def conect
193:         unless defined? @conect
194:           c = {}
195:           @hash["CONECT"].each do |e|
196:             key = e.name.to_s.strip
197:             unless key.empty?
198:               val = e.other_atoms.collect { |x| x.strip }
199:               #warn "Warning: #{key}: atom name conflict?" if c[key]
200:               c[key] = val
201:             end
202:           end
203:           @conect = c
204:         end
205:         @conect
206:       end

Identifier written in the first line "RESIDUE" record. (e.g. CMP)

[Source]

     # File lib/bio/db/pdb/chemicalcomponent.rb, line 162
162:       def entry_id
163:         @data[0].hetID
164:       end

The chemical formula of the chemical component. Returns a string (or nil, if the entry is something wrong).

[Source]

     # File lib/bio/db/pdb/chemicalcomponent.rb, line 186
186:       def formul
187:         @hash["FORMUL"][0].text
188:       end

The name of the chemical component. Returns a string (or nil, if the entry is something wrong).

[Source]

     # File lib/bio/db/pdb/chemicalcomponent.rb, line 180
180:       def hetnam
181:         @hash["HETNAM"][0].text
182:       end

Synonyms for the comical component. Returns an array of strings.

[Source]

     # File lib/bio/db/pdb/chemicalcomponent.rb, line 167
167:       def hetsyn
168:         unless defined? @hetsyn
169:           if r = @hash["HETSYN"]
170:             @hetsyn = r[0].hetSynonyms.to_s.split(/\;\s*/)
171:           else
172:             return []
173:           end
174:         end
175:         @hetsyn
176:       end

Gets all records whose record type is name. Returns an array of Bio::PDB::Record::* objects.

if name is nil, returns hash storing all record data.

Example: p pdb.record(‘CONECT’) p pdb.record[‘CONECT’]

[Source]

     # File lib/bio/db/pdb/chemicalcomponent.rb, line 217
217:       def record(name = nil)
218:         name ? @hash[name] : @hash
219:       end

[Validate]