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
delimiter for reading via Bio::FlatFile
Creates a new object.
# File lib/bio/db/pdb/chemicalcomponent.rb, line 124 def initialize(str) @data = str.split(/[\r\n]+/) @hash = {} #Flag to say whether the current line is part of a continuation cont = false #Goes through each line and replace that line with a PDB::Record @data.collect! do |line| #Go to next if the previous line was contiunation able, and #add_continuation returns true. Line is added by add_continuation next if cont and cont = cont.add_continuation(line) #Make the new record f = Record.get_record_class(line).new.initialize_from_string(line) #p f #Set cont cont = f if f.continue? #Set the hash to point to this record either by adding to an #array, or on it's own key = f.record_name if a = @hash[key] then a << f else @hash[key] = [ f ] end f end #each #At the end we need to add the final model @data.compact! end
Returns an hash of bindings of atoms. Note that each white spaces are stripped for atom symbols.
# File lib/bio/db/pdb/chemicalcomponent.rb, line 193 def conect unless defined? @conect c = {} @hash["CONECT"].each do |e| key = e.name.to_s.strip unless key.empty? val = e.other_atoms.collect { |x| x.strip } #warn "Warning: #{key}: atom name conflict?" if c[key] c[key] = val end end @conect = c end @conect end
Identifier written in the first line “RESIDUE” record. (e.g. CMP)
# File lib/bio/db/pdb/chemicalcomponent.rb, line 163 def entry_id @data[0].hetID end
The chemical formula of the chemical component. Returns a string (or nil, if the entry is something wrong).
# File lib/bio/db/pdb/chemicalcomponent.rb, line 187 def formul @hash["FORMUL"][0].text end
The name of the chemical component. Returns a string (or nil, if the entry is something wrong).
# File lib/bio/db/pdb/chemicalcomponent.rb, line 181 def hetnam @hash["HETNAM"][0].text end
Synonyms for the comical component. Returns an array of strings.
# File lib/bio/db/pdb/chemicalcomponent.rb, line 168 def hetsyn unless defined? @hetsyn if r = @hash["HETSYN"] @hetsyn = r[0].hetSynonyms.to_s.split(/\;\s*/) else return [] end end @hetsyn 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
# File lib/bio/db/pdb/chemicalcomponent.rb, line 218 def record(name = nil) name ? @hash[name] : @hash end
Generated with the Darkfish Rdoc Generator 2.