Module: Bio::PDB::AtomFinder

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

Overview

methods to access atoms

XXX#each_residue must be defined.

Instance Method Summary collapse

Instance Method Details

#atomsObject

returns all atoms


329
330
331
332
333
# File 'lib/bio/db/pdb/utils.rb', line 329

def atoms
  array = []
  self.each_residue { |residue| array.concat(residue.atoms) }
  return array
end

#each_atom(&x) ⇒ Object

iterates over each atom


324
325
326
# File 'lib/bio/db/pdb/utils.rb', line 324

def each_atom(&x) #:yields: atom
  self.each_residue { |residue| residue.each(&x) }
end

#find_atomObject

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


315
316
317
318
319
320
321
# File 'lib/bio/db/pdb/utils.rb', line 315

def find_atom
  array = []
  self.each_atom do |atom|
    array.push(atom) if yield(atom)
  end
  return array
end