Module: Bio::PDB::ChainFinder

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

Overview

methods to access chains

XXX#each_model must be defined.

Bio::PDB::ChainFinder is included by Bio::PDB::PDB and Bio::PDB::Model.

Instance Method Summary collapse

Instance Method Details

#chainsObject

returns all chains



272
273
274
275
276
# File 'lib/bio/db/pdb/utils.rb', line 272

def chains
  array = []
  self.each_model { |model| array.concat(model.chains) }
  return array
end

#each_chain(&x) ⇒ Object

iterates over each chain



267
268
269
# File 'lib/bio/db/pdb/utils.rb', line 267

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

#find_chainObject

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



258
259
260
261
262
263
264
# File 'lib/bio/db/pdb/utils.rb', line 258

def find_chain
  array = []
  self.each_chain do |chain|
    array.push(chain) if yield(chain)
  end
  return array
end