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

Inherits:
CutRange
  • Object
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.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 15

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.



11
12
13
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 11

def c_cut_left
  @c_cut_left
end

#c_cut_rightObject (readonly)

Returns the value of attribute c_cut_right.



11
12
13
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 11

def c_cut_right
  @c_cut_right
end

#hcutsObject (readonly)

Returns the value of attribute hcuts.



13
14
15
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 13

def hcuts
  @hcuts
end

#maxObject (readonly)

Returns the value of attribute max.



12
13
14
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 12

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



12
13
14
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 12

def min
  @min
end

#p_cut_leftObject (readonly)

Returns the value of attribute p_cut_left.



10
11
12
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 10

def p_cut_left
  @p_cut_left
end

#p_cut_rightObject (readonly)

Returns the value of attribute p_cut_right.



10
11
12
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 10

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)


53
54
55
# File 'lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb', line 53

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