Module: Bio::PDB::ChainFinder
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
-
#chains ⇒ Object
returns all chains.
-
#each_chain(&x) ⇒ Object
iterates over each chain.
-
#find_chain ⇒ Object
returns an array containing all chains for which given block is not
false
(similar to Enumerable#find_all).
Instance Method Details
#chains ⇒ Object
returns all chains
270 271 272 273 274 |
# File 'lib/bio/db/pdb/utils.rb', line 270 def chains array = [] self.each_model { |model| array.concat(model.chains) } return array end |
#each_chain(&x) ⇒ Object
iterates over each chain
265 266 267 |
# File 'lib/bio/db/pdb/utils.rb', line 265 def each_chain(&x) #:yields: chain self.each_model { |model| model.each(&x) } end |
#find_chain ⇒ Object
returns an array containing all chains for which given block is not false
(similar to Enumerable#find_all).
256 257 258 259 260 261 262 |
# File 'lib/bio/db/pdb/utils.rb', line 256 def find_chain array = [] self.each_chain do |chain| array.push(chain) if yield(chain) end return array end |