macroape 4.0.2 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -17
- data/Gemfile +4 -4
- data/LICENSE +22 -22
- data/README.md +70 -70
- data/Rakefile.rb +49 -49
- data/TODO.txt +46 -46
- data/benchmark/benchmark_helper.rb +4 -4
- data/benchmark/similarity_benchmark.rb +52 -52
- data/bin/align_motifs +4 -4
- data/bin/eval_alignment +4 -4
- data/bin/eval_similarity +4 -4
- data/bin/find_pvalue +4 -4
- data/bin/find_threshold +4 -4
- data/bin/preprocess_collection +4 -4
- data/bin/scan_collection +4 -4
- data/lib/macroape.rb +14 -11
- data/lib/macroape/aligned_pair_intersection.rb +61 -62
- data/lib/macroape/cli.rb +191 -188
- data/lib/macroape/cli/align_motifs.rb +120 -100
- data/lib/macroape/cli/eval_alignment.rb +157 -156
- data/lib/macroape/cli/eval_similarity.rb +138 -137
- data/lib/macroape/cli/find_pvalue.rb +93 -87
- data/lib/macroape/cli/find_threshold.rb +103 -96
- data/lib/macroape/cli/preprocess_collection.rb +169 -161
- data/lib/macroape/cli/scan_collection.rb +171 -163
- data/lib/macroape/collection.rb +29 -0
- data/lib/macroape/motif_with_thresholds.rb +18 -0
- data/lib/macroape/pwm_compare.rb +39 -44
- data/lib/macroape/pwm_compare_aligned.rb +139 -130
- data/lib/macroape/{counting.rb → pwm_counting.rb} +175 -121
- data/lib/macroape/support/inverf.rb +13 -0
- data/lib/macroape/support/partial_sums.rb +17 -0
- data/lib/macroape/version.rb +4 -4
- data/macroape.gemspec +19 -19
- data/spec/count_distribution_spec.rb +112 -109
- data/spec/inverf_spec.rb +23 -0
- data/spec/partial_sums_spec.rb +28 -0
- data/spec/spec_helper.rb +11 -11
- data/test/align_motifs_test.rb +42 -43
- data/test/data/AHR_si.pwm +10 -10
- data/test/data/KLF3_f1.pcm +16 -16
- data/test/data/KLF3_f1.pwm +16 -16
- data/test/data/KLF4_f2.pcm +11 -11
- data/test/data/KLF4_f2.pwm +11 -11
- data/test/data/KLF4_f2_scan_results_all.txt +2 -2
- data/test/data/KLF4_f2_scan_results_default_cutoff.txt +1 -1
- data/test/data/KLF4_f2_scan_results_precise_mode.txt +2 -2
- data/test/data/SP1_f1.pcm +12 -12
- data/test/data/SP1_f1.pwm +12 -12
- data/test/data/SP1_f1_revcomp.pcm +12 -12
- data/test/data/SP1_f1_revcomp.pwm +12 -12
- data/test/data/medium_motif.pwm +8 -8
- data/test/data/short_motif.pwm +7 -7
- data/test/data/test_collection.yaml +231 -214
- data/test/data/test_collection/GABPA_f1.pwm +14 -14
- data/test/data/test_collection/KLF4_f2.pwm +10 -10
- data/test/data/test_collection/SP1_f1.pwm +12 -12
- data/test/data/test_collection_pcm/GABPA_f1.pcm +14 -14
- data/test/data/test_collection_pcm/KLF4_f2.pcm +11 -11
- data/test/data/test_collection_pcm/SP1_f1.pcm +12 -12
- data/test/data/test_collection_single_file.txt +38 -38
- data/test/data/test_collection_single_file_pcm.txt +37 -37
- data/test/data/test_collection_weak.yaml +231 -214
- data/test/eval_alignment_test.rb +90 -111
- data/test/eval_similarity_test.rb +105 -123
- data/test/find_pvalue_test.rb +34 -39
- data/test/find_threshold_test.rb +87 -91
- data/test/preprocess_collection_test.rb +56 -65
- data/test/scan_collection_test.rb +42 -48
- data/test/test_helper.rb +159 -160
- metadata +14 -10
- data/test/data/collection_pcm_without_thresholds.yaml +0 -188
- data/test/data/collection_without_thresholds.yaml +0 -188
data/test/eval_alignment_test.rb
CHANGED
@@ -1,111 +1,90 @@
|
|
1
|
-
require_relative 'test_helper'
|
2
|
-
|
3
|
-
class TestEvalAlignment < Test::Unit::TestCase
|
4
|
-
include Helpers
|
5
|
-
def setup
|
6
|
-
@start_dir = Dir.pwd
|
7
|
-
Dir.chdir File.join(File.dirname(__FILE__), 'data')
|
8
|
-
end
|
9
|
-
def teardown
|
10
|
-
Dir.chdir(@start_dir)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_process_weak_threshold
|
14
|
-
assert_similarity_info_output({similarity: 0.24382446963092125,
|
15
|
-
distance: 0.7561755303690787,
|
16
|
-
length: 11,
|
17
|
-
shift: -1,
|
18
|
-
orientation: 'direct',
|
19
|
-
words_recognized_by_both: 839.0,
|
20
|
-
threshold_first: 5.8,
|
21
|
-
words_recognized_by_first: 2104.0,
|
22
|
-
pvalue_recognized_by_first: 0.0005016326904296875,
|
23
|
-
threshold_second: 5.6,
|
24
|
-
words_recognized_by_second: 2176.0,
|
25
|
-
pvalue_recognized_by_second: 0.000518798828125,
|
26
|
-
matrix_first_alignment: '.>>>>>>>>>>',
|
27
|
-
matrix_second_alignment: '>>>>>>>>>>>' #, discretization: 10.0
|
28
|
-
},
|
29
|
-
Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm -1 direct'))
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
def test_process_strong_threshold
|
34
|
-
assert_similarity_info_output({similarity: 0.2420758234928527,
|
35
|
-
distance: 0.7579241765071473,
|
36
|
-
length: 11,
|
37
|
-
shift: -1,
|
38
|
-
orientation: 'direct',
|
39
|
-
words_recognized_by_both: 779.0,
|
40
|
-
threshold_first: 5.8100000000000005,
|
41
|
-
words_recognized_by_first: 1964.0,
|
42
|
-
pvalue_recognized_by_first: 0.00046825408935546875,
|
43
|
-
threshold_second: 5.61,
|
44
|
-
words_recognized_by_second: 2033.0,
|
45
|
-
pvalue_recognized_by_second: 0.00048470497131347656,
|
46
|
-
matrix_first_alignment: '.>>>>>>>>>>',
|
47
|
-
matrix_second_alignment: '>>>>>>>>>>>' #, discretization: 10.0
|
48
|
-
},
|
49
|
-
Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm -1 direct --boundary lower'))
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_process_custom_thresholds
|
53
|
-
assert_similarity_info_output({similarity: 0.28505023241865346,
|
54
|
-
words_recognized_by_both: 1901.0,
|
55
|
-
words_recognized_by_first: 4348.0,
|
56
|
-
words_recognized_by_second: 4222.0,
|
57
|
-
# threshold_first: 4.7,
|
58
|
-
# threshold_second: 4.6
|
59
|
-
},
|
60
|
-
Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm -1 direct --first-threshold 4.7 --second-threshold 4.6'))
|
61
|
-
end
|
62
|
-
def test_process_not_optimal_alignment
|
63
|
-
assert_similarity_info_output({similarity: 0.004517983923018248,
|
64
|
-
length: 12,
|
65
|
-
words_recognized_by_both: 77.0,
|
66
|
-
words_recognized_by_first: 8416.0,
|
67
|
-
words_recognized_by_second: 8704.0,
|
68
|
-
matrix_first_alignment: '>>>>>>>>>>..',
|
69
|
-
matrix_second_alignment: '.>>>>>>>>>>>',
|
70
|
-
shift: 1,
|
71
|
-
orientation: 'direct'},
|
72
|
-
Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm 1 direct'))
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_process_at_optimal_alignment_reversed
|
76
|
-
assert_similarity_info_output({similarity: 0.0,
|
77
|
-
words_recognized_by_both: 0.0,
|
78
|
-
length: 11,
|
79
|
-
matrix_first_alignment: '.>>>>>>>>>>',
|
80
|
-
matrix_second_alignment:'<<<<<<<<<<<',
|
81
|
-
shift: -1,
|
82
|
-
orientation: 'revcomp'},
|
83
|
-
Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm -1 revcomp'))
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_process_pcm_files
|
87
|
-
assert_equal( Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm -1 direct'),
|
88
|
-
Helpers.eval_alignment_output('KLF4_f2.pcm SP1_f1.pcm -1 direct --pcm'))
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_process_alignment_first_motif_from_stdin
|
92
|
-
result = Helpers.provide_stdin(File.read('KLF4_f2.pwm')) {
|
93
|
-
Helpers.eval_alignment_output('.stdin SP1_f1.pwm 0 direct') }
|
94
|
-
assert_equal( Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm 0 direct'),
|
95
|
-
result )
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_process_alignment_second_motif_from_stdin
|
99
|
-
result = Helpers.provide_stdin(File.read('SP1_f1.pwm')) {
|
100
|
-
Helpers.eval_alignment_output('KLF4_f2.pwm .stdin 0 direct') }
|
101
|
-
assert_equal( Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm 0 direct'),
|
102
|
-
result )
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_process_alignment_both_motifs_from_stdin
|
106
|
-
result = Helpers.provide_stdin(File.read('KLF4_f2.pwm') + File.read('SP1_f1.pwm')) {
|
107
|
-
Helpers.eval_alignment_output('.stdin .stdin 0 direct') }
|
108
|
-
assert_equal( Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm 0 direct'),
|
109
|
-
result )
|
110
|
-
end
|
111
|
-
end
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class TestEvalAlignment < Test::Unit::TestCase
|
4
|
+
include Helpers
|
5
|
+
def setup
|
6
|
+
@start_dir = Dir.pwd
|
7
|
+
Dir.chdir File.join(File.dirname(__FILE__), 'data')
|
8
|
+
end
|
9
|
+
def teardown
|
10
|
+
Dir.chdir(@start_dir)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_process_weak_threshold
|
14
|
+
assert_similarity_info_output({similarity: 0.24382446963092125,
|
15
|
+
distance: 0.7561755303690787,
|
16
|
+
length: 11,
|
17
|
+
shift: -1,
|
18
|
+
orientation: 'direct',
|
19
|
+
words_recognized_by_both: 839.0,
|
20
|
+
threshold_first: 5.8,
|
21
|
+
words_recognized_by_first: 2104.0,
|
22
|
+
pvalue_recognized_by_first: 0.0005016326904296875,
|
23
|
+
threshold_second: 5.6,
|
24
|
+
words_recognized_by_second: 2176.0,
|
25
|
+
pvalue_recognized_by_second: 0.000518798828125,
|
26
|
+
matrix_first_alignment: '.>>>>>>>>>>',
|
27
|
+
matrix_second_alignment: '>>>>>>>>>>>' #, discretization: 10.0
|
28
|
+
},
|
29
|
+
Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm -1 direct'))
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def test_process_strong_threshold
|
34
|
+
assert_similarity_info_output({similarity: 0.2420758234928527,
|
35
|
+
distance: 0.7579241765071473,
|
36
|
+
length: 11,
|
37
|
+
shift: -1,
|
38
|
+
orientation: 'direct',
|
39
|
+
words_recognized_by_both: 779.0,
|
40
|
+
threshold_first: 5.8100000000000005,
|
41
|
+
words_recognized_by_first: 1964.0,
|
42
|
+
pvalue_recognized_by_first: 0.00046825408935546875,
|
43
|
+
threshold_second: 5.61,
|
44
|
+
words_recognized_by_second: 2033.0,
|
45
|
+
pvalue_recognized_by_second: 0.00048470497131347656,
|
46
|
+
matrix_first_alignment: '.>>>>>>>>>>',
|
47
|
+
matrix_second_alignment: '>>>>>>>>>>>' #, discretization: 10.0
|
48
|
+
},
|
49
|
+
Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm -1 direct --boundary lower'))
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_process_custom_thresholds
|
53
|
+
assert_similarity_info_output({similarity: 0.28505023241865346,
|
54
|
+
words_recognized_by_both: 1901.0,
|
55
|
+
words_recognized_by_first: 4348.0,
|
56
|
+
words_recognized_by_second: 4222.0,
|
57
|
+
# threshold_first: 4.7,
|
58
|
+
# threshold_second: 4.6
|
59
|
+
},
|
60
|
+
Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm -1 direct --first-threshold 4.7 --second-threshold 4.6'))
|
61
|
+
end
|
62
|
+
def test_process_not_optimal_alignment
|
63
|
+
assert_similarity_info_output({similarity: 0.004517983923018248,
|
64
|
+
length: 12,
|
65
|
+
words_recognized_by_both: 77.0,
|
66
|
+
words_recognized_by_first: 8416.0,
|
67
|
+
words_recognized_by_second: 8704.0,
|
68
|
+
matrix_first_alignment: '>>>>>>>>>>..',
|
69
|
+
matrix_second_alignment: '.>>>>>>>>>>>',
|
70
|
+
shift: 1,
|
71
|
+
orientation: 'direct'},
|
72
|
+
Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm 1 direct'))
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_process_at_optimal_alignment_reversed
|
76
|
+
assert_similarity_info_output({similarity: 0.0,
|
77
|
+
words_recognized_by_both: 0.0,
|
78
|
+
length: 11,
|
79
|
+
matrix_first_alignment: '.>>>>>>>>>>',
|
80
|
+
matrix_second_alignment:'<<<<<<<<<<<',
|
81
|
+
shift: -1,
|
82
|
+
orientation: 'revcomp'},
|
83
|
+
Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm -1 revcomp'))
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_process_pcm_files
|
87
|
+
assert_equal( Helpers.eval_alignment_output('KLF4_f2.pwm SP1_f1.pwm -1 direct'),
|
88
|
+
Helpers.eval_alignment_output('KLF4_f2.pcm SP1_f1.pcm -1 direct --pcm'))
|
89
|
+
end
|
90
|
+
end
|
@@ -1,123 +1,105 @@
|
|
1
|
-
require_relative 'test_helper'
|
2
|
-
|
3
|
-
class TestEvalSimilarity < Test::Unit::TestCase
|
4
|
-
include Helpers
|
5
|
-
def setup
|
6
|
-
@start_dir = Dir.pwd
|
7
|
-
Dir.chdir File.join(File.dirname(__FILE__), 'data')
|
8
|
-
end
|
9
|
-
def teardown
|
10
|
-
Dir.chdir(@start_dir)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_process_strong_thresholds
|
14
|
-
assert_similarity_info_output({similarity: 0.2420758234928527,
|
15
|
-
distance: 0.7579241765071473,
|
16
|
-
length: 11,
|
17
|
-
shift: -1,
|
18
|
-
orientation: 'direct',
|
19
|
-
words_recognized_by_both: 779.0,
|
20
|
-
threshold_first: 5.8100000000000005,
|
21
|
-
words_recognized_by_first: 1964.0,
|
22
|
-
pvalue_recognized_by_first: 0.00046825408935546875,
|
23
|
-
threshold_second: 5.61,
|
24
|
-
words_recognized_by_second: 2033.0,
|
25
|
-
pvalue_recognized_by_second: 0.00048470497131347656,
|
26
|
-
matrix_first_alignment: '.>>>>>>>>>>',
|
27
|
-
matrix_second_alignment: '>>>>>>>>>>>' #, discretization: 10.0
|
28
|
-
},
|
29
|
-
Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm --boundary lower'))
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_process_weak_thresholds
|
33
|
-
assert_similarity_info_output({similarity: 0.24382446963092125,
|
34
|
-
distance: 0.7561755303690787,
|
35
|
-
length: 11,
|
36
|
-
shift: -1,
|
37
|
-
orientation: 'direct',
|
38
|
-
words_recognized_by_both: 839.0,
|
39
|
-
threshold_first: 5.8,
|
40
|
-
words_recognized_by_first: 2104.0,
|
41
|
-
pvalue_recognized_by_first: 0.0005016326904296875,
|
42
|
-
threshold_second: 5.6,
|
43
|
-
words_recognized_by_second: 2176.0,
|
44
|
-
pvalue_recognized_by_second: 0.000518798828125,
|
45
|
-
matrix_first_alignment: '.>>>>>>>>>>',
|
46
|
-
matrix_second_alignment: '>>>>>>>>>>>' #, discretization: 10.0
|
47
|
-
},
|
48
|
-
Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm'))
|
49
|
-
end
|
50
|
-
def test_process_custom_threshold
|
51
|
-
assert_similarity_info_output({similarity: 0.28505023241865346,
|
52
|
-
words_recognized_by_both: 1901.0,
|
53
|
-
words_recognized_by_first: 4348.0,
|
54
|
-
words_recognized_by_second: 4222.0,
|
55
|
-
# threshold_first: 4.7,
|
56
|
-
# threshold_second: 4.6
|
57
|
-
},
|
58
|
-
Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm --first-threshold 4.7 --second-threshold 4.6'))
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_process_dissimilar_pair_of_pwms
|
62
|
-
assert_similarity_info_output({similarity: 0.0037332005973120955,
|
63
|
-
words_recognized_by_both: 15.0,
|
64
|
-
words_recognized_by_first: 2033.0,
|
65
|
-
words_recognized_by_second: 2000.0,
|
66
|
-
length: 11,
|
67
|
-
matrix_first_alignment: '>>>>>>>>>>>',
|
68
|
-
matrix_second_alignment: '.>>>>>>>>>.',
|
69
|
-
shift: 1,
|
70
|
-
orientation: 'direct'},
|
71
|
-
Helpers.eval_similarity_output('SP1_f1.pwm AHR_si.pwm --boundary lower'))
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_recognize_orientation_of_alignment
|
75
|
-
assert_similarity_info_output({similarity: 1.0,
|
76
|
-
words_recognized_by_both: 2176.0,
|
77
|
-
words_recognized_by_first: 2176.0,
|
78
|
-
words_recognized_by_second: 2176.0,
|
79
|
-
length: 11,
|
80
|
-
matrix_first_alignment: '>>>>>>>>>>>',
|
81
|
-
matrix_second_alignment: '<<<<<<<<<<<',
|
82
|
-
shift: 0,
|
83
|
-
orientation: 'revcomp'},
|
84
|
-
Helpers.eval_similarity_output('SP1_f1_revcomp.pwm SP1_f1.pwm'))
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_process_custom_discretization
|
88
|
-
assert_similarity_info_output({similarity: 0.2580456407255705,
|
89
|
-
words_recognized_by_both: 1323.0,
|
90
|
-
words_recognized_by_first: 3554.0,
|
91
|
-
words_recognized_by_second: 2896.0,
|
92
|
-
length: 11,
|
93
|
-
matrix_first_alignment: '>>>>>>>>>>>',
|
94
|
-
matrix_second_alignment: '.>>>>>>>>>>',
|
95
|
-
shift: 1,
|
96
|
-
orientation: 'direct' #, discretization: 1.0
|
97
|
-
},
|
98
|
-
Helpers.eval_similarity_output('SP1_f1.pwm KLF4_f2.pwm -d 1'))
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_process_pcm_files
|
102
|
-
assert_equal( Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm'),
|
103
|
-
Helpers.eval_similarity_output('KLF4_f2.pcm SP1_f1.pcm --pcm'))
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_process_first_motif_from_stdin
|
107
|
-
result = Helpers.provide_stdin(File.read('KLF4_f2.pwm')){
|
108
|
-
Helpers.eval_similarity_output('.stdin SP1_f1.pwm') }
|
109
|
-
assert_equal(Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm'), result)
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_process_second_motif_from_stdin
|
113
|
-
result = Helpers.provide_stdin(File.read('SP1_f1.pwm')){
|
114
|
-
Helpers.eval_similarity_output('KLF4_f2.pwm .stdin') }
|
115
|
-
assert_equal(Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm'), result)
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_process_both_motifs_from_stdin
|
119
|
-
result = Helpers.provide_stdin(File.read('KLF4_f2.pwm') + File.read('SP1_f1.pwm')){
|
120
|
-
Helpers.eval_similarity_output('.stdin .stdin') }
|
121
|
-
assert_equal(Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm'), result)
|
122
|
-
end
|
123
|
-
end
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class TestEvalSimilarity < Test::Unit::TestCase
|
4
|
+
include Helpers
|
5
|
+
def setup
|
6
|
+
@start_dir = Dir.pwd
|
7
|
+
Dir.chdir File.join(File.dirname(__FILE__), 'data')
|
8
|
+
end
|
9
|
+
def teardown
|
10
|
+
Dir.chdir(@start_dir)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_process_strong_thresholds
|
14
|
+
assert_similarity_info_output({similarity: 0.2420758234928527,
|
15
|
+
distance: 0.7579241765071473,
|
16
|
+
length: 11,
|
17
|
+
shift: -1,
|
18
|
+
orientation: 'direct',
|
19
|
+
words_recognized_by_both: 779.0,
|
20
|
+
threshold_first: 5.8100000000000005,
|
21
|
+
words_recognized_by_first: 1964.0,
|
22
|
+
pvalue_recognized_by_first: 0.00046825408935546875,
|
23
|
+
threshold_second: 5.61,
|
24
|
+
words_recognized_by_second: 2033.0,
|
25
|
+
pvalue_recognized_by_second: 0.00048470497131347656,
|
26
|
+
matrix_first_alignment: '.>>>>>>>>>>',
|
27
|
+
matrix_second_alignment: '>>>>>>>>>>>' #, discretization: 10.0
|
28
|
+
},
|
29
|
+
Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm --boundary lower'))
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_process_weak_thresholds
|
33
|
+
assert_similarity_info_output({similarity: 0.24382446963092125,
|
34
|
+
distance: 0.7561755303690787,
|
35
|
+
length: 11,
|
36
|
+
shift: -1,
|
37
|
+
orientation: 'direct',
|
38
|
+
words_recognized_by_both: 839.0,
|
39
|
+
threshold_first: 5.8,
|
40
|
+
words_recognized_by_first: 2104.0,
|
41
|
+
pvalue_recognized_by_first: 0.0005016326904296875,
|
42
|
+
threshold_second: 5.6,
|
43
|
+
words_recognized_by_second: 2176.0,
|
44
|
+
pvalue_recognized_by_second: 0.000518798828125,
|
45
|
+
matrix_first_alignment: '.>>>>>>>>>>',
|
46
|
+
matrix_second_alignment: '>>>>>>>>>>>' #, discretization: 10.0
|
47
|
+
},
|
48
|
+
Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm'))
|
49
|
+
end
|
50
|
+
def test_process_custom_threshold
|
51
|
+
assert_similarity_info_output({similarity: 0.28505023241865346,
|
52
|
+
words_recognized_by_both: 1901.0,
|
53
|
+
words_recognized_by_first: 4348.0,
|
54
|
+
words_recognized_by_second: 4222.0,
|
55
|
+
# threshold_first: 4.7,
|
56
|
+
# threshold_second: 4.6
|
57
|
+
},
|
58
|
+
Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm --first-threshold 4.7 --second-threshold 4.6'))
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_process_dissimilar_pair_of_pwms
|
62
|
+
assert_similarity_info_output({similarity: 0.0037332005973120955,
|
63
|
+
words_recognized_by_both: 15.0,
|
64
|
+
words_recognized_by_first: 2033.0,
|
65
|
+
words_recognized_by_second: 2000.0,
|
66
|
+
length: 11,
|
67
|
+
matrix_first_alignment: '>>>>>>>>>>>',
|
68
|
+
matrix_second_alignment: '.>>>>>>>>>.',
|
69
|
+
shift: 1,
|
70
|
+
orientation: 'direct'},
|
71
|
+
Helpers.eval_similarity_output('SP1_f1.pwm AHR_si.pwm --boundary lower'))
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_recognize_orientation_of_alignment
|
75
|
+
assert_similarity_info_output({similarity: 1.0,
|
76
|
+
words_recognized_by_both: 2176.0,
|
77
|
+
words_recognized_by_first: 2176.0,
|
78
|
+
words_recognized_by_second: 2176.0,
|
79
|
+
length: 11,
|
80
|
+
matrix_first_alignment: '>>>>>>>>>>>',
|
81
|
+
matrix_second_alignment: '<<<<<<<<<<<',
|
82
|
+
shift: 0,
|
83
|
+
orientation: 'revcomp'},
|
84
|
+
Helpers.eval_similarity_output('SP1_f1_revcomp.pwm SP1_f1.pwm'))
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_process_custom_discretization
|
88
|
+
assert_similarity_info_output({similarity: 0.2580456407255705,
|
89
|
+
words_recognized_by_both: 1323.0,
|
90
|
+
words_recognized_by_first: 3554.0,
|
91
|
+
words_recognized_by_second: 2896.0,
|
92
|
+
length: 11,
|
93
|
+
matrix_first_alignment: '>>>>>>>>>>>',
|
94
|
+
matrix_second_alignment: '.>>>>>>>>>>',
|
95
|
+
shift: 1,
|
96
|
+
orientation: 'direct' #, discretization: 1.0
|
97
|
+
},
|
98
|
+
Helpers.eval_similarity_output('SP1_f1.pwm KLF4_f2.pwm -d 1'))
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_process_pcm_files
|
102
|
+
assert_equal( Helpers.eval_similarity_output('KLF4_f2.pwm SP1_f1.pwm'),
|
103
|
+
Helpers.eval_similarity_output('KLF4_f2.pcm SP1_f1.pcm --pcm'))
|
104
|
+
end
|
105
|
+
end
|
data/test/find_pvalue_test.rb
CHANGED
@@ -1,39 +1,34 @@
|
|
1
|
-
require_relative 'test_helper'
|
2
|
-
|
3
|
-
class FindPvalueTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
@start_dir = Dir.pwd
|
6
|
-
Dir.chdir File.join(File.dirname(__FILE__), 'data')
|
7
|
-
end
|
8
|
-
def teardown
|
9
|
-
Dir.chdir(@start_dir)
|
10
|
-
end
|
11
|
-
def test_process_pcm
|
12
|
-
assert_equal [%w[4.1719 1048.0 0.00099945068359375]], Helpers.find_pvalue_output('KLF4_f2.pcm 4.1719 --pcm')
|
13
|
-
end
|
14
|
-
def test_process_one_threshold
|
15
|
-
assert_equal [%w[4.1719 1048.0 0.00099945068359375]], Helpers.find_pvalue_output('KLF4_f2.pwm 4.1719')
|
16
|
-
end
|
17
|
-
def test_process_several_thresholds
|
18
|
-
assert_equal [%w[4.1719 1048.0 0.00099945068359375],
|
19
|
-
%w[5.2403 524.0 0.000499725341796875]], Helpers.find_pvalue_output('KLF4_f2.pwm 4.1719 5.2403')
|
20
|
-
end
|
21
|
-
def test_process_several_thresholds_result_is_ordered
|
22
|
-
assert_equal [%w[5.2403 524.0 0.000499725341796875],
|
23
|
-
%w[4.1719 1048.0 0.00099945068359375]], Helpers.find_pvalue_output('KLF4_f2.pwm 5.2403 4.1719')
|
24
|
-
end
|
25
|
-
def test_custom_discretization
|
26
|
-
assert_equal [%w[5.2403 527.0 0.0005025863647460938]], Helpers.find_pvalue_output('KLF4_f2.pwm 5.2403 -d 100')
|
27
|
-
end
|
28
|
-
def test_probability_wise_backgrond
|
29
|
-
assert_equal [%w[5.2403 0.0005025863647460938]], Helpers.find_pvalue_output('KLF4_f2.pwm 5.2403 -d 100 -b 0.25,0.25,0.25,0.25')
|
30
|
-
end
|
31
|
-
def test_custom_background
|
32
|
-
assert_equal [%w[5.2403 6.815000000000001e-06]], Helpers.find_pvalue_output('KLF4_f2.pwm 5.2403 -b 0.4,0.1,0.1,0.4')
|
33
|
-
end
|
34
|
-
|
35
|
-
assert_equal Helpers.find_pvalue_output('KLF4_f2.pwm 1'),
|
36
|
-
Helpers.provide_stdin(File.read 'KLF4_f2.pwm'){ Helpers.find_pvalue_output('.stdin 1') }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class FindPvalueTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@start_dir = Dir.pwd
|
6
|
+
Dir.chdir File.join(File.dirname(__FILE__), 'data')
|
7
|
+
end
|
8
|
+
def teardown
|
9
|
+
Dir.chdir(@start_dir)
|
10
|
+
end
|
11
|
+
def test_process_pcm
|
12
|
+
assert_equal [%w[4.1719 1048.0 0.00099945068359375]], Helpers.find_pvalue_output('KLF4_f2.pcm 4.1719 --pcm')
|
13
|
+
end
|
14
|
+
def test_process_one_threshold
|
15
|
+
assert_equal [%w[4.1719 1048.0 0.00099945068359375]], Helpers.find_pvalue_output('KLF4_f2.pwm 4.1719')
|
16
|
+
end
|
17
|
+
def test_process_several_thresholds
|
18
|
+
assert_equal [%w[4.1719 1048.0 0.00099945068359375],
|
19
|
+
%w[5.2403 524.0 0.000499725341796875]], Helpers.find_pvalue_output('KLF4_f2.pwm 4.1719 5.2403')
|
20
|
+
end
|
21
|
+
def test_process_several_thresholds_result_is_ordered
|
22
|
+
assert_equal [%w[5.2403 524.0 0.000499725341796875],
|
23
|
+
%w[4.1719 1048.0 0.00099945068359375]], Helpers.find_pvalue_output('KLF4_f2.pwm 5.2403 4.1719')
|
24
|
+
end
|
25
|
+
def test_custom_discretization
|
26
|
+
assert_equal [%w[5.2403 527.0 0.0005025863647460938]], Helpers.find_pvalue_output('KLF4_f2.pwm 5.2403 -d 100')
|
27
|
+
end
|
28
|
+
def test_probability_wise_backgrond
|
29
|
+
assert_equal [%w[5.2403 0.0005025863647460938]], Helpers.find_pvalue_output('KLF4_f2.pwm 5.2403 -d 100 -b 0.25,0.25,0.25,0.25')
|
30
|
+
end
|
31
|
+
def test_custom_background
|
32
|
+
assert_equal [%w[5.2403 6.815000000000001e-06]], Helpers.find_pvalue_output('KLF4_f2.pwm 5.2403 -b 0.4,0.1,0.1,0.4')
|
33
|
+
end
|
34
|
+
end
|