Sha256: d0b69341d3850ad289b3989854a790f04002e1203b8db371d72a7891accf2686

Contents?: true

Size: 1.76 KB

Versions: 12

Compression:

Stored size: 1.76 KB

Contents

#
# bio/util/restriction_enzyme/range/horizontal_cut_range.rb - 
#
# 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

class HorizontalCutRange < CutRange
  attr_reader :p_cut_left, :p_cut_right
  attr_reader :c_cut_left, :c_cut_right
  attr_reader :min, :max
  attr_reader :hcuts

  def initialize( left, right=left )
    raise "left > right" if left > right

    # The 'range' here is actually off by one on the left
    # side in relation to a normal CutRange, so using the normal
    # variables from CutRange would result in bad behavior.
    #
    # See below - the first horizontal cut is the primary cut plus one.
    #
    #    1 2 3 4 5 6 7
    #    G A|T T A C A
    #       +-----+
    #    C T A A T|G T
    #    1 2 3 4 5 6 7
    # 
    # Primary cut = 2
    # Complement cut = 5
    # Horizontal cuts = 3, 4, 5

    @p_cut_left = nil
    @p_cut_right = nil
    @c_cut_left = nil
    @c_cut_right = nil
    @min = left  # NOTE this used to be 'nil', make sure all tests work
    @max = right # NOTE this used to be 'nil', make sure all tests work
    @range = (@min..@max) unless @min == nil or @max == nil # NOTE this used to be 'nil', make sure all tests work
    

    @hcuts = (left..right)
  end

  # Check if a location falls within the minimum or maximum values of this
  # range.
  #
  # ---
  # *Arguments*
  # * +i+: Location to check if it is included in the range
  # *Returns*:: +true+ _or_ +false+
  def include?(i)
    @range.include?(i)
  end
end # HorizontalCutRange
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/horizontal_cut_range.rb
bio-2.0.4 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb
bio-2.0.3 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb
bio-2.0.2 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb
bio-2.0.1 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb
bio-2.0.0 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb
bio-1.6.0.pre.20181210 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb
bio-1.5.2 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb
bio-1.5.1 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb
bio-1.5.0 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb
bio-1.4.3.0001 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb
bio-1.4.3 lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb