Class: Bio::RestrictionEnzyme::Range::VerticalCutRange

Inherits:
CutRange
  • Object
show all
Defined in:
lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb

Overview

FIXME docs are kind of out of date. Change this to VerticalAndHorizontalCutRange

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(p_cut_left = nil, p_cut_right = nil, c_cut_left = nil, c_cut_right = nil) ⇒ VerticalCutRange

VerticalCutRange provides an extremely raw, yet precise, method of defining the location of cuts on primary and complementary sequences.

Many VerticalCutRange objects are used with HorizontalCutRange objects to be contained in CutRanges to define the cut pattern that a specific enzyme may make.

VerticalCutRange takes up to four possible cuts, two on the primary strand and two on the complementary strand. In typical usage you will want to make a single cut on the primary strand and a single cut on the complementary strand.

However, you can construct it with whatever cuts you desire to accomadate the most eccentric of imaginary restriction enzymes.


Arguments

  • p_cut_left: (optional) Left-most cut on the primary strand. nil to skip

  • p_cut_right: (optional) Right-most cut on the primary strand. nil to skip

  • c_cut_left: (optional) Left-most cut on the complementary strand. nil to skip

  • c_cut_right: (optional) Right-most cut on the complementary strand. nil to skip

Returns

nothing



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb', line 38

def initialize( p_cut_left=nil, p_cut_right=nil, c_cut_left=nil, c_cut_right=nil )
  @p_cut_left = p_cut_left
  @p_cut_right = p_cut_right
  @c_cut_left = c_cut_left
  @c_cut_right = c_cut_right

  a = [@p_cut_left, @c_cut_left, @p_cut_right, @c_cut_right]
  a.delete(nil)
  a.sort!
  @min = a.first
  @max = a.last

  @range = nil
  @range = (@min..@max) unless @min == nil or @max == nil
  return
end

Instance Attribute Details

#c_cut_leftObject (readonly)

Returns the value of attribute c_cut_left.



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

def c_cut_left
  @c_cut_left
end

#c_cut_rightObject (readonly)

Returns the value of attribute c_cut_right.



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

def c_cut_right
  @c_cut_right
end

#maxObject (readonly)

Returns the value of attribute max.



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

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



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

def min
  @min
end

#p_cut_leftObject (readonly)

Returns the value of attribute p_cut_left.



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

def p_cut_left
  @p_cut_left
end

#p_cut_rightObject (readonly)

Returns the value of attribute p_cut_right.



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

def p_cut_right
  @p_cut_right
end

#rangeObject (readonly)

Returns the value of attribute range.



14
15
16
# File 'lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb', line 14

def range
  @range
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)


62
63
64
65
# File 'lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb', line 62

def include?(i)
  return false if @range == nil
  @range.include?(i)
end