scaffolder 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/scaffolder/region/insert.rb +9 -1
- data/lib/scaffolder/region/sequence.rb +1 -3
- data/scaffolder.gemspec +1 -1
- data/test/test_insert.rb +25 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
@@ -40,7 +40,7 @@ class Scaffolder::Region::Insert < Scaffolder::Region
|
|
40
40
|
open-1..close-1
|
41
41
|
end
|
42
42
|
|
43
|
-
# Inserts are
|
43
|
+
# Inserts are comparable by close position.
|
44
44
|
#
|
45
45
|
# @return [Integer]
|
46
46
|
# @param [Scaffolder::Region::Insert]
|
@@ -48,4 +48,12 @@ class Scaffolder::Region::Insert < Scaffolder::Region
|
|
48
48
|
self.close <=> other.close
|
49
49
|
end
|
50
50
|
|
51
|
+
# The difference in the insert sequence size and the insert location
|
52
|
+
#
|
53
|
+
# @return [Integer]
|
54
|
+
def size_diff
|
55
|
+
insert_size = (close - open) + 1
|
56
|
+
sequence.length - insert_size
|
57
|
+
end
|
58
|
+
|
51
59
|
end
|
@@ -67,10 +67,8 @@ class Scaffolder::Region::Sequence < Scaffolder::Region
|
|
67
67
|
raise CoordinateError if insert.close < 1
|
68
68
|
raise CoordinateError if insert.open > insert.close
|
69
69
|
|
70
|
-
before_size = seq.length
|
71
70
|
seq[insert.position] = insert.sequence
|
72
|
-
|
73
|
-
stop(stop + diff)
|
71
|
+
@stop += insert.size_diff
|
74
72
|
|
75
73
|
seq
|
76
74
|
end
|
data/scaffolder.gemspec
CHANGED
data/test/test_insert.rb
CHANGED
@@ -35,6 +35,31 @@ class TestInsert < Test::Unit::TestCase
|
|
35
35
|
|
36
36
|
end
|
37
37
|
|
38
|
+
context "#size_diff" do
|
39
|
+
|
40
|
+
setup do
|
41
|
+
@insert = Scaffolder::Region::Insert.new
|
42
|
+
@insert.open 3
|
43
|
+
@insert.close 5
|
44
|
+
end
|
45
|
+
|
46
|
+
should "return a negative diff for a sequence smaller than insert site" do
|
47
|
+
@insert.raw_sequence 'TT'
|
48
|
+
assert(@insert.size_diff,-1)
|
49
|
+
end
|
50
|
+
|
51
|
+
should "return 0 for a sequence equal to the insert site" do
|
52
|
+
@insert.raw_sequence 'TT'
|
53
|
+
assert(@insert.size_diff,0)
|
54
|
+
end
|
55
|
+
|
56
|
+
should "return a positive diff for a sequence larger than insert site" do
|
57
|
+
@insert.raw_sequence 'TTTT'
|
58
|
+
assert(@insert.size_diff,1)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
38
63
|
should "be comparable by close position" do
|
39
64
|
a = Scaffolder::Region::Insert.new
|
40
65
|
a.close 1
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffolder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 3
|
10
|
+
version: 0.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Barton
|