bio-restriction_enzyme 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/COPYING.txt +121 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +7 -0
- data/README.rdoc +22 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/bio-restriction_enzyme.gemspec +99 -0
- data/lib/bio-restriction_enzyme.rb +1 -0
- data/lib/bio/util/restriction_enzyme.rb +218 -0
- data/lib/bio/util/restriction_enzyme/analysis.rb +241 -0
- data/lib/bio/util/restriction_enzyme/analysis_basic.rb +209 -0
- data/lib/bio/util/restriction_enzyme/cut_symbol.rb +99 -0
- data/lib/bio/util/restriction_enzyme/double_stranded.rb +313 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb +127 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb +95 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb +30 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb +68 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb +99 -0
- data/lib/bio/util/restriction_enzyme/range/cut_range.rb +16 -0
- data/lib/bio/util/restriction_enzyme/range/cut_ranges.rb +39 -0
- data/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb +59 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +249 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +236 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +43 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb +33 -0
- data/lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb +69 -0
- data/lib/bio/util/restriction_enzyme/single_strand.rb +193 -0
- data/lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb +127 -0
- data/lib/bio/util/restriction_enzyme/single_strand_complement.rb +15 -0
- data/lib/bio/util/restriction_enzyme/string_formatting.rb +103 -0
- data/test/bio-restriction_enzyme/analysis/test_calculated_cuts.rb +281 -0
- data/test/bio-restriction_enzyme/analysis/test_cut_ranges.rb +87 -0
- data/test/bio-restriction_enzyme/analysis/test_sequence_range.rb +223 -0
- data/test/bio-restriction_enzyme/double_stranded/test_aligned_strands.rb +84 -0
- data/test/bio-restriction_enzyme/double_stranded/test_cut_location_pair.rb +58 -0
- data/test/bio-restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +56 -0
- data/test/bio-restriction_enzyme/double_stranded/test_cut_locations.rb +35 -0
- data/test/bio-restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +87 -0
- data/test/bio-restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +66 -0
- data/test/bio-restriction_enzyme/test_analysis.rb +228 -0
- data/test/bio-restriction_enzyme/test_cut_symbol.rb +27 -0
- data/test/bio-restriction_enzyme/test_double_stranded.rb +98 -0
- data/test/bio-restriction_enzyme/test_single_strand.rb +131 -0
- data/test/bio-restriction_enzyme/test_single_strand_complement.rb +131 -0
- data/test/bio-restriction_enzyme/test_string_formatting.rb +43 -0
- data/test/helper.rb +17 -0
- data/test/test_bio-restriction_enzyme.rb +21 -0
- metadata +153 -0
@@ -0,0 +1,87 @@
|
|
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'
|
4
|
+
require 'bio/util/restriction_enzyme/range/sequence_range/fragments'
|
5
|
+
require 'bio/util/restriction_enzyme/range/cut_range'
|
6
|
+
require 'bio/util/restriction_enzyme/range/horizontal_cut_range'
|
7
|
+
require 'bio/util/restriction_enzyme/range/vertical_cut_range'
|
8
|
+
require 'bio/util/restriction_enzyme/range/cut_ranges'
|
9
|
+
|
10
|
+
class TestBioRestrictionEnzymeAnalysisCutRanges < Test::Unit::TestCase
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@t = Bio::RestrictionEnzyme::Range::SequenceRange
|
14
|
+
@fs = Bio::RestrictionEnzyme::Range::SequenceRange::Fragments
|
15
|
+
#a.add_cut_range(p_cut_left, p_cut_right, c_cut_left, c_cut_right )
|
16
|
+
|
17
|
+
@vcr = Bio::RestrictionEnzyme::Range::VerticalCutRange
|
18
|
+
@crs = Bio::RestrictionEnzyme::Range::CutRanges
|
19
|
+
@hcr = Bio::RestrictionEnzyme::Range::HorizontalCutRange
|
20
|
+
|
21
|
+
@obj_2 = @crs.new( [@vcr.new(0,2,nil,nil), @vcr.new(3,nil,4,nil)] )
|
22
|
+
@obj_3 = @crs.new( [@vcr.new(0,2,nil,nil), @vcr.new(3,nil,4,nil), @hcr.new(0), @hcr.new(5)] )
|
23
|
+
@obj_7 = @crs.new( [@vcr.new(nil,2,nil,nil), @hcr.new(0,2)] )
|
24
|
+
@obj_z = @crs.new( [@vcr.new(nil,2,nil,5), @hcr.new(1,6)] )
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_obj_z
|
28
|
+
assert_equal(6, @obj_z.max)
|
29
|
+
assert_equal(1, @obj_z.min)
|
30
|
+
|
31
|
+
assert_equal(2, @obj_z.min_vertical)
|
32
|
+
assert_equal(5, @obj_z.max_vertical)
|
33
|
+
|
34
|
+
assert_equal(true, @obj_z.include?(6))
|
35
|
+
assert_equal(true, @obj_z.include?(4))
|
36
|
+
assert_equal(true, @obj_z.include?(2))
|
37
|
+
assert_equal(false, @obj_z.include?(-1))
|
38
|
+
assert_equal(false, @obj_z.include?(0))
|
39
|
+
assert_equal(false, @obj_z.include?(7))
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_obj_7
|
43
|
+
assert_equal(2, @obj_7.max)
|
44
|
+
assert_equal(0, @obj_7.min)
|
45
|
+
|
46
|
+
assert_equal(2, @obj_7.min_vertical)
|
47
|
+
assert_equal(2, @obj_7.max_vertical)
|
48
|
+
|
49
|
+
assert_equal(true, @obj_7.include?(0))
|
50
|
+
assert_equal(true, @obj_7.include?(1))
|
51
|
+
assert_equal(true, @obj_7.include?(2))
|
52
|
+
assert_equal(false, @obj_7.include?(-1))
|
53
|
+
assert_equal(false, @obj_7.include?(3))
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_obj_2
|
57
|
+
assert_equal(4, @obj_2.max)
|
58
|
+
assert_equal(0, @obj_2.min)
|
59
|
+
|
60
|
+
assert_equal(0, @obj_2.min_vertical)
|
61
|
+
assert_equal(4, @obj_2.max_vertical)
|
62
|
+
|
63
|
+
assert_equal(true, @obj_2.include?(0))
|
64
|
+
assert_equal(true, @obj_2.include?(1))
|
65
|
+
assert_equal(true, @obj_2.include?(3))
|
66
|
+
assert_equal(true, @obj_2.include?(4))
|
67
|
+
assert_equal(false, @obj_2.include?(-1))
|
68
|
+
assert_equal(false, @obj_2.include?(5))
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_obj_3
|
72
|
+
assert_equal(5, @obj_3.max)
|
73
|
+
assert_equal(0, @obj_3.min)
|
74
|
+
|
75
|
+
assert_equal(0, @obj_3.min_vertical)
|
76
|
+
assert_equal(4, @obj_3.max_vertical)
|
77
|
+
|
78
|
+
assert_equal(true, @obj_3.include?(0))
|
79
|
+
assert_equal(true, @obj_3.include?(1))
|
80
|
+
assert_equal(true, @obj_3.include?(3))
|
81
|
+
assert_equal(true, @obj_3.include?(4))
|
82
|
+
assert_equal(true, @obj_3.include?(5))
|
83
|
+
assert_equal(false, @obj_3.include?(-1))
|
84
|
+
assert_equal(false, @obj_3.include?(6))
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
@@ -0,0 +1,223 @@
|
|
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'
|
4
|
+
require 'bio/util/restriction_enzyme/range/sequence_range/fragments'
|
5
|
+
require 'bio/util/restriction_enzyme/range/cut_range'
|
6
|
+
require 'bio/util/restriction_enzyme/range/horizontal_cut_range'
|
7
|
+
require 'bio/util/restriction_enzyme/range/vertical_cut_range'
|
8
|
+
require 'bio/util/restriction_enzyme/range/cut_ranges'
|
9
|
+
|
10
|
+
class TestBioRestrictionEnzymeAnalysisSequenceRange < Test::Unit::TestCase
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@t = Bio::RestrictionEnzyme::Range::SequenceRange
|
14
|
+
@fs = Bio::RestrictionEnzyme::Range::SequenceRange::Fragments
|
15
|
+
#a.add_cut_range(p_cut_left, p_cut_right, c_cut_left, c_cut_right )
|
16
|
+
|
17
|
+
@vcr = Bio::RestrictionEnzyme::Range::VerticalCutRange
|
18
|
+
@crs = Bio::RestrictionEnzyme::Range::CutRanges
|
19
|
+
@hcr = Bio::RestrictionEnzyme::Range::HorizontalCutRange
|
20
|
+
|
21
|
+
@obj_1 = @t.new(0,5)
|
22
|
+
@obj_1.add_cut_range(0,nil,nil,3)
|
23
|
+
@obj_1.add_cut_range(nil,2,nil,nil)
|
24
|
+
|
25
|
+
@obj_2 = @t.new(0,5)
|
26
|
+
@obj_2.add_cut_ranges( @crs.new( [@vcr.new(0,2,nil,nil), @vcr.new(3,nil,4,nil)] ))
|
27
|
+
|
28
|
+
@obj_3 = @t.new(0,5)
|
29
|
+
@obj_3.add_cut_ranges( @crs.new( [@vcr.new(0,2,nil,nil), @vcr.new(3,nil,4,nil)] ))
|
30
|
+
@obj_3.add_cut_ranges( @crs.new( [@hcr.new(0), @hcr.new(5)] ))
|
31
|
+
|
32
|
+
@obj_4 = @t.new(0,5)
|
33
|
+
@obj_4.add_cut_ranges( @crs.new( [@vcr.new(0,2,1,3)] ))
|
34
|
+
|
35
|
+
@obj_5 = @t.new(0,5)
|
36
|
+
@obj_5.add_cut_ranges( @crs.new( [@vcr.new(0,nil,nil,nil), @vcr.new(nil,4,3,nil), @hcr.new(1,2)] ))
|
37
|
+
|
38
|
+
@obj_6 = @t.new(0,5)
|
39
|
+
@obj_6.add_cut_ranges( @crs.new( [@vcr.new(nil,nil,0,nil), @hcr.new(1,2), @vcr.new(nil,4,3,nil)] ))
|
40
|
+
|
41
|
+
@obj_7 = @t.new(0,5)
|
42
|
+
@obj_7.add_cut_ranges( @crs.new( [@vcr.new(nil,2,nil,nil), @hcr.new(0,2)] ))
|
43
|
+
|
44
|
+
@obj_8 = @t.new(0,11)
|
45
|
+
@obj_8.add_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)] ))
|
46
|
+
|
47
|
+
@obj_9 = @t.new(0,5)
|
48
|
+
@obj_9.add_cut_ranges( @crs.new( [@vcr.new(nil,3,nil,3)] ))
|
49
|
+
|
50
|
+
@obj_10 = @t.new(0,5)
|
51
|
+
@obj_10.add_cut_ranges( @crs.new( [@vcr.new(0,nil,nil,3), @vcr.new(nil,2,nil,2)] ))
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_fragments
|
55
|
+
assert_equal(@fs, @obj_1.fragments.class)
|
56
|
+
end
|
57
|
+
|
58
|
+
# '0|1 2|3 4 5'
|
59
|
+
# ' +---+-+ '
|
60
|
+
# '0 1 2 3|4 5'
|
61
|
+
def test_fragments_for_display_1
|
62
|
+
x = @obj_1
|
63
|
+
assert_equal(3, x.fragments.for_display.size)
|
64
|
+
|
65
|
+
assert_equal('0 ', x.fragments.for_display[0].primary)
|
66
|
+
assert_equal('0123', x.fragments.for_display[0].complement)
|
67
|
+
|
68
|
+
assert_equal('12', x.fragments.for_display[1].primary)
|
69
|
+
assert_equal(' ', x.fragments.for_display[1].complement)
|
70
|
+
|
71
|
+
assert_equal('345', x.fragments.for_display[2].primary)
|
72
|
+
assert_equal(' 45', x.fragments.for_display[2].complement)
|
73
|
+
end
|
74
|
+
|
75
|
+
# '0|1 2|3|4 5'
|
76
|
+
# ' +---+ +-+ '
|
77
|
+
# '0 1 2 3 4|5'
|
78
|
+
def test_fragments_for_display_2
|
79
|
+
x = @obj_2
|
80
|
+
assert_equal(3, x.fragments.for_display.size)
|
81
|
+
|
82
|
+
assert_equal('0 3 ', x.fragments.for_display[0].primary)
|
83
|
+
assert_equal('01234', x.fragments.for_display[0].complement)
|
84
|
+
|
85
|
+
assert_equal('12', x.fragments.for_display[1].primary)
|
86
|
+
assert_equal(' ', x.fragments.for_display[1].complement)
|
87
|
+
|
88
|
+
assert_equal('45', x.fragments.for_display[2].primary)
|
89
|
+
assert_equal(' 5', x.fragments.for_display[2].complement)
|
90
|
+
end
|
91
|
+
|
92
|
+
# '0|1 2|3|4 5'
|
93
|
+
# '-+---+ +-+-'
|
94
|
+
# '0 1 2 3 4|5'
|
95
|
+
def test_fragments_for_display_3
|
96
|
+
x = @obj_3
|
97
|
+
assert_equal(5, x.fragments.for_display.size)
|
98
|
+
|
99
|
+
assert_equal('0', x.fragments.for_display[0].primary)
|
100
|
+
assert_equal(' ', x.fragments.for_display[0].complement)
|
101
|
+
|
102
|
+
assert_equal(' 3 ', x.fragments.for_display[1].primary)
|
103
|
+
assert_equal('01234', x.fragments.for_display[1].complement)
|
104
|
+
|
105
|
+
assert_equal('12', x.fragments.for_display[2].primary)
|
106
|
+
assert_equal(' ', x.fragments.for_display[2].complement)
|
107
|
+
|
108
|
+
assert_equal('45', x.fragments.for_display[3].primary)
|
109
|
+
assert_equal(' ', x.fragments.for_display[3].complement)
|
110
|
+
|
111
|
+
assert_equal(' ', x.fragments.for_display[4].primary)
|
112
|
+
assert_equal('5', x.fragments.for_display[4].complement)
|
113
|
+
end
|
114
|
+
|
115
|
+
# '0|1 2|3 4 5'
|
116
|
+
# ' +-+-+-+ '
|
117
|
+
# '0 1|2 3|4 5'
|
118
|
+
def test_fragments_for_display_4
|
119
|
+
x = @obj_4
|
120
|
+
assert_equal(4, x.fragments.for_display.size)
|
121
|
+
|
122
|
+
assert_equal('0 ', x.fragments.for_display[0].primary)
|
123
|
+
assert_equal('01', x.fragments.for_display[0].complement)
|
124
|
+
|
125
|
+
assert_equal('12', x.fragments.for_display[1].primary)
|
126
|
+
assert_equal(' ', x.fragments.for_display[1].complement)
|
127
|
+
|
128
|
+
assert_equal(' ', x.fragments.for_display[2].primary)
|
129
|
+
assert_equal('23', x.fragments.for_display[2].complement)
|
130
|
+
|
131
|
+
assert_equal('345', x.fragments.for_display[3].primary)
|
132
|
+
assert_equal(' 45', x.fragments.for_display[3].complement)
|
133
|
+
end
|
134
|
+
|
135
|
+
# '0 1 2 3 4|5'
|
136
|
+
# ' +-+ '
|
137
|
+
# '0 1 2 3|4 5'
|
138
|
+
def test_fragments_for_display_5
|
139
|
+
x = @obj_5
|
140
|
+
assert_equal(2, x.fragments.for_display.size)
|
141
|
+
|
142
|
+
assert_equal('01234', x.fragments.for_display[0].primary)
|
143
|
+
assert_equal('0123 ', x.fragments.for_display[0].complement)
|
144
|
+
|
145
|
+
assert_equal(' 5', x.fragments.for_display[1].primary)
|
146
|
+
assert_equal('45', x.fragments.for_display[1].complement)
|
147
|
+
end
|
148
|
+
|
149
|
+
# '0 1 2 3 4|5'
|
150
|
+
# ' +-+ '
|
151
|
+
# '0 1 2 3|4 5'
|
152
|
+
def test_fragments_for_display_6
|
153
|
+
x = @obj_6
|
154
|
+
assert_equal(2, x.fragments.for_display.size)
|
155
|
+
|
156
|
+
assert_equal('01234', x.fragments.for_display[0].primary)
|
157
|
+
assert_equal('0123 ', x.fragments.for_display[0].complement)
|
158
|
+
|
159
|
+
assert_equal(' 5', x.fragments.for_display[1].primary)
|
160
|
+
assert_equal('45', x.fragments.for_display[1].complement)
|
161
|
+
end
|
162
|
+
|
163
|
+
# '0 1 2|3 4 5'
|
164
|
+
# '-----+ '
|
165
|
+
# '0 1 2 3 4 5'
|
166
|
+
def test_fragments_for_display_7
|
167
|
+
x = @obj_7
|
168
|
+
assert_equal(2, x.fragments.for_display.size)
|
169
|
+
|
170
|
+
assert_equal('012', x.fragments.for_display[0].primary)
|
171
|
+
assert_equal(' ', x.fragments.for_display[0].complement)
|
172
|
+
|
173
|
+
assert_equal(' 345', x.fragments.for_display[1].primary)
|
174
|
+
assert_equal('012345', x.fragments.for_display[1].complement)
|
175
|
+
end
|
176
|
+
|
177
|
+
|
178
|
+
# '0 1 2 3 4 5 6 7 8 9 0 1'
|
179
|
+
# ' '
|
180
|
+
# '0 1 2 3 4 5 6 7 8 9 0 1'
|
181
|
+
def test_fragments_for_display_8
|
182
|
+
x = @obj_8
|
183
|
+
assert_equal(1, x.fragments.for_display.size)
|
184
|
+
|
185
|
+
assert_equal('012345678901', x.fragments.for_display[0].primary)
|
186
|
+
assert_equal('012345678901', x.fragments.for_display[0].complement)
|
187
|
+
end
|
188
|
+
|
189
|
+
# '0 1 2 3|4 5'
|
190
|
+
# ' + '
|
191
|
+
# '0 1 2 3|4 5'
|
192
|
+
def test_fragments_for_display_9
|
193
|
+
x = @obj_9
|
194
|
+
assert_equal(2, x.fragments.for_display.size)
|
195
|
+
|
196
|
+
assert_equal('0123', x.fragments.for_display[0].primary)
|
197
|
+
assert_equal('0123', x.fragments.for_display[0].complement)
|
198
|
+
|
199
|
+
assert_equal('45', x.fragments.for_display[1].primary)
|
200
|
+
assert_equal('45', x.fragments.for_display[1].complement)
|
201
|
+
end
|
202
|
+
|
203
|
+
# '0|1 2|3 4 5'
|
204
|
+
# ' +---+-+ '
|
205
|
+
# '0 1 2|3|4 5'
|
206
|
+
def test_fragments_for_display_10
|
207
|
+
x = @obj_10
|
208
|
+
assert_equal(4, x.fragments.for_display.size)
|
209
|
+
|
210
|
+
assert_equal('0 ', x.fragments.for_display[0].primary)
|
211
|
+
assert_equal('012', x.fragments.for_display[0].complement)
|
212
|
+
|
213
|
+
assert_equal('12', x.fragments.for_display[1].primary)
|
214
|
+
assert_equal(' ', x.fragments.for_display[1].complement)
|
215
|
+
|
216
|
+
assert_equal('345', x.fragments.for_display[2].primary)
|
217
|
+
assert_equal(' 45', x.fragments.for_display[2].complement)
|
218
|
+
|
219
|
+
assert_equal(' ', x.fragments.for_display[3].primary)
|
220
|
+
assert_equal('3', x.fragments.for_display[3].complement)
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
load Pathname.new(File.join(File.dirname(__FILE__), ['..']*2, 'helper.rb')).cleanpath.to_s
|
2
|
+
|
3
|
+
require 'bio/sequence'
|
4
|
+
require 'bio/util/restriction_enzyme/double_stranded/aligned_strands'
|
5
|
+
require 'bio/util/restriction_enzyme/double_stranded'
|
6
|
+
|
7
|
+
class TestBioRestrictionEnzymeDoubleStrandedAlignedStrands < Test::Unit::TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@t = Bio::RestrictionEnzyme::DoubleStranded::AlignedStrands
|
11
|
+
@s = Bio::Sequence::NA
|
12
|
+
|
13
|
+
@ds = Bio::RestrictionEnzyme::DoubleStranded
|
14
|
+
|
15
|
+
@s_1 = @s.new('gattaca')
|
16
|
+
@s_2 = @s_1.forward_complement
|
17
|
+
|
18
|
+
@s_3 = @s.new('tttttttnnn')
|
19
|
+
@s_4 = @s.new('nnnaaaaaaa')
|
20
|
+
|
21
|
+
@ds_1 = @ds.new('nnnn^ngattacann^nn^n')
|
22
|
+
|
23
|
+
@obj_1 = @t.align(@s_1, @s_2)
|
24
|
+
@obj_2 = @t.align(@s_1, @s_3)
|
25
|
+
@obj_3 = @t.align(@s_1, @s_4)
|
26
|
+
@obj_4 = @t.align(@s_3, @s_4)
|
27
|
+
|
28
|
+
@obj_5 = @t.align(@ds_1.primary, @ds_1.complement)
|
29
|
+
|
30
|
+
@obj_8 = @t.align_with_cuts(@ds_1.primary, @ds_1.complement, @ds_1.primary.cut_locations, @ds_1.complement.cut_locations)
|
31
|
+
|
32
|
+
@obj_6 = @t.align_with_cuts(@s_1, @s_2, [1,2], [3,4])
|
33
|
+
@obj_7 = @t.align_with_cuts(@s_3, @s_4, [1,2], [3,4])
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_ds
|
38
|
+
assert_equal('nngattacannnnn', @ds_1.primary)
|
39
|
+
assert_equal('nnnnnctaatgtnn', @ds_1.complement)
|
40
|
+
assert_equal( 'n^ngattacann^nn^n', @ds_1.primary.with_cut_symbols)
|
41
|
+
assert_equal('n^nn^nnctaatgtn^n' , @ds_1.complement.with_cut_symbols)
|
42
|
+
|
43
|
+
assert_equal([0, 10, 12], @ds_1.primary.cut_locations)
|
44
|
+
assert_equal([0, 2, 12], @ds_1.complement.cut_locations)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_align
|
48
|
+
assert_equal('gattaca', @obj_1.primary)
|
49
|
+
assert_equal('ctaatgt', @obj_1.complement)
|
50
|
+
|
51
|
+
assert_equal('gattacannn', @obj_2.primary)
|
52
|
+
assert_equal('tttttttnnn', @obj_2.complement)
|
53
|
+
|
54
|
+
assert_equal('nnngattaca', @obj_3.primary)
|
55
|
+
assert_equal('nnnaaaaaaa', @obj_3.complement)
|
56
|
+
|
57
|
+
assert_equal('nnntttttttnnn', @obj_4.primary)
|
58
|
+
assert_equal('nnnaaaaaaannn', @obj_4.complement)
|
59
|
+
|
60
|
+
assert_equal('nnnnngattacannnnn', @obj_5.primary)
|
61
|
+
assert_equal('nnnnnctaatgtnnnnn', @obj_5.complement)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_align_with_cuts
|
65
|
+
assert_equal('g a^t^t a c a', @obj_6.primary)
|
66
|
+
assert_equal('c t a a^t^g t', @obj_6.complement)
|
67
|
+
|
68
|
+
# Looks incorrect at first, but this is deliberate.
|
69
|
+
# The correct cuts need to be supplied by the user.
|
70
|
+
assert_equal('n n n t t^t^t t t t n n n', @obj_7.primary)
|
71
|
+
assert_equal('n n n a^a^a a a a a n n n', @obj_7.complement)
|
72
|
+
|
73
|
+
assert_equal('n n n n^n g a t t a c a n n^n n^n', @obj_8.primary)
|
74
|
+
assert_equal('n^n n^n n c t a a t g t n^n n n n', @obj_8.complement)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_argument_error
|
78
|
+
assert_raise(ArgumentError) { @t.new('arg', 'agg') }
|
79
|
+
assert_raise(ArgumentError) { @t.new(@s.new('arg'), 'agg') }
|
80
|
+
assert_raise(ArgumentError) { @t.new('arg', @s.new('agg')) }
|
81
|
+
assert_raise(ArgumentError) { @t.new(@s.new('argg'), @s.new('agg')) }
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
load Pathname.new(File.join(File.dirname(__FILE__), ['..']*2, 'helper.rb')).cleanpath.to_s
|
2
|
+
|
3
|
+
require 'bio/util/restriction_enzyme/double_stranded/cut_location_pair'
|
4
|
+
|
5
|
+
class TestBioRestrictionEnzymeDoubleStrandedCutLocationPair < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@t = Bio::RestrictionEnzyme::DoubleStranded::CutLocationPair
|
9
|
+
|
10
|
+
@obj_1 = @t.new([3,5])
|
11
|
+
@obj_2 = @t.new(3, 5)
|
12
|
+
@obj_3 = @t.new((3..5))
|
13
|
+
@obj_4 = @t.new(0..5)
|
14
|
+
@obj_5 = @t.new(3)
|
15
|
+
@obj_6 = @t.new(nil,3)
|
16
|
+
@obj_7 = @t.new(3,nil)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_contents
|
20
|
+
assert_equal([3,5], @obj_1)
|
21
|
+
assert_equal([3,5], @obj_2)
|
22
|
+
assert_equal([3,5], @obj_3)
|
23
|
+
assert_equal([0,5], @obj_4)
|
24
|
+
assert_equal([3,nil], @obj_5)
|
25
|
+
assert_equal([nil,3], @obj_6)
|
26
|
+
assert_equal([3,nil], @obj_7)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_primary
|
30
|
+
assert_equal(3, @obj_1.primary)
|
31
|
+
assert_equal(3, @obj_2.primary)
|
32
|
+
assert_equal(3, @obj_3.primary)
|
33
|
+
assert_equal(0, @obj_4.primary)
|
34
|
+
assert_equal(3, @obj_5.primary)
|
35
|
+
assert_equal(nil, @obj_6.primary)
|
36
|
+
assert_equal(3, @obj_7.primary)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_complement
|
40
|
+
assert_equal(5, @obj_1.complement)
|
41
|
+
assert_equal(5, @obj_2.complement)
|
42
|
+
assert_equal(5, @obj_3.complement)
|
43
|
+
assert_equal(5, @obj_4.complement)
|
44
|
+
assert_equal(nil, @obj_5.complement)
|
45
|
+
assert_equal(3, @obj_6.complement)
|
46
|
+
assert_equal(nil, @obj_7.complement)
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def test_argument_error
|
51
|
+
assert_raise(ArgumentError) { @t.new([3,5,6]) }
|
52
|
+
assert_raise(ArgumentError) { @t.new(3,-1) }
|
53
|
+
assert_raise(ArgumentError) { @t.new(-3,1) }
|
54
|
+
assert_raise(ArgumentError) { @t.new(nil,nil) }
|
55
|
+
assert_raise(ArgumentError) { @t.new('3',5) }
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|