Sha256: 6367e63e557c219111df6e6d2006e7545db7d40082e7874a6bae643f870fc174

Contents?: true

Size: 1.21 KB

Versions: 21

Compression:

Stored size: 1.21 KB

Contents

#
# bio/util/restriction_enzyme/range/cut_ranges.rb - Container for many CutRange objects or CutRange child objects.
#
# Author::    Trevor Wennblom  <mailto:trevor@corevx.com>
# Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
# License::   The Ruby License
#
#  $Id: cut_ranges.rb,v 1.5 2007/07/16 19:28:48 k Exp $
#

require 'bio/util/restriction_enzyme'

module Bio
class RestrictionEnzyme
class Range
  
# Container for many CutRange objects or CutRange child objects.  Inherits from array.
#
class CutRanges < Array
  def min; self.collect{|a| a.min}.flatten.sort.first; end
  def max; self.collect{|a| a.max}.flatten.sort.last; end
  def include?(i); self.collect{|a| a.include?(i)}.include?(true); end
  
  def min_vertical
    vertical_min_max_helper( :min )
  end
  
  def max_vertical
    vertical_min_max_helper( :max )
  end
  
  protected
  
  def vertical_min_max_helper( sym_which )
    tmp = []
    self.each do |a|
      next unless a.class == Bio::RestrictionEnzyme::Range::VerticalCutRange
      tmp << a.send( sym_which )
    end
    z = (sym_which == :max) ? :last : :first
    tmp.flatten.sort.send(z)
  end
    
end # CutRanges
end # Range
end # RestrictionEnzyme
end # Bio

Version data entries

21 entries across 21 versions & 5 rubygems

Version Path
bioruby-bio-1.2.9.9001 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bioruby-bio-1.2.9.9501 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bioruby-bio-1.3.0.5000 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bioruby-bio-1.3.0.9901 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bioruby-bio-1.3.0 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bioruby-bio-1.3.1.5000 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
jandot-bio-1.2.1 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
ngoto-bio-1.2.9.9001 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
ngoto-bio-1.2.9.9501 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
ngoto-bio-1.3.0.5000 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
ngoto-bio-1.3.0 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
ngoto-bio-1.3.1.5000 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
wwood-bioruby-1.2.11 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.4.2 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.4.1 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.4.0 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.3.1 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.1.0 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.2.1 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.2.0 lib/bio/util/restriction_enzyme/range/cut_ranges.rb