Module: Bio::PDB::ResidueFinder

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

Overview

methods to access residues

XXX#each_chain must be defined.

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

Instance Method Summary collapse

Instance Method Details

#each_residue(&x) ⇒ Object

iterates over each residue


297
298
299
# File 'lib/bio/db/pdb/utils.rb', line 297

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

#find_residueObject

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


288
289
290
291
292
293
294
# File 'lib/bio/db/pdb/utils.rb', line 288

def find_residue
  array = []
  self.each_residue do |residue|
    array.push(residue) if yield(residue)
  end
  return array
end

#residuesObject

returns all residues


302
303
304
305
306
# File 'lib/bio/db/pdb/utils.rb', line 302

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