Class: Bio::RestrictionEnzyme::Range::HorizontalCutRange

Inherits:
CutRange show all
Defined in:
lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, right = left) ⇒ HorizontalCutRange

Returns a new instance of HorizontalCutRange.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 22

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

Instance Attribute Details

#c_cut_leftObject (readonly)

Returns the value of attribute c_cut_left.



18
19
20
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 18

def c_cut_left
  @c_cut_left
end

#c_cut_rightObject (readonly)

Returns the value of attribute c_cut_right.



18
19
20
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 18

def c_cut_right
  @c_cut_right
end

#hcutsObject (readonly)

Returns the value of attribute hcuts.



20
21
22
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 20

def hcuts
  @hcuts
end

#maxObject (readonly)

Returns the value of attribute max.



19
20
21
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 19

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



19
20
21
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 19

def min
  @min
end

#p_cut_leftObject (readonly)

Returns the value of attribute p_cut_left.



17
18
19
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 17

def p_cut_left
  @p_cut_left
end

#p_cut_rightObject (readonly)

Returns the value of attribute p_cut_right.



17
18
19
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 17

def p_cut_right
  @p_cut_right
end

Instance Method Details

#include?(i) ⇒ Boolean

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

Returns:

  • (Boolean)


60
61
62
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 60

def include?(i)
  @range.include?(i)
end