bio-restriction_enzyme 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. data/.document +5 -0
  2. data/COPYING.txt +121 -0
  3. data/Gemfile +10 -0
  4. data/LICENSE.txt +7 -0
  5. data/README.rdoc +22 -0
  6. data/Rakefile +53 -0
  7. data/VERSION +1 -0
  8. data/bio-restriction_enzyme.gemspec +99 -0
  9. data/lib/bio-restriction_enzyme.rb +1 -0
  10. data/lib/bio/util/restriction_enzyme.rb +218 -0
  11. data/lib/bio/util/restriction_enzyme/analysis.rb +241 -0
  12. data/lib/bio/util/restriction_enzyme/analysis_basic.rb +209 -0
  13. data/lib/bio/util/restriction_enzyme/cut_symbol.rb +99 -0
  14. data/lib/bio/util/restriction_enzyme/double_stranded.rb +313 -0
  15. data/lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb +127 -0
  16. data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb +95 -0
  17. data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb +30 -0
  18. data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb +68 -0
  19. data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb +99 -0
  20. data/lib/bio/util/restriction_enzyme/range/cut_range.rb +16 -0
  21. data/lib/bio/util/restriction_enzyme/range/cut_ranges.rb +39 -0
  22. data/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb +59 -0
  23. data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +249 -0
  24. data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +236 -0
  25. data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +43 -0
  26. data/lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb +33 -0
  27. data/lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb +69 -0
  28. data/lib/bio/util/restriction_enzyme/single_strand.rb +193 -0
  29. data/lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb +127 -0
  30. data/lib/bio/util/restriction_enzyme/single_strand_complement.rb +15 -0
  31. data/lib/bio/util/restriction_enzyme/string_formatting.rb +103 -0
  32. data/test/bio-restriction_enzyme/analysis/test_calculated_cuts.rb +281 -0
  33. data/test/bio-restriction_enzyme/analysis/test_cut_ranges.rb +87 -0
  34. data/test/bio-restriction_enzyme/analysis/test_sequence_range.rb +223 -0
  35. data/test/bio-restriction_enzyme/double_stranded/test_aligned_strands.rb +84 -0
  36. data/test/bio-restriction_enzyme/double_stranded/test_cut_location_pair.rb +58 -0
  37. data/test/bio-restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +56 -0
  38. data/test/bio-restriction_enzyme/double_stranded/test_cut_locations.rb +35 -0
  39. data/test/bio-restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +87 -0
  40. data/test/bio-restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +66 -0
  41. data/test/bio-restriction_enzyme/test_analysis.rb +228 -0
  42. data/test/bio-restriction_enzyme/test_cut_symbol.rb +27 -0
  43. data/test/bio-restriction_enzyme/test_double_stranded.rb +98 -0
  44. data/test/bio-restriction_enzyme/test_single_strand.rb +131 -0
  45. data/test/bio-restriction_enzyme/test_single_strand_complement.rb +131 -0
  46. data/test/bio-restriction_enzyme/test_string_formatting.rb +43 -0
  47. data/test/helper.rb +17 -0
  48. data/test/test_bio-restriction_enzyme.rb +21 -0
  49. metadata +153 -0
@@ -0,0 +1,127 @@
1
+ # bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb - The cut locations, in enzyme notation
2
+
3
+ require 'bio/util/restriction_enzyme'
4
+
5
+ module Bio
6
+ class RestrictionEnzyme
7
+ class SingleStrand
8
+
9
+ # Stores the cut location in thier enzyme index notation
10
+ #
11
+ # May be initialized with a series of cuts or an enzyme pattern marked
12
+ # with cut symbols.
13
+ #
14
+ # Enzyme index notation:: 1.._n_, value before 1 is -1
15
+ #
16
+ # example:: [-3][-2][-1][1][2][3][4][5]
17
+ #
18
+ # Negative values are used to indicate when a cut may occur at a specified
19
+ # distance before the sequence begins. This would be padded with 'n'
20
+ # nucleotides to represent wildcards.
21
+ #
22
+ # Notes:
23
+ # * <code>0</code> is invalid as it does not refer to any index
24
+ # * +nil+ is not allowed here as it has no meaning
25
+ # * +nil+ values are kept track of in DoubleStranded::CutLocations as they
26
+ # need a reference point on the correlating strand. In
27
+ # DoubleStranded::CutLocations +nil+ represents no cut or a partial
28
+ # digestion.
29
+ #
30
+ class CutLocationsInEnzymeNotation < Array
31
+ include CutSymbol
32
+ extend CutSymbol
33
+
34
+ # First cut, in enzyme-index notation
35
+ attr_reader :min
36
+
37
+ # Last cut, in enzyme-index notation
38
+ attr_reader :max
39
+
40
+ # Constructor for CutLocationsInEnzymeNotation
41
+ #
42
+ # ---
43
+ # *Arguments*
44
+ # * +a+: Locations of cuts represented as a string with cuts or an array of values
45
+ # Examples:
46
+ # * n^ng^arraxt^n
47
+ # * 2
48
+ # * -1, 5
49
+ # * [-1, 5]
50
+ # *Returns*:: nothing
51
+ def initialize(*a)
52
+ a.flatten! # in case an array was passed as an argument
53
+
54
+ if a.size == 1 and a[0].kind_of? String and a[0] =~ re_cut_symbol
55
+ # Initialize with a cut symbol pattern such as 'n^ng^arraxt^n'
56
+ s = a[0]
57
+ a = []
58
+ i = -( s.tr(cut_symbol, '') =~ %r{[^n]} ) # First character that's not 'n'
59
+ s.each_byte { |c| (a << i; next) if c.chr == cut_symbol; i += 1 }
60
+ a.collect! { |n| n <= 0 ? n-1 : n } # 0 is not a valid enzyme index, decrement from 0 and all negative
61
+ else
62
+ a.collect! { |n| n.to_i } # Cut locations are always integers
63
+ end
64
+
65
+ validate_cut_locations( a )
66
+ super(a)
67
+ self.sort!
68
+ @min = self.first
69
+ @max = self.last
70
+ self.freeze
71
+ end
72
+
73
+ # Transform the cut locations from enzyme index notation to 0-based index
74
+ # notation.
75
+ #
76
+ # input -> output
77
+ # [ 1, 2, 3 ] -> [ 0, 1, 2 ]
78
+ # [ 1, 3, 5 ] -> [ 0, 2, 4 ]
79
+ # [ -1, 1, 2 ] -> [ 0, 1, 2 ]
80
+ # [ -2, 1, 3 ] -> [ 0, 2, 4 ]
81
+ #
82
+ # ---
83
+ # *Arguments*
84
+ # * _none_
85
+ # *Returns*:: +Array+ of cuts in 0-based index notation
86
+ def to_array_index
87
+ return [] if @min == nil
88
+ if @min < 0
89
+ calc = lambda do |n|
90
+ n -= 1 unless n < 0
91
+ n + @min.abs
92
+ end
93
+ else
94
+ calc = lambda { |n| n - 1 }
95
+ end
96
+ self.collect(&calc)
97
+ end
98
+
99
+ #########
100
+ protected
101
+ #########
102
+
103
+ def validate_cut_locations( input_cut_locations )
104
+ unless input_cut_locations == input_cut_locations.uniq
105
+ err = "The cut locations supplied contain duplicate values. Redundant / undefined meaning.\n"
106
+ err += "cuts: #{input_cut_locations.inspect}\n"
107
+ err += "unique: #{input_cut_locations.uniq.inspect}"
108
+ raise ArgumentError, err
109
+ end
110
+
111
+ if input_cut_locations.include?(nil)
112
+ err = "The cut locations supplied contained a nil. nil has no index for enzyme notation, alternative meaning is 'no cut'.\n"
113
+ err += "cuts: #{input_cut_locations.inspect}"
114
+ raise ArgumentError, err
115
+ end
116
+
117
+ if input_cut_locations.include?(0)
118
+ err = "The cut locations supplied contained a '0'. '0' has no index for enzyme notation, alternative meaning is 'no cut'.\n"
119
+ err += "cuts: #{input_cut_locations.inspect}"
120
+ raise ArgumentError, err
121
+ end
122
+
123
+ end
124
+ end # CutLocationsInEnzymeNotation
125
+ end # SingleStrand
126
+ end # RestrictionEnzyme
127
+ end # Bio
@@ -0,0 +1,15 @@
1
+ # bio/util/restriction_enzyme/single_strand_complement.rb - Single strand restriction enzyme sequence in complement orientation
2
+
3
+ require 'bio/util/restriction_enzyme'
4
+
5
+ module Bio
6
+ class RestrictionEnzyme
7
+
8
+ # A single strand of restriction enzyme sequence pattern with a 3' to 5' orientation.
9
+ #
10
+ class SingleStrandComplement < SingleStrand
11
+ # Orientation of the strand, 3' to 5'
12
+ def orientation; [3, 5]; end
13
+ end # SingleStrandComplement
14
+ end # RestrictionEnzyme
15
+ end # Bio
@@ -0,0 +1,103 @@
1
+ # bio/util/restriction_enzyme/string_formatting.rb - Useful functions for string manipulation
2
+
3
+ require 'bio/util/restriction_enzyme'
4
+
5
+ module Bio
6
+ class RestrictionEnzyme
7
+
8
+ module StringFormatting
9
+ include CutSymbol
10
+ extend CutSymbol
11
+
12
+ # Return the sequence with spacing for alignment. Does not add whitespace
13
+ # around cut symbols.
14
+ #
15
+ # Example:
16
+ # pattern = 'n^ng^arraxt^n'
17
+ # add_spacing( pattern ) # => "n^n g^a r r a x t^n"
18
+ #
19
+ # ---
20
+ # *Arguments*
21
+ # * +seq+: sequence with cut symbols
22
+ # * +cs+: (_optional_) Cut symbol along the string. The reason this is
23
+ # definable outside of CutSymbol is that this is a utility function used
24
+ # to form vertical and horizontal cuts such as:
25
+ #
26
+ # a|t g c
27
+ # +---+
28
+ # t a c|g
29
+ # *Returns*:: +String+ sequence with single character distance between bases
30
+ def add_spacing( seq, cs = cut_symbol )
31
+ str = ''
32
+ flag = false
33
+ seq.each_byte do |c|
34
+ c = c.chr
35
+ if c == cs
36
+ str += c
37
+ flag = false
38
+ elsif flag
39
+ str += ' ' + c
40
+ else
41
+ str += c
42
+ flag = true
43
+ end
44
+ end
45
+ str
46
+ end
47
+
48
+ # Remove extraneous nucleic acid wildcards ('n' padding) from the
49
+ # left and right sides
50
+ #
51
+ # ---
52
+ # *Arguments*
53
+ # * +s+: sequence with extraneous 'n' padding
54
+ # *Returns*:: +String+ sequence without 'n' padding on the sides
55
+ def strip_padding( s )
56
+ if s[0].chr == 'n'
57
+ s =~ %r{(n+)(.+)}
58
+ s = $2
59
+ end
60
+ if s[-1].chr == 'n'
61
+ s =~ %r{(.+?)(n+)$}
62
+ s = $1
63
+ end
64
+ s
65
+ end
66
+
67
+ # Remove extraneous nucleic acid wildcards ('n' padding) from the
68
+ # left and right sides and remove cut symbols
69
+ #
70
+ # ---
71
+ # *Arguments*
72
+ # * +s+: sequence with extraneous 'n' padding and cut symbols
73
+ # *Returns*:: +String+ sequence without 'n' padding on the sides or cut symbols
74
+ def strip_cuts_and_padding( s )
75
+ strip_padding( s.tr(cut_symbol, '') )
76
+ end
77
+
78
+ # Return the 'n' padding on the left side of the strand
79
+ #
80
+ # ---
81
+ # *Arguments*
82
+ # * +s+: sequence with extraneous 'n' padding on the left side of the strand
83
+ # *Returns*:: +String+ the 'n' padding from the left side
84
+ def left_padding( s )
85
+ s =~ %r{^n+}
86
+ ret = $&
87
+ ret ? ret : '' # Don't pass nil values
88
+ end
89
+
90
+ # Return the 'n' padding on the right side of the strand
91
+ #
92
+ # ---
93
+ # *Arguments*
94
+ # * +s+: sequence with extraneous 'n' padding on the right side of the strand
95
+ # *Returns*:: +String+ the 'n' padding from the right side
96
+ def right_padding( s )
97
+ s =~ %r{n+$}
98
+ ret = $&
99
+ ret ? ret : '' # Don't pass nil values
100
+ end
101
+ end # StringFormatting
102
+ end # RestrictionEnzyme
103
+ end # Bio
@@ -0,0 +1,281 @@
1
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..']*2, 'helper.rb')).cleanpath.to_s
2
+
3
+ require 'bio/util/restriction_enzyme/range/sequence_range/calculated_cuts'
4
+ require 'bio/util/restriction_enzyme/range/cut_range'
5
+ require 'bio/util/restriction_enzyme/range/cut_ranges'
6
+ require 'bio/util/restriction_enzyme/range/horizontal_cut_range'
7
+ require 'bio/util/restriction_enzyme/range/vertical_cut_range'
8
+
9
+ class TestBioRestrictionEnzymeAnalysisCalculatedCuts < Test::Unit::TestCase
10
+
11
+ def setup
12
+ @t = Bio::RestrictionEnzyme::Range::SequenceRange::CalculatedCuts
13
+ @vcr = Bio::RestrictionEnzyme::Range::VerticalCutRange
14
+ @crs = Bio::RestrictionEnzyme::Range::CutRanges
15
+ @hcr = Bio::RestrictionEnzyme::Range::HorizontalCutRange
16
+
17
+ #a.add_cut_range(p_cut_left, p_cut_right, c_cut_left, c_cut_right )
18
+
19
+ @obj_1 = @t.new(6)
20
+ @obj_1.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(0,nil,nil,3), @vcr.new(nil,2,nil,nil)] ))
21
+ @obj_1b = @obj_1.dup
22
+ @obj_1b.remove_incomplete_cuts
23
+
24
+ @obj_2 = @t.new(6)
25
+ @obj_2.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(0,2,nil,nil), @vcr.new(3,nil,4,nil)] ))
26
+ @obj_2b = @obj_2.dup
27
+ @obj_2b.remove_incomplete_cuts
28
+
29
+ @obj_3 = @t.new(6)
30
+ @obj_3.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(0,2,nil,nil), @vcr.new(3,nil,4,nil)] ))
31
+ @obj_3.add_cuts_from_cut_ranges( @crs.new( [@hcr.new(0), @hcr.new(5)] ))
32
+ @obj_3b = @obj_3.dup
33
+ @obj_3b.remove_incomplete_cuts
34
+
35
+ @obj_4 = @t.new(6)
36
+ @obj_4.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(0,2,1,3)] ))
37
+ @obj_4b = @obj_4.dup
38
+ @obj_4b.remove_incomplete_cuts
39
+
40
+ # Same thing, declared a different way
41
+ @obj_4_c1 = @t.new(6)
42
+ @obj_4_c1.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(nil,nil,1,3), @vcr.new(0,2,nil,nil)] ))
43
+ @obj_4b_c1 = @obj_4_c1.dup
44
+ @obj_4b_c1.remove_incomplete_cuts
45
+
46
+ # Same thing, declared a different way
47
+ @obj_4_c2 = @t.new(6)
48
+ @obj_4_c2.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(0,nil,nil,3), @vcr.new(nil,2,1,nil)] ))
49
+ @obj_4b_c2 = @obj_4_c2.dup
50
+ @obj_4b_c2.remove_incomplete_cuts
51
+
52
+ @obj_5 = @t.new(6)
53
+ @obj_5.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(0,nil,nil,nil), @vcr.new(nil,4,3,nil), @hcr.new(1,2)] ))
54
+ @obj_5b = @obj_5.dup
55
+ @obj_5b.remove_incomplete_cuts
56
+
57
+ @obj_6 = @t.new(6)
58
+ @obj_6.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(nil,nil,0,nil), @hcr.new(1,2), @vcr.new(nil,4,3,nil)] ))
59
+ @obj_6b = @obj_6.dup
60
+ @obj_6b.remove_incomplete_cuts
61
+
62
+ @obj_7 = @t.new(6)
63
+ @obj_7.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(nil,2,nil,nil), @hcr.new(0,2)] ))
64
+ @obj_7b = @obj_7.dup
65
+ @obj_7b.remove_incomplete_cuts
66
+
67
+ @obj_8 = @t.new(12)
68
+ @obj_8.add_cuts_from_cut_ranges( @crs.new( [@hcr.new(0,1), @vcr.new(nil,nil,nil,5), @hcr.new(7,8), @hcr.new(10), @vcr.new(nil,10,nil,nil)] ))
69
+ @obj_8b = @obj_8.dup
70
+ @obj_8b.remove_incomplete_cuts
71
+
72
+ @obj_9 = @t.new(6)
73
+ @obj_9.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(nil,3,nil,3)] ))
74
+ @obj_9b = @obj_9.dup
75
+ @obj_9b.remove_incomplete_cuts
76
+
77
+ @obj_10 = @t.new(6)
78
+ @obj_10.add_cuts_from_cut_ranges( @crs.new( [@vcr.new(0,nil,nil,3), @vcr.new(nil,2,nil,2)] ))
79
+ @obj_10b = @obj_10.dup
80
+ @obj_10b.remove_incomplete_cuts
81
+
82
+
83
+ end
84
+
85
+ def test_cuts
86
+ x = @obj_1
87
+ assert_equal([0,2], x.vc_primary)
88
+ assert_equal([3], x.vc_complement)
89
+ assert_equal([1,2,3], x.hc_between_strands)
90
+
91
+ x = @obj_2
92
+ assert_equal([0,2,3], x.vc_primary)
93
+ assert_equal([4], x.vc_complement)
94
+ assert_equal([1,2,4], x.hc_between_strands)
95
+
96
+ x = @obj_3
97
+ assert_equal([0,2,3], x.vc_primary)
98
+ assert_equal([4], x.vc_complement)
99
+ assert_equal([0,1,2,4,5], x.hc_between_strands)
100
+
101
+ x = @obj_4
102
+ assert_equal([0,2], x.vc_primary)
103
+ assert_equal([1,3], x.vc_complement)
104
+ assert_equal([1,2,3], x.hc_between_strands)
105
+
106
+ x = @obj_4_c1
107
+ assert_equal([0,2], x.vc_primary)
108
+ assert_equal([1,3], x.vc_complement)
109
+ assert_equal([1,2,3], x.hc_between_strands)
110
+
111
+ x = @obj_4_c2
112
+ assert_equal([0,2], x.vc_primary)
113
+ assert_equal([1,3], x.vc_complement)
114
+ assert_equal([1,2,3], x.hc_between_strands)
115
+
116
+ x = @obj_5
117
+ assert_equal([0,4], x.vc_primary)
118
+ assert_equal([3], x.vc_complement)
119
+ assert_equal([1,2,4], x.hc_between_strands)
120
+
121
+ x = @obj_6
122
+ assert_equal([4], x.vc_primary)
123
+ assert_equal([0,3], x.vc_complement)
124
+ assert_equal([1,2,4], x.hc_between_strands)
125
+
126
+ x = @obj_7
127
+ assert_equal([2], x.vc_primary)
128
+ assert_equal([], x.vc_complement)
129
+ assert_equal([0,1,2], x.hc_between_strands)
130
+
131
+ x = @obj_8
132
+ assert_equal([10], x.vc_primary)
133
+ assert_equal([5], x.vc_complement)
134
+ assert_equal([0,1,7,8,10], x.hc_between_strands)
135
+
136
+ x = @obj_9
137
+ assert_equal([3], x.vc_primary)
138
+ assert_equal([3], x.vc_complement)
139
+ assert_equal([], x.hc_between_strands)
140
+
141
+ x = @obj_10
142
+ assert_equal([0,2], x.vc_primary)
143
+ assert_equal([2,3], x.vc_complement)
144
+ assert_equal([1,2,3], x.hc_between_strands)
145
+ end
146
+
147
+ def test_cuts_after_remove_incomplete_cuts
148
+ x = @obj_1b
149
+ assert_equal([0,2], x.vc_primary)
150
+ assert_equal([3], x.vc_complement)
151
+ assert_equal([1,2,3], x.hc_between_strands)
152
+ end
153
+
154
+ def test_strands_for_display_current
155
+ #check object_id
156
+ end
157
+
158
+ def test_strands_for_display
159
+ x = @obj_1
160
+ assert_equal('0|1 2|3 4 5', x.strands_for_display[0])
161
+ assert_equal(' +---+-+ ', x.strands_for_display[1])
162
+ assert_equal('0 1 2 3|4 5', x.strands_for_display[2])
163
+
164
+ x = @obj_1b
165
+ assert_equal('0|1 2|3 4 5', x.strands_for_display[0])
166
+ assert_equal(' +---+-+ ', x.strands_for_display[1])
167
+ assert_equal('0 1 2 3|4 5', x.strands_for_display[2])
168
+
169
+ x = @obj_2
170
+ assert_equal('0|1 2|3|4 5', x.strands_for_display[0])
171
+ assert_equal(' +---+ +-+ ', x.strands_for_display[1])
172
+ assert_equal('0 1 2 3 4|5', x.strands_for_display[2])
173
+
174
+ x = @obj_2b
175
+ assert_equal('0|1 2|3|4 5', x.strands_for_display[0])
176
+ assert_equal(' +---+ +-+ ', x.strands_for_display[1])
177
+ assert_equal('0 1 2 3 4|5', x.strands_for_display[2])
178
+
179
+ x = @obj_3
180
+ assert_equal('0|1 2|3|4 5', x.strands_for_display[0])
181
+ assert_equal('-+---+ +-+-', x.strands_for_display[1])
182
+ assert_equal('0 1 2 3 4|5', x.strands_for_display[2])
183
+
184
+ x = @obj_3b
185
+ assert_equal('0|1 2|3|4 5', x.strands_for_display[0])
186
+ assert_equal('-+---+ +-+-', x.strands_for_display[1])
187
+ assert_equal('0 1 2 3 4|5', x.strands_for_display[2])
188
+
189
+ x = @obj_4
190
+ assert_equal('0|1 2|3 4 5', x.strands_for_display[0])
191
+ assert_equal(' +-+-+-+ ', x.strands_for_display[1])
192
+ assert_equal('0 1|2 3|4 5', x.strands_for_display[2])
193
+
194
+ x = @obj_4b
195
+ assert_equal('0|1 2|3 4 5', x.strands_for_display[0])
196
+ assert_equal(' +-+-+-+ ', x.strands_for_display[1])
197
+ assert_equal('0 1|2 3|4 5', x.strands_for_display[2])
198
+
199
+ x = @obj_4_c1
200
+ assert_equal('0|1 2|3 4 5', x.strands_for_display[0])
201
+ assert_equal(' +-+-+-+ ', x.strands_for_display[1])
202
+ assert_equal('0 1|2 3|4 5', x.strands_for_display[2])
203
+
204
+ x = @obj_4b_c1
205
+ assert_equal('0|1 2|3 4 5', x.strands_for_display[0])
206
+ assert_equal(' +-+-+-+ ', x.strands_for_display[1])
207
+ assert_equal('0 1|2 3|4 5', x.strands_for_display[2])
208
+
209
+ x = @obj_4_c2
210
+ assert_equal('0|1 2|3 4 5', x.strands_for_display[0])
211
+ assert_equal(' +-+-+-+ ', x.strands_for_display[1])
212
+ assert_equal('0 1|2 3|4 5', x.strands_for_display[2])
213
+
214
+ x = @obj_4b_c2
215
+ assert_equal('0|1 2|3 4 5', x.strands_for_display[0])
216
+ assert_equal(' +-+-+-+ ', x.strands_for_display[1])
217
+ assert_equal('0 1|2 3|4 5', x.strands_for_display[2])
218
+
219
+ x = @obj_5
220
+ assert_equal('0|1 2 3 4|5', x.strands_for_display[0])
221
+ assert_equal(' +--- +-+ ', x.strands_for_display[1])
222
+ assert_equal('0 1 2 3|4 5', x.strands_for_display[2])
223
+
224
+ x = @obj_5b
225
+ assert_equal('0 1 2 3 4|5', x.strands_for_display[0])
226
+ assert_equal(' +-+ ', x.strands_for_display[1])
227
+ assert_equal('0 1 2 3|4 5', x.strands_for_display[2])
228
+
229
+ x = @obj_6
230
+ assert_equal('0 1 2 3 4|5', x.strands_for_display[0])
231
+ assert_equal(' +--- +-+ ', x.strands_for_display[1])
232
+ assert_equal('0|1 2 3|4 5', x.strands_for_display[2])
233
+
234
+ x = @obj_6b
235
+ assert_equal('0 1 2 3 4|5', x.strands_for_display[0])
236
+ assert_equal(' +-+ ', x.strands_for_display[1])
237
+ assert_equal('0 1 2 3|4 5', x.strands_for_display[2])
238
+
239
+ x = @obj_7
240
+ assert_equal('0 1 2|3 4 5', x.strands_for_display[0])
241
+ assert_equal('-----+ ', x.strands_for_display[1])
242
+ assert_equal('0 1 2 3 4 5', x.strands_for_display[2])
243
+
244
+ x = @obj_7b
245
+ assert_equal('0 1 2|3 4 5', x.strands_for_display[0])
246
+ assert_equal('-----+ ', x.strands_for_display[1])
247
+ assert_equal('0 1 2 3 4 5', x.strands_for_display[2])
248
+
249
+ x = @obj_8
250
+ assert_equal('0 1 2 3 4 5 6 7 8 9 0|1', x.strands_for_display[0])
251
+ assert_equal('--- + --- -+ ', x.strands_for_display[1])
252
+ assert_equal('0 1 2 3 4 5|6 7 8 9 0 1', x.strands_for_display[2])
253
+
254
+ x = @obj_8b
255
+ assert_equal('0 1 2 3 4 5 6 7 8 9 0 1', x.strands_for_display[0])
256
+ assert_equal(' ', x.strands_for_display[1])
257
+ assert_equal('0 1 2 3 4 5 6 7 8 9 0 1', x.strands_for_display[2])
258
+
259
+ x = @obj_9
260
+ assert_equal('0 1 2 3|4 5', x.strands_for_display[0])
261
+ assert_equal(' + ', x.strands_for_display[1])
262
+ assert_equal('0 1 2 3|4 5', x.strands_for_display[2])
263
+
264
+ x = @obj_9b
265
+ assert_equal('0 1 2 3|4 5', x.strands_for_display[0])
266
+ assert_equal(' + ', x.strands_for_display[1])
267
+ assert_equal('0 1 2 3|4 5', x.strands_for_display[2])
268
+
269
+ x = @obj_10
270
+ assert_equal('0|1 2|3 4 5', x.strands_for_display[0])
271
+ assert_equal(' +---+-+ ', x.strands_for_display[1])
272
+ assert_equal('0 1 2|3|4 5', x.strands_for_display[2])
273
+
274
+ x = @obj_10b
275
+ assert_equal('0|1 2|3 4 5', x.strands_for_display[0])
276
+ assert_equal(' +---+-+ ', x.strands_for_display[1])
277
+ assert_equal('0 1 2|3|4 5', x.strands_for_display[2])
278
+
279
+ end
280
+
281
+ end