Module: Bio::PDB::HetatmFinder

Included in:
Bio::PDB, Chain, Heterogen, Model
Defined in:
lib/bio/db/pdb/utils.rb

Overview

methods to access HETATMs

XXX#each_heterogen must be defined.

Bio::PDB::HetatmFinder is included by Bio::PDB::PDB, Bio::PDB::Model, Bio::PDB::Chain, and Bio::PDB::Heterogen.

Instance Method Summary collapse

Instance Method Details

#each_hetatm(&x) ⇒ Object

iterates over each HETATM


355
356
357
# File 'lib/bio/db/pdb/utils.rb', line 355

def each_hetatm(&x) #:yields: hetatm
  self.each_heterogen { |heterogen| heterogen.each(&x) }
end

#find_hetatmObject

returns an array containing all HETATMs for which given block is not false (similar to Enumerable#find_all).


346
347
348
349
350
351
352
# File 'lib/bio/db/pdb/utils.rb', line 346

def find_hetatm
  array = []
  self.each_hetatm do |hetatm|
    array.push(hetatm) if yield(hetatm)
  end
  return array
end

#hetatmsObject

returns all HETATMs


360
361
362
363
364
# File 'lib/bio/db/pdb/utils.rb', line 360

def hetatms
  array = []
  self.each_heterogen { |heterogen| array.concat(heterogen.hetatms) }
  return array
end