Module: Bio::PDB::HeterogenFinder

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

Overview

methods to access heterogens (compounds or ligands)

XXX#each_chain must be defined.

Bio::PDB::HeterogenFinder is included by Bio::PDB::PDB, Bio::PDB::Model, and Bio::PDB::Chain.

Instance Method Summary (collapse)

Instance Method Details

- (Object) each_heterogen(&x)

iterates over each heterogens



386
387
388
# File 'lib/bio/db/pdb/utils.rb', line 386

def each_heterogen(&x) #:yields: heterogen
  self.each_chain { |chain| chain.each_heterogen(&x) }
end

- (Object) find_heterogen

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



377
378
379
380
381
382
383
# File 'lib/bio/db/pdb/utils.rb', line 377

def find_heterogen
  array = []
  self.each_heterogen do |heterogen|
    array.push(heterogen) if yield(heterogen)
  end
  return array
end

- (Object) heterogens

returns all heterogens



391
392
393
394
395
# File 'lib/bio/db/pdb/utils.rb', line 391

def heterogens
  array = []
  self.each_chain { |chain| array.concat(chain.heterogens) }
  return array
end