Sha256: 445bdf55e5fae021d47c756b9c9eca99788a9b93acb20a2c01d2ad1017acf188

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 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
#

module Bio

require 'bio/util/restriction_enzyme' unless const_defined?(:RestrictionEnzyme)

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

12 entries across 12 versions & 1 rubygems

Version Path
bio-2.0.5 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-2.0.4 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-2.0.3 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-2.0.2 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-2.0.1 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-2.0.0 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.6.0.pre.20181210 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.5.2 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.5.1 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.5.0 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.4.3.0001 lib/bio/util/restriction_enzyme/range/cut_ranges.rb
bio-1.4.3 lib/bio/util/restriction_enzyme/range/cut_ranges.rb