bioinform 0.0.1 → 0.1.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 (61) hide show
  1. data/.gitignore +18 -17
  2. data/Gemfile +4 -4
  3. data/LICENSE +21 -21
  4. data/README.md +29 -29
  5. data/Rakefile +5 -12
  6. data/bioinform.gemspec +21 -21
  7. data/lib/bioinform/data_models/collection.rb +2 -0
  8. data/lib/bioinform/data_models/{iupac.rb → old_style_models_TO_BE_REMOVED/iupac.rb} +1 -1
  9. data/lib/bioinform/data_models/{iupac_word.rb → old_style_models_TO_BE_REMOVED/iupac_word.rb} +0 -0
  10. data/lib/bioinform/data_models/{positional_count_matrix.rb → old_style_models_TO_BE_REMOVED/positional_count_matrix.rb} +0 -0
  11. data/lib/bioinform/data_models/{positional_matrix.rb → old_style_models_TO_BE_REMOVED/positional_matrix.rb} +3 -5
  12. data/lib/bioinform/data_models/{positional_probability_matrix.rb → old_style_models_TO_BE_REMOVED/positional_probability_matrix.rb} +0 -0
  13. data/lib/bioinform/data_models/{positional_weight_matrix.rb → old_style_models_TO_BE_REMOVED/positional_weight_matrix.rb} +0 -0
  14. data/lib/bioinform/data_models/parser.rb +41 -0
  15. data/lib/bioinform/data_models/parsers/array_parser.rb +17 -0
  16. data/lib/bioinform/data_models/parsers/hash_parser.rb +19 -0
  17. data/lib/bioinform/data_models/parsers/string_fantom_parser.rb +21 -0
  18. data/lib/bioinform/data_models/parsers/string_parser.rb +45 -0
  19. data/lib/bioinform/data_models/parsers.rb +4 -0
  20. data/lib/bioinform/data_models/pcm.rb +7 -0
  21. data/lib/bioinform/data_models/pm.rb +195 -0
  22. data/lib/bioinform/data_models/ppm.rb +8 -0
  23. data/lib/bioinform/data_models/pwm.rb +23 -0
  24. data/lib/bioinform/data_models.rb +5 -5
  25. data/lib/bioinform/support/callable_symbol.rb +33 -4
  26. data/lib/bioinform/support/collect_hash.rb +7 -0
  27. data/lib/bioinform/support/curry_except_self.rb +2 -2
  28. data/lib/bioinform/support/deep_dup.rb +5 -0
  29. data/lib/bioinform/support/delete_many.rb +14 -0
  30. data/lib/bioinform/support/has_keys.rb +14 -0
  31. data/lib/bioinform/support/inverf.rb +13 -0
  32. data/lib/bioinform/support/partial_sums.rb +6 -0
  33. data/lib/bioinform/support/{same.rb → same_by.rb} +1 -1
  34. data/lib/bioinform/support.rb +13 -5
  35. data/lib/bioinform/version.rb +3 -3
  36. data/lib/bioinform.rb +8 -7
  37. data/spec/data_models/parser_spec.rb +46 -0
  38. data/spec/data_models/parsers/array_parser_spec.rb +53 -0
  39. data/spec/data_models/parsers/hash_parser_spec.rb +60 -0
  40. data/spec/data_models/parsers/string_fantom_parser_spec.rb +38 -0
  41. data/spec/data_models/parsers/string_parser_spec.rb +112 -0
  42. data/spec/data_models/pm_spec.rb +369 -0
  43. data/spec/data_models/pwm_spec.rb +25 -0
  44. data/spec/spec_helper.rb +30 -0
  45. data/spec/support/callable_symbol_spec.rb +66 -0
  46. data/spec/support/collect_hash_spec.rb +15 -0
  47. data/spec/support/curry_except_self_spec.rb +9 -0
  48. data/spec/support/delete_many_spec.rb +44 -0
  49. data/spec/support/has_keys_spec.rb +48 -0
  50. data/spec/support/inverf_spec.rb +19 -0
  51. data/spec/support/multiline_squish_spec.rb +11 -0
  52. data/spec/support/partial_sums_spec.rb +9 -0
  53. data/spec/support/same_by_spec.rb +36 -0
  54. metadata +60 -21
  55. data/lib/bioinform/support/pmap.rb +0 -10
  56. data/lib/bioinform/support/ptap.rb +0 -7
  57. data/spec/callable_symbol_spec.rb +0 -37
  58. data/spec/pmap_test.rb +0 -24
  59. data/spec/positional_matrix_spec.rb +0 -169
  60. data/spec/ptap_spec.rb +0 -17
  61. data/spec/same_spec.rb +0 -19
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+ require 'bioinform/support/same_by'
3
+
4
+ describe Enumerable do
5
+ describe '#same_by?' do
6
+ it 'should be work with both hashes and arrays' do
7
+ ['a','b','c'].same_by?{|k| k.length}
8
+ {'a'=>13,'b'=>12,'c'=>14}.same_by?{|k,v| v < 20}
9
+ end
10
+ it 'should be true for empty collections' do
11
+ [].same_by?(&:length).should be_true
12
+ [].same_by?.should be_true
13
+ end
14
+ context 'without block' do
15
+ it 'should compare if all elements of collection are the same' do
16
+ %w{cat cat cat}.same_by?.should be_true
17
+ %w{cat dog rat}.same_by?.should be_false
18
+ end
19
+ end
20
+ context 'with a block' do
21
+ it 'should compare enumerables by a value of block' do
22
+ %w{cat dog rat}.same_by?(&:length).should be_true
23
+ %w{cat dog rabbit}.same_by?(&:length).should be_false
24
+ end
25
+ it 'should be true if all elements are true' do
26
+ [4,8,2,2].same_by?(&:even?).should be_true
27
+ end
28
+ it 'should be true if all elements are false' do
29
+ [1,3,9,7].same_by?(&:even?).should be_true
30
+ end
31
+ it 'should be false if some elements are true and some are false' do
32
+ [1,8,3,2].same_by?(&:even?).should be_false
33
+ end
34
+ end
35
+ end
36
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bioinform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-30 00:00:00.000000000 Z
12
+ date: 2012-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: active_support
@@ -58,26 +58,53 @@ files:
58
58
  - bioinform.gemspec
59
59
  - lib/bioinform.rb
60
60
  - lib/bioinform/data_models.rb
61
- - lib/bioinform/data_models/iupac.rb
62
- - lib/bioinform/data_models/iupac_word.rb
63
- - lib/bioinform/data_models/positional_count_matrix.rb
64
- - lib/bioinform/data_models/positional_matrix.rb
65
- - lib/bioinform/data_models/positional_probability_matrix.rb
66
- - lib/bioinform/data_models/positional_weight_matrix.rb
61
+ - lib/bioinform/data_models/collection.rb
62
+ - lib/bioinform/data_models/old_style_models_TO_BE_REMOVED/iupac.rb
63
+ - lib/bioinform/data_models/old_style_models_TO_BE_REMOVED/iupac_word.rb
64
+ - lib/bioinform/data_models/old_style_models_TO_BE_REMOVED/positional_count_matrix.rb
65
+ - lib/bioinform/data_models/old_style_models_TO_BE_REMOVED/positional_matrix.rb
66
+ - lib/bioinform/data_models/old_style_models_TO_BE_REMOVED/positional_probability_matrix.rb
67
+ - lib/bioinform/data_models/old_style_models_TO_BE_REMOVED/positional_weight_matrix.rb
68
+ - lib/bioinform/data_models/parser.rb
69
+ - lib/bioinform/data_models/parsers.rb
70
+ - lib/bioinform/data_models/parsers/array_parser.rb
71
+ - lib/bioinform/data_models/parsers/hash_parser.rb
72
+ - lib/bioinform/data_models/parsers/string_fantom_parser.rb
73
+ - lib/bioinform/data_models/parsers/string_parser.rb
74
+ - lib/bioinform/data_models/pcm.rb
75
+ - lib/bioinform/data_models/pm.rb
76
+ - lib/bioinform/data_models/ppm.rb
77
+ - lib/bioinform/data_models/pwm.rb
67
78
  - lib/bioinform/support.rb
68
79
  - lib/bioinform/support/callable_symbol.rb
80
+ - lib/bioinform/support/collect_hash.rb
69
81
  - lib/bioinform/support/curry_except_self.rb
82
+ - lib/bioinform/support/deep_dup.rb
83
+ - lib/bioinform/support/delete_many.rb
84
+ - lib/bioinform/support/has_keys.rb
85
+ - lib/bioinform/support/inverf.rb
70
86
  - lib/bioinform/support/multiline_squish.rb
71
- - lib/bioinform/support/pmap.rb
72
- - lib/bioinform/support/ptap.rb
73
- - lib/bioinform/support/same.rb
87
+ - lib/bioinform/support/partial_sums.rb
88
+ - lib/bioinform/support/same_by.rb
74
89
  - lib/bioinform/support/yaml_dump_file.rb
75
90
  - lib/bioinform/version.rb
76
- - spec/callable_symbol_spec.rb
77
- - spec/pmap_test.rb
78
- - spec/positional_matrix_spec.rb
79
- - spec/ptap_spec.rb
80
- - spec/same_spec.rb
91
+ - spec/data_models/parser_spec.rb
92
+ - spec/data_models/parsers/array_parser_spec.rb
93
+ - spec/data_models/parsers/hash_parser_spec.rb
94
+ - spec/data_models/parsers/string_fantom_parser_spec.rb
95
+ - spec/data_models/parsers/string_parser_spec.rb
96
+ - spec/data_models/pm_spec.rb
97
+ - spec/data_models/pwm_spec.rb
98
+ - spec/spec_helper.rb
99
+ - spec/support/callable_symbol_spec.rb
100
+ - spec/support/collect_hash_spec.rb
101
+ - spec/support/curry_except_self_spec.rb
102
+ - spec/support/delete_many_spec.rb
103
+ - spec/support/has_keys_spec.rb
104
+ - spec/support/inverf_spec.rb
105
+ - spec/support/multiline_squish_spec.rb
106
+ - spec/support/partial_sums_spec.rb
107
+ - spec/support/same_by_spec.rb
81
108
  homepage: ''
82
109
  licenses: []
83
110
  post_install_message:
@@ -106,8 +133,20 @@ summary: Classes for work with different input formats of positional matrices an
106
133
  several useful extensions for Enumerable module like parametric map and callable
107
134
  symbols
108
135
  test_files:
109
- - spec/callable_symbol_spec.rb
110
- - spec/pmap_test.rb
111
- - spec/positional_matrix_spec.rb
112
- - spec/ptap_spec.rb
113
- - spec/same_spec.rb
136
+ - spec/data_models/parser_spec.rb
137
+ - spec/data_models/parsers/array_parser_spec.rb
138
+ - spec/data_models/parsers/hash_parser_spec.rb
139
+ - spec/data_models/parsers/string_fantom_parser_spec.rb
140
+ - spec/data_models/parsers/string_parser_spec.rb
141
+ - spec/data_models/pm_spec.rb
142
+ - spec/data_models/pwm_spec.rb
143
+ - spec/spec_helper.rb
144
+ - spec/support/callable_symbol_spec.rb
145
+ - spec/support/collect_hash_spec.rb
146
+ - spec/support/curry_except_self_spec.rb
147
+ - spec/support/delete_many_spec.rb
148
+ - spec/support/has_keys_spec.rb
149
+ - spec/support/inverf_spec.rb
150
+ - spec/support/multiline_squish_spec.rb
151
+ - spec/support/partial_sums_spec.rb
152
+ - spec/support/same_by_spec.rb
@@ -1,10 +0,0 @@
1
- require 'bioinform/support/curry_except_self'
2
-
3
- module Enumerable
4
- def pmap!(*args,&block)
5
- map! &block.curry_except_self(*args)
6
- end
7
- def pmap(*args,&block)
8
- dup.pmap!(*args, &block)
9
- end
10
- end
@@ -1,7 +0,0 @@
1
- require 'bioinform/support/curry_except_self'
2
- class Object
3
- def ptap(*args,&block)
4
- tap &block.curry_except_self(*args)
5
- end
6
- end
7
-
@@ -1,37 +0,0 @@
1
- require 'test/unit'
2
- require 'bioinform/support/callable_symbol'
3
-
4
- class TestEnumerablePmap < Test::Unit::TestCase
5
- def test_with_tap
6
- assert_equal ['abc','def','ghi'], ['abc','','','def','ghi'].tap(&:delete.(''))
7
-
8
- x = ['abc','','','def','ghi']
9
- assert_equal false, ['abc','def','ghi'].equal?(x.tap(&:delete.('')))
10
-
11
- x = ['abc','','','def','ghi']
12
- assert_equal true, x.equal?(x.tap(&:delete.('')))
13
-
14
- x = ['abc','','','def','ghi']
15
- assert_equal ['abc','','','def','ghi'], ['abc','','','def','ghi'].tap(&:to_s)
16
- end
17
-
18
- def test_pmap_bang_without_parameters
19
- x = [1,2,3]
20
- assert_equal x.map!(&:to_s), ['1', '2', '3']
21
- assert_equal x, ['1', '2', '3']
22
- end
23
- def test_with_map_bang_with_parameters
24
- y = [1,2,3]
25
- assert_equal y.map!(&:to_s.(2)), ['1', '10', '11']
26
- assert_equal y, ['1', '10', '11']
27
- end
28
- def test_with_map_without_bang
29
- x = [1,2,3]
30
- assert_equal x.map(&:to_s.(2)), ['1', '10', '11']
31
- assert_equal x, [1, 2, 3]
32
- end
33
- def test_one_more_with_map
34
- assert_equal [[1,2,3],[4,5,6]].map(&:join.(' ')).join("\n"), "1 2 3\n4 5 6"
35
- assert_equal [1,2,3,4,5].map(&:to_s.(2)), ['1', '10', '11', '100', '101']
36
- end
37
- end
data/spec/pmap_test.rb DELETED
@@ -1,24 +0,0 @@
1
- require 'test/unit'
2
- require 'bioinform/support/pmap'
3
-
4
- class TestEnumerablePmap < Test::Unit::TestCase
5
- def test_pmap_bang_without_parameters
6
- x = [1,2,3]
7
- assert_equal x.pmap!(&:to_s), ['1', '2', '3']
8
- assert_equal x, ['1', '2', '3']
9
- end
10
- def test_pmap_bang_with_parameters
11
- y = [1,2,3]
12
- assert_equal y.pmap!(2, &:to_s), ['1', '10', '11']
13
- assert_equal y, ['1', '10', '11']
14
- end
15
- def test_pmap_without_bang
16
- x = [1,2,3]
17
- assert_equal x.pmap(2, &:to_s), ['1', '10', '11']
18
- assert_equal x, [1, 2, 3]
19
- end
20
- def test_one_more_pmap
21
- assert_equal [[1,2,3],[4,5,6]].pmap(' ',&:join).join("\n"), "1 2 3\n4 5 6"
22
- assert_equal [1,2,3,4,5].pmap(2,&:to_s), ['1', '10', '11', '100', '101']
23
- end
24
- end
@@ -1,169 +0,0 @@
1
- require 'test/unit'
2
- require 'bioinform/data_models/positional_matrix'
3
-
4
- class PositionalMatrixTest < Test::Unit::TestCase
5
- def test_input_has_name
6
- m = PositionalMatrix.new <<-EOF
7
- > Testmatrix_1
8
- 1.23 4.56 1.2 1.0
9
- 1.45 1.23 1.48 1.9
10
- -5.6 7 4.56 10.1
11
- 4.13 -15.6 8.7 0.0
12
- 2.2 3.3 4.4 5.5
13
- EOF
14
- assert_equal m.matrix, [[1.23, 4.56, 1.2, 1.0], [1.45, 1.23, 1.48, 1.9], [-5.6, 7, 4.56, 10.1], [4.13, -15.6, 8.7, 0.0],[2.2, 3.3, 4.4, 5.5]]
15
- assert_equal m.name, 'Testmatrix_1'
16
- end
17
-
18
- def test_input_has_tabs_and_multiple_spaces_and_carriage_returns_at_eol
19
- m = PositionalMatrix.new <<-EOF
20
- 1.23\t4.56 1.2 1.0\r
21
- 1.45 1.23 1.48 1.9\r
22
- -5.6 7.8 4.56 10.1
23
- 4.13 -15.6\t\t8.7 0.0
24
- 2.2 3.3 4.4 5.5
25
- EOF
26
- assert_equal m.matrix, [[1.23, 4.56, 1.2, 1.0], [1.45, 1.23, 1.48, 1.9], [-5.6, 7.8, 4.56, 10.1], [4.13, -15.6, 8.7, 0.0],[2.2, 3.3, 4.4, 5.5]]
27
- end
28
-
29
- def test_input_has_finishing_and_leading_newlines
30
- m = PositionalMatrix.new <<-EOF
31
-
32
- > Testmatrix_1
33
- 1.23 4.56 1.2 1.0
34
- 1.45 1.23 1.48 1.9
35
- -5.6 7 4.56 10.1
36
- 4.13 -15.6 8.7 0.0
37
- 2.2 3.3 4.4 5.5
38
-
39
- EOF
40
- assert_equal m.matrix, [[1.23, 4.56, 1.2, 1.0], [1.45, 1.23, 1.48, 1.9], [-5.6, 7.0, 4.56, 10.1], [4.13, -15.6, 8.7, 0.0],[2.2, 3.3, 4.4, 5.5]]
41
- end
42
-
43
- def test_input_has_no_name
44
- m = PositionalMatrix.new <<-EOF
45
- 1.23 4.56 1.2 1.0
46
- 1.45 1.23 1.48 1.9
47
- -5.6 7 4.56 10.1
48
- 4.13 -15.6 8.7 0.0
49
- 2.2 3.3 4.4 5.5
50
- EOF
51
- assert_equal m.matrix, [[1.23, 4.56, 1.2, 1.0], [1.45, 1.23, 1.48, 1.9], [-5.6, 7.0, 4.56, 10.1], [4.13, -15.6, 8.7, 0.0],[2.2, 3.3, 4.4, 5.5]]
52
- assert_equal m.name, nil
53
- end
54
-
55
- def test_input_positions_as_rows
56
- m = PositionalMatrix.new <<-EOF
57
- Testmatrix-2
58
- 1.23 4.56 1.2 1.0 78 12.3
59
- 1.45 1.23 1.48 1.9 10.1 12.0
60
- -5.6 7 4.56 10.1 4 12
61
- 4.13 -15.6 8.7 0.0 1.1 5
62
- EOF
63
- assert_equal m.matrix, [[1.23, 1.45, -5.6, 4.13], [4.56, 1.23, 7.0, -15.6], [1.2, 1.48, 4.56, 8.7], [1.0, 1.9, 10.1, 0.0],[78, 10.1, 4.0, 1.1], [12.3, 12.0, 12.0, 5.0]]
64
- assert_equal m.name, 'Testmatrix-2'
65
- end
66
-
67
- def test_fails_on_nonnumeric_data
68
- assert_raise ArgumentError do
69
- m = PositionalMatrix.new <<-EOF
70
- 1.23ss 4.56ww 1.2 1.0
71
- 1.45zz 1.23 1.48 1.9
72
- -5.6 7 4.56 10.1
73
- 4.13 -15.6 8.7 0.0
74
- 2.2 3.3 4.4 5.5
75
- EOF
76
- end
77
- end
78
-
79
- def test_fails_on_different_row_size
80
- assert_raise ArgumentError do
81
- m = PositionalMatrix.new <<-EOF
82
- > Testmatrix_1
83
- 1.23 4.56 1.2 1.0
84
- 1.45 1.23 1.48
85
- -5.6 7 4.56 10.1
86
- 4.13 -15.6 8.7 0.0
87
- 2.2 3.3 4.4 5.5
88
- EOF
89
- end
90
- end
91
-
92
- def test_fails_if_either_row_nor_col_has_size_4
93
- assert_raise ArgumentError do
94
- m = PositionalMatrix.new <<-EOF
95
- 1 2 3 4 5
96
- 2 2 -2 2 2
97
- 3 3 3 3 3
98
- 4 -4 4 -4 -4
99
- 5 5 -5 -5 5
100
- EOF
101
- end
102
- end
103
-
104
- def test_to_s
105
- m = PositionalMatrix.new <<-EOF
106
- > Testmatrix_1
107
- 1.23 4.56 1.2 1.0
108
- 1.45 1.23 1.48 1.9
109
- -5.6 7 4.56 10.1
110
- 4.13 -15.6 8.7 0.0
111
- 2.2 3.3 4.4 5.5
112
- EOF
113
- assert_equal m.to_s, "Testmatrix_1\n1.23\t4.56\t1.2\t1.0\n1.45\t1.23\t1.48\t1.9\n-5.6\t7.0\t4.56\t10.1\n4.13\t-15.6\t8.7\t0.0\n2.2\t3.3\t4.4\t5.5"
114
- assert_equal m.to_s(false), "1.23\t4.56\t1.2\t1.0\n1.45\t1.23\t1.48\t1.9\n-5.6\t7.0\t4.56\t10.1\n4.13\t-15.6\t8.7\t0.0\n2.2\t3.3\t4.4\t5.5"
115
- end
116
-
117
- def test_pretty_string
118
- m = PositionalMatrix.new <<-EOF
119
- > Testmatrix_1
120
- 1.23 4.56 1.2 1.0
121
- 1.45 1.23 1.48 1.9
122
- -5.6 7 4.56 10.1
123
- 4.13 -15.6 8.7 0.0
124
- 2.2 3.3 4.4 5.5
125
- EOF
126
- assert_equal m.pretty_string, "Testmatrix_1\n A C G T \n 1.23 4.56 1.2 1.0\n 1.45 1.23 1.48 1.9\n -5.6 7.0 4.56 10.1\n 4.13 -15.6 8.7 0.0\n 2.2 3.3 4.4 5.5"
127
- assert_equal m.pretty_string(false), " A C G T \n 1.23 4.56 1.2 1.0\n 1.45 1.23 1.48 1.9\n -5.6 7.0 4.56 10.1\n 4.13 -15.6 8.7 0.0\n 2.2 3.3 4.4 5.5"
128
- end
129
-
130
- def test_to_hash
131
- m = PositionalMatrix.new <<-EOF
132
- > Testmatrix_1
133
- 1.23 4.56 1.2 1.0
134
- 1.45 1.23 1.48 1.9
135
- -5.6 7 4.56 10.1
136
- 4.13 -15.6 8.7 0.0
137
- 2.2 3.3 4.4 5.5
138
- EOF
139
- assert_equal m.to_hash, {A: [1.23, 1.45, -5.6, 4.13, 2.2], C:[4.56, 1.23, 7.0, -15.6, 3.3], G:[1.2, 1.48, 4.56, 8.7, 4.4], T:[1.0, 1.9, 10.1, 0.0, 5.5]}.with_indifferent_access
140
- end
141
-
142
- def test_hash_input
143
- m = PositionalMatrix.new(A: [1.23, 1.45, -5.6, 4.13, 2.2], C:[4.56, 1.23, 7, -15.6, 3.3],'G' => [1.2, 1.48, 4.56, 8.7, 4.4], 'T'=>[1.0, 1.9, 10.1, 0.0, 5.5])
144
- assert_equal m.matrix, [[1.23, 4.56, 1.2, 1.0], [1.45, 1.23, 1.48, 1.9], [-5.6, 7.0, 4.56, 10.1], [4.13, -15.6, 8.7, 0.0],[2.2, 3.3, 4.4, 5.5]]
145
- end
146
-
147
- def test_size
148
- m = PositionalMatrix.new(A: [1.23, 1.45, -5.6, 4.13, 2.2], C:[4.56, 1.23, 7, -15.6, 3.3],'G' => [1.2, 1.48, 4.56, 8.7, 4.4], 'T'=>[1.0, 1.9, 10.1, 0.0, 5.5])
149
- assert_equal m.size, 5
150
- assert_equal m.length, m.size
151
- end
152
-
153
- def test_fantom_parser
154
- input = <<-EOS
155
- NA motif_CTNCAG
156
- P0 A C G T
157
- P1 0 1878368 0 0
158
- P2 0 0 0 1878368
159
- P3 469592 469592 469592 469592
160
- P4 0 1878368 0 0
161
- P5 1878368 0 0 0
162
- P6 0 0 1878368 0
163
- EOS
164
- m = PositionalMatrix.new input, PositionalMatrix::FantomParser
165
- assert_equal 'motif_CTNCAG', m.name
166
- assert_equal [[0,1878368,0,0],[0,0,0,1878368],[469592,469592,469592,469592],[0,1878368,0,0],[1878368,0,0,0],[0,0,1878368,0]], m.matrix
167
- end
168
-
169
- end
data/spec/ptap_spec.rb DELETED
@@ -1,17 +0,0 @@
1
- require 'test/unit'
2
- require 'bioinform/support/ptap'
3
-
4
- class TestEnumerablePmap < Test::Unit::TestCase
5
- def test_ptap
6
- assert_equal ['abc','def','ghi'], ['abc','','','def','ghi'].ptap('',&:delete)
7
-
8
- x = ['abc','','','def','ghi']
9
- assert_equal false, ['abc','def','ghi'].equal?(x.ptap('',&:delete))
10
-
11
- x = ['abc','','','def','ghi']
12
- assert_equal true, x.equal?(x.ptap('',&:delete))
13
-
14
- x = ['abc','','','def','ghi']
15
- assert_equal ['abc','','','def','ghi'], ['abc','','','def','ghi'].ptap(&:to_s)
16
- end
17
- end
data/spec/same_spec.rb DELETED
@@ -1,19 +0,0 @@
1
- require 'test/unit'
2
- require 'bioinform/support/same'
3
-
4
- class TestEnumerableSame < Test::Unit::TestCase
5
- def test_same
6
- assert_equal(true, [1,3,9,7].same?(&:even?))
7
- assert_equal(true, [4,8,2,2].same?(&:even?))
8
- assert_equal(false, [1,8,3,2].same?(&:even?))
9
-
10
- assert_equal(true, %w{cat dog rat}.same?(&:length))
11
- assert_equal(false, %w{cat dog rabbit}.same?(&:length))
12
-
13
- assert_equal(true, %w{cat cat cat}.same?)
14
- assert_equal(false, %w{cat dog rat}.same?)
15
-
16
- assert_equal(true, [].same?(&:length))
17
- assert_equal(true, [].same?)
18
- end
19
- end