macroape 3.3.3 → 3.3.4
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.
- data/.gitignore +1 -0
- data/Rakefile.rb +7 -22
- data/TODO.txt +7 -6
- data/bin/align_motifs +4 -0
- data/bin/eval_alignment +2 -1
- data/bin/eval_similarity +2 -1
- data/bin/find_pvalue +2 -1
- data/bin/find_threshold +2 -1
- data/bin/preprocess_collection +2 -1
- data/bin/scan_collection +2 -1
- data/lib/macroape/aligned_pair_intersection.rb +2 -3
- data/lib/macroape/cli/align_motifs.rb +49 -0
- data/lib/macroape/cli/eval_alignment.rb +124 -0
- data/lib/macroape/cli/eval_similarity.rb +107 -0
- data/lib/macroape/cli/find_pvalue.rb +89 -0
- data/lib/macroape/cli/find_threshold.rb +84 -0
- data/lib/macroape/cli/preprocess_collection.rb +123 -0
- data/lib/macroape/cli/scan_collection.rb +141 -0
- data/lib/macroape/cli.rb +5 -0
- data/lib/macroape/counting.rb +15 -1
- data/lib/macroape/pwm_compare.rb +21 -1
- data/lib/macroape/pwm_compare_aligned.rb +21 -0
- data/lib/macroape/version.rb +1 -1
- data/macroape.gemspec +1 -1
- data/test/align_motifs_test.rb +12 -0
- data/test/data/KLF3_f1.pat +16 -0
- data/test/data/KLF3_f1.pcm +16 -0
- data/test/data/KLF4_f2.pcm +11 -0
- data/test/data/SP1_f1.pat +11 -11
- data/test/data/SP1_f1.pcm +12 -0
- data/test/data/SP1_f1_revcomp.pat +11 -11
- data/test/data/SP1_f1_revcomp.pcm +12 -0
- data/test/data/test_collection/SP1_f1.pat +11 -11
- data/test/data/test_collection.yaml +49 -109
- data/test/data/test_collection_pcm/GABPA_f1.pcm +14 -0
- data/test/data/test_collection_pcm/KLF4_f2.pcm +11 -0
- data/test/data/test_collection_pcm/SP1_f1.pcm +12 -0
- data/test/data/test_collection_single_file.txt +38 -0
- data/test/data/test_collection_single_file_pcm.txt +38 -0
- data/test/eval_alignment_test.rb +31 -0
- data/test/eval_similarity_test.rb +28 -13
- data/test/find_pvalue_test.rb +10 -13
- data/test/find_threshold_test.rb +10 -5
- data/test/preprocess_collection_test.rb +36 -2
- data/test/scan_collection_test.rb +9 -4
- data/test/test_helper.rb +61 -2
- metadata +38 -12
- data/lib/macroape/exec/eval_alignment.rb +0 -125
- data/lib/macroape/exec/eval_similarity.rb +0 -108
- data/lib/macroape/exec/find_pvalue.rb +0 -81
- data/lib/macroape/exec/find_threshold.rb +0 -77
- data/lib/macroape/exec/preprocess_collection.rb +0 -101
- data/lib/macroape/exec/scan_collection.rb +0 -124
- data/test/eval_alignment_similarity_test.rb +0 -20
@@ -3,7 +3,7 @@ pvalues:
|
|
3
3
|
- 0.0005
|
4
4
|
- 0.0001
|
5
5
|
- 5.0e-05
|
6
|
-
background:
|
6
|
+
background: &17959680
|
7
7
|
- 1
|
8
8
|
- 1
|
9
9
|
- 1
|
@@ -12,26 +12,6 @@ precise_discretization: 10
|
|
12
12
|
rough_discretization: 1
|
13
13
|
pwms:
|
14
14
|
GABPA_f1: !ruby/object:Bioinform::PWM
|
15
|
-
background:
|
16
|
-
- 1
|
17
|
-
- 1
|
18
|
-
- 1
|
19
|
-
- 1
|
20
|
-
input: ! "GABPA_f1\n-0.1106670158341858 0.013801606113892391 0.6054596108973699
|
21
|
-
-1.3518085041421573 \n0.37030668921643345 0.15761121480429963 0.009069314183831202
|
22
|
-
-0.9888619717703562 \n0.47526546359546684 -0.3011678534572083 0.4031522994412777
|
23
|
-
-1.8638752827041059 \n-1.5544255540164373 1.1082369687811506 -0.2814091552834454
|
24
|
-
-5.30708531823271 \n-0.6362037835776368 1.235338189985594 -3.5801322928552253
|
25
|
-
-5.717323067092849 \n-5.852906870733575 -5.852906870733575 1.3841383838057746
|
26
|
-
-5.852906870733575 \n-5.852906870733575 -5.852906870733575 1.3841383838057746
|
27
|
-
-5.852906870733575 \n1.3835219739184708 -5.2341956006430985 -5.852906870733575
|
28
|
-
-5.852906870733575 \n1.3756340514956562 -5.394962755562375 -5.394962755562375
|
29
|
-
-3.401117964959733 \n-1.2176198315414444 -3.109079898175411 1.2964067931472216
|
30
|
-
-5.717323067092849 \n-1.3716559438167257 -0.2761401935045069 -1.8504445165866068
|
31
|
-
1.0404320473626856 \n-0.5440863133031895 -0.48103682561971345 0.907381908447086
|
32
|
-
-1.1280642594012078 \n0.10557340209290218 -0.01814819455289191 0.4381106695354074
|
33
|
-
-1.0304105539540915 \n"
|
34
|
-
parser: !ruby/class 'Bioinform::StringParser'
|
35
15
|
matrix:
|
36
16
|
- - -0.1106670158341858
|
37
17
|
- 0.013801606113892391
|
@@ -86,24 +66,9 @@ pwms:
|
|
86
66
|
- 0.4381106695354074
|
87
67
|
- -1.0304105539540915
|
88
68
|
name: GABPA_f1
|
69
|
+
background: *17959680
|
70
|
+
max_hash_size: 1000000
|
89
71
|
KLF4_f2: !ruby/object:Bioinform::PWM
|
90
|
-
background:
|
91
|
-
- 1
|
92
|
-
- 1
|
93
|
-
- 1
|
94
|
-
- 1
|
95
|
-
input: ! "KLF4_f2\n0.30861857265872605 -2.254321000121579 0.13505703522674192
|
96
|
-
0.3285194224375633 \n-1.227018967707036 -4.814127713368663 1.3059890687390967
|
97
|
-
-4.908681463544344 \n-2.443469374521196 -4.648238485031404 1.3588686548279805
|
98
|
-
-4.441801801188402 \n-2.7177827948276123 -3.8073538975356565 1.356272809724262
|
99
|
-
-3.504104725510225 \n-0.5563232977367343 0.5340697765121405 -3.61417723090579
|
100
|
-
0.5270259776377405 \n-1.8687622060887386 -4.381483976582316 1.337932245336098
|
101
|
-
-3.815629658877517 \n-2.045671123823928 -2.384975142213679 0.7198551207724355
|
102
|
-
0.5449254135616948 \n-1.373157530374372 -3.0063112097748217 1.285188335493552
|
103
|
-
-2.5026044231773543 \n-2.1030513122772208 -1.8941348100402244 1.249265758393991
|
104
|
-
-1.4284210948906104 \n-1.3277128628152939 0.8982415633049462 -0.8080773665408135
|
105
|
-
-0.18161647647456935 \n"
|
106
|
-
parser: !ruby/class 'Bioinform::StringParser'
|
107
72
|
matrix:
|
108
73
|
- - 0.30861857265872605
|
109
74
|
- -2.254321000121579
|
@@ -146,82 +111,57 @@ pwms:
|
|
146
111
|
- -0.8080773665408135
|
147
112
|
- -0.18161647647456935
|
148
113
|
name: KLF4_f2
|
114
|
+
background: *17959680
|
115
|
+
max_hash_size: 1000000
|
149
116
|
SP1_f1: !ruby/object:Bioinform::PWM
|
150
|
-
background:
|
151
|
-
- 1
|
152
|
-
- 1
|
153
|
-
- 1
|
154
|
-
- 1
|
155
|
-
input: ! '> SP1_f1
|
156
|
-
|
157
|
-
-0.24435707885585334 -0.6748234046937317 0.8657012535789861 -1.1060188862599292
|
158
|
-
|
159
|
-
-1.0631255752097801 -2.1119259694238686 1.0960627561110399 -0.6138563775211981
|
160
|
-
|
161
|
-
-0.387227623476054 -2.973985191321805 1.1807800242010371 -4.338927525031567
|
162
|
-
|
163
|
-
-4.563896055436894 -2.916163300253228 1.3684371349982631 -5.077972423609655
|
164
|
-
|
165
|
-
-2.2369752892820087 -3.719643631330185 1.3510439136452728 -4.8899306705082335
|
166
|
-
|
167
|
-
-0.07473964149330914 0.9449196547620103 -2.624685764808605 -0.851098348782244
|
168
|
-
|
169
|
-
-1.9643526491643326 -2.9784027708801153 1.3113096718240569 -2.3243342594990253
|
170
|
-
|
171
|
-
-4.015548413965584 -3.138426807809667 1.338748858978805 -2.0846739035376483
|
172
|
-
|
173
|
-
-0.4450938582835542 -2.2510053061629707 1.126543157436868 -1.7780413702431377
|
174
|
-
|
175
|
-
-1.1896356092245055 -1.2251832285630033 1.163676006374752 -1.6080243648157357
|
176
|
-
|
177
|
-
-0.5166047365590577 0.7641033353626651 -0.28626775700282125 -0.6825482097865606'
|
178
|
-
parser: !ruby/class 'Bioinform::StringParser'
|
179
117
|
matrix:
|
180
|
-
- - -0.
|
181
|
-
- -0.
|
182
|
-
- 0.
|
183
|
-
- -1.
|
184
|
-
- - -1.
|
185
|
-
- -2.
|
186
|
-
- 1.
|
187
|
-
- -0.
|
188
|
-
- - -0.
|
189
|
-
- -2.
|
190
|
-
- 1.
|
191
|
-
- -4.
|
118
|
+
- - -0.24435707885585292
|
119
|
+
- -0.674823404693731
|
120
|
+
- 0.8657012535789866
|
121
|
+
- -1.1060188862599287
|
122
|
+
- - -1.0631255752097797
|
123
|
+
- -2.111925969423868
|
124
|
+
- 1.0960627561110403
|
125
|
+
- -0.6138563775211977
|
126
|
+
- - -0.3872276234760535
|
127
|
+
- -2.9739851913218045
|
128
|
+
- 1.1807800242010378
|
129
|
+
- -4.338927525031566
|
192
130
|
- - -4.563896055436894
|
193
|
-
- -2.
|
194
|
-
- 1.
|
131
|
+
- -2.9161633002532277
|
132
|
+
- 1.3684371349982638
|
195
133
|
- -5.077972423609655
|
196
|
-
- - -2.
|
197
|
-
- -3.
|
198
|
-
- 1.
|
199
|
-
- -4.
|
200
|
-
- - -0.
|
201
|
-
- 0.
|
202
|
-
- -2.
|
203
|
-
- -0.
|
204
|
-
- - -1.
|
205
|
-
- -2.
|
206
|
-
- 1.
|
207
|
-
- -2.
|
208
|
-
- - -4.
|
209
|
-
- -3.
|
210
|
-
- 1.
|
211
|
-
- -2.
|
212
|
-
- - -0.
|
213
|
-
- -2.
|
214
|
-
- 1.
|
215
|
-
- -1.
|
216
|
-
- - -1.
|
217
|
-
- -1.
|
218
|
-
- 1.
|
219
|
-
- -1.
|
220
|
-
- - -0.
|
221
|
-
- 0.
|
222
|
-
- -0.
|
223
|
-
- -0.
|
134
|
+
- - -2.2369752892820083
|
135
|
+
- -3.7196436313301846
|
136
|
+
- 1.3510439136452734
|
137
|
+
- -4.889930670508233
|
138
|
+
- - -0.07473964149330865
|
139
|
+
- 0.944919654762011
|
140
|
+
- -2.6246857648086044
|
141
|
+
- -0.8510983487822436
|
142
|
+
- - -1.9643526491643322
|
143
|
+
- -2.978402770880115
|
144
|
+
- 1.3113096718240573
|
145
|
+
- -2.324334259499025
|
146
|
+
- - -4.0155484139655835
|
147
|
+
- -3.1384268078096667
|
148
|
+
- 1.3387488589788057
|
149
|
+
- -2.084673903537648
|
150
|
+
- - -0.44509385828355363
|
151
|
+
- -2.2510053061629702
|
152
|
+
- 1.1265431574368685
|
153
|
+
- -1.7780413702431372
|
154
|
+
- - -1.1896356092245048
|
155
|
+
- -1.2251832285630027
|
156
|
+
- 1.1636760063747527
|
157
|
+
- -1.6080243648157353
|
158
|
+
- - -0.5166047365590571
|
159
|
+
- 0.7641033353626657
|
160
|
+
- -0.2862677570028208
|
161
|
+
- -0.68254820978656
|
224
162
|
name: SP1_f1
|
163
|
+
background: *17959680
|
164
|
+
max_hash_size: 1000000
|
225
165
|
infos:
|
226
166
|
GABPA_f1:
|
227
167
|
:rough:
|
@@ -0,0 +1,14 @@
|
|
1
|
+
GABPA_f1
|
2
|
+
615.2572649050138 697.0698715160123 1261.1903440712872 176.43506582414153
|
3
|
+
996.4929869323321 805.1878697364007 693.7695793644275 254.5021102832924
|
4
|
+
1106.9888035794224 508.19444415177276 1029.8329748714536 104.93632371380718
|
5
|
+
143.7121486195701 2086.4279160661263 518.37507049306 1.4374111377025893
|
6
|
+
362.9541452731307 2369.473894845734 17.23702397004065 0.2874822275405179
|
7
|
+
0.0 0.0 2749.952546316428 0.0
|
8
|
+
0.0 0.0 2749.952546316428 0.0
|
9
|
+
2748.2567506938462 1.695795622582083 0.0 0.0
|
10
|
+
2726.6484322711017 1.1499289101620715 1.1499289101620715 21.00425622500253
|
11
|
+
202.05697400573305 28.799402471063658 2518.808687612104 0.2874822275405179
|
12
|
+
172.92889618879767 521.1240363384483 106.38197600987633 1949.517637779338
|
13
|
+
398.1679460365911 424.20938204069563 1706.4024212088275 221.17279703034018
|
14
|
+
764.2587933951809 675.0883944902433 1066.5413633225007 244.06399510852864
|
@@ -0,0 +1,11 @@
|
|
1
|
+
KLF4_f2
|
2
|
+
1233.46088405354 93.18173277811673 1036.6014857092885 1258.2948629970272
|
3
|
+
263.979242343185 5.314520555872139 3347.5949971525274 4.650205486388122
|
4
|
+
76.7700780003465 6.643150694840173 3529.4896409394937 8.636095903292224
|
5
|
+
57.86097393406657 18.102585643439472 3520.3342027139347 25.24120324653207
|
6
|
+
518.1947904009378 1545.9062946905135 22.396758181071043 1535.0411222654507
|
7
|
+
137.98151691820345 9.300410972776241 3456.320530770924 17.936506876068467
|
8
|
+
115.27647661640499 81.51802997128804 1861.9425868567278 1562.801872093553
|
9
|
+
227.8095486111286 42.84555258785854 3278.6396005325996 72.244263806387
|
10
|
+
108.73384179997886 134.47328134862394 3162.880454846513 215.45138754285665
|
11
|
+
238.49636899561344 2225.9561104691043 402.40727964384774 754.6792064294074
|
@@ -0,0 +1,12 @@
|
|
1
|
+
SP1_f1
|
2
|
+
682.6436366358055 443.1455214015781 2075.655346294993 287.211468117951
|
3
|
+
299.8883246804867 103.74338315843572 2613.8927022405364 471.1315623708902
|
4
|
+
591.4892493324709 42.631827541794564 2845.1654083148564 9.36948726124641
|
5
|
+
7.071084742361592 45.29093411231232 3432.8847704374107 3.409183158303573
|
6
|
+
91.308984085713 19.1536481364332 3373.656949880137 4.5363903481026
|
7
|
+
809.2082973387932 2246.941954176211 61.30766021687515 371.19806071846244
|
8
|
+
120.56476435866055 42.4349244403591 3242.1560628684038 83.50022078295852
|
9
|
+
13.72524477409959 35.858220519297525 3332.4066864946167 106.66582066236779
|
10
|
+
558.1188080161639 90.0084504200356 2694.854973210736 145.67374080342415
|
11
|
+
264.0088462230318 254.7175868081866 2796.88087480315 173.0486646159857
|
12
|
+
519.46013914282 1874.9349086474765 654.5411208373813 439.7198038226514
|
@@ -0,0 +1,38 @@
|
|
1
|
+
> SP1_f1
|
2
|
+
-0.24435707885585292 -0.674823404693731 0.8657012535789866 -1.1060188862599287
|
3
|
+
-1.0631255752097797 -2.111925969423868 1.0960627561110403 -0.6138563775211977
|
4
|
+
-0.3872276234760535 -2.9739851913218045 1.1807800242010378 -4.338927525031566
|
5
|
+
-4.563896055436894 -2.9161633002532277 1.3684371349982638 -5.077972423609655
|
6
|
+
-2.2369752892820083 -3.7196436313301846 1.3510439136452734 -4.889930670508233
|
7
|
+
-0.07473964149330865 0.944919654762011 -2.6246857648086044 -0.8510983487822436
|
8
|
+
-1.9643526491643322 -2.978402770880115 1.3113096718240573 -2.324334259499025
|
9
|
+
-4.0155484139655835 -3.1384268078096667 1.3387488589788057 -2.084673903537648
|
10
|
+
-0.44509385828355363 -2.2510053061629702 1.1265431574368685 -1.7780413702431372
|
11
|
+
-1.1896356092245048 -1.2251832285630027 1.1636760063747527 -1.6080243648157353
|
12
|
+
-0.5166047365590571 0.7641033353626657 -0.2862677570028208 -0.68254820978656
|
13
|
+
KLF4_f2
|
14
|
+
0.30861857265872605 -2.254321000121579 0.13505703522674192 0.3285194224375633
|
15
|
+
-1.227018967707036 -4.814127713368663 1.3059890687390967 -4.908681463544344
|
16
|
+
-2.443469374521196 -4.648238485031404 1.3588686548279805 -4.441801801188402
|
17
|
+
-2.7177827948276123 -3.8073538975356565 1.356272809724262 -3.504104725510225
|
18
|
+
-0.5563232977367343 0.5340697765121405 -3.61417723090579 0.5270259776377405
|
19
|
+
-1.8687622060887386 -4.381483976582316 1.337932245336098 -3.815629658877517
|
20
|
+
-2.045671123823928 -2.384975142213679 0.7198551207724355 0.5449254135616948
|
21
|
+
-1.373157530374372 -3.0063112097748217 1.285188335493552 -2.5026044231773543
|
22
|
+
-2.1030513122772208 -1.8941348100402244 1.249265758393991 -1.4284210948906104
|
23
|
+
-1.3277128628152939 0.8982415633049462 -0.8080773665408135 -0.18161647647456935
|
24
|
+
|
25
|
+
GABPA_f1
|
26
|
+
-0.1106670158341858 0.013801606113892391 0.6054596108973699 -1.3518085041421573
|
27
|
+
0.37030668921643345 0.15761121480429963 0.009069314183831202 -0.9888619717703562
|
28
|
+
0.47526546359546684 -0.3011678534572083 0.4031522994412777 -1.8638752827041059
|
29
|
+
-1.5544255540164373 1.1082369687811506 -0.2814091552834454 -5.30708531823271
|
30
|
+
-0.6362037835776368 1.235338189985594 -3.5801322928552253 -5.717323067092849
|
31
|
+
-5.852906870733575 -5.852906870733575 1.3841383838057746 -5.852906870733575
|
32
|
+
-5.852906870733575 -5.852906870733575 1.3841383838057746 -5.852906870733575
|
33
|
+
1.3835219739184708 -5.2341956006430985 -5.852906870733575 -5.852906870733575
|
34
|
+
1.3756340514956562 -5.394962755562375 -5.394962755562375 -3.401117964959733
|
35
|
+
-1.2176198315414444 -3.109079898175411 1.2964067931472216 -5.717323067092849
|
36
|
+
-1.3716559438167257 -0.2761401935045069 -1.8504445165866068 1.0404320473626856
|
37
|
+
-0.5440863133031895 -0.48103682561971345 0.907381908447086 -1.1280642594012078
|
38
|
+
0.10557340209290218 -0.01814819455289191 0.4381106695354074 -1.0304105539540915
|
@@ -0,0 +1,38 @@
|
|
1
|
+
> SP1_f1
|
2
|
+
682.6436366358055 443.1455214015781 2075.655346294993 287.211468117951
|
3
|
+
299.8883246804867 103.74338315843572 2613.8927022405364 471.1315623708902
|
4
|
+
591.4892493324709 42.631827541794564 2845.1654083148564 9.36948726124641
|
5
|
+
7.071084742361592 45.29093411231232 3432.8847704374107 3.409183158303573
|
6
|
+
91.308984085713 19.1536481364332 3373.656949880137 4.5363903481026
|
7
|
+
809.2082973387932 2246.941954176211 61.30766021687515 371.19806071846244
|
8
|
+
120.56476435866055 42.4349244403591 3242.1560628684038 83.50022078295852
|
9
|
+
13.72524477409959 35.858220519297525 3332.4066864946167 106.66582066236779
|
10
|
+
558.1188080161639 90.0084504200356 2694.854973210736 145.67374080342415
|
11
|
+
264.0088462230318 254.7175868081866 2796.88087480315 173.0486646159857
|
12
|
+
519.46013914282 1874.9349086474765 654.5411208373813 439.7198038226514
|
13
|
+
KLF4_f2
|
14
|
+
1233.46088405354 93.18173277811673 1036.6014857092885 1258.2948629970272
|
15
|
+
263.979242343185 5.314520555872139 3347.5949971525274 4.650205486388122
|
16
|
+
76.7700780003465 6.643150694840173 3529.4896409394937 8.636095903292224
|
17
|
+
57.86097393406657 18.102585643439472 3520.3342027139347 25.24120324653207
|
18
|
+
518.1947904009378 1545.9062946905135 22.396758181071043 1535.0411222654507
|
19
|
+
137.98151691820345 9.300410972776241 3456.320530770924 17.936506876068467
|
20
|
+
115.27647661640499 81.51802997128804 1861.9425868567278 1562.801872093553
|
21
|
+
227.8095486111286 42.84555258785854 3278.6396005325996 72.244263806387
|
22
|
+
108.73384179997886 134.47328134862394 3162.880454846513 215.45138754285665
|
23
|
+
238.49636899561344 2225.9561104691043 402.40727964384774 754.6792064294074
|
24
|
+
|
25
|
+
GABPA_f1
|
26
|
+
615.2572649050138 697.0698715160123 1261.1903440712872 176.43506582414153
|
27
|
+
996.4929869323321 805.1878697364007 693.7695793644275 254.5021102832924
|
28
|
+
1106.9888035794224 508.19444415177276 1029.8329748714536 104.93632371380718
|
29
|
+
143.7121486195701 2086.4279160661263 518.37507049306 1.4374111377025893
|
30
|
+
362.9541452731307 2369.473894845734 17.23702397004065 0.2874822275405179
|
31
|
+
0.0 0.0 2749.952546316428 0.0
|
32
|
+
0.0 0.0 2749.952546316428 0.0
|
33
|
+
2748.2567506938462 1.695795622582083 0.0 0.0
|
34
|
+
2726.6484322711017 1.1499289101620715 1.1499289101620715 21.00425622500253
|
35
|
+
202.05697400573305 28.799402471063658 2518.808687612104 0.2874822275405179
|
36
|
+
172.92889618879767 521.1240363384483 106.38197600987633 1949.517637779338
|
37
|
+
398.1679460365911 424.20938204069563 1706.4024212088275 221.17279703034018
|
38
|
+
764.2587933951809 675.0883944902433 1066.5413633225007 244.06399510852864
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestEvalAlignment < Test::Unit::TestCase
|
4
|
+
def test_process_at_optimal_alignment
|
5
|
+
assert_equal "0.2420758234928527\n779.0\t11\n.>>>>>>>>>>\n>>>>>>>>>>>\n-1\tdirect\n", Helpers.eval_alignment_output('test/data/KLF4_f2.pat test/data/SP1_f1.pat -1 direct')
|
6
|
+
end
|
7
|
+
def test_process_not_optimal_alignment
|
8
|
+
assert_equal "0.0017543859649122807\n7.0\t11\n>>>>>>>>>>.\n>>>>>>>>>>>\n0\tdirect\n", Helpers.eval_alignment_output('test/data/KLF4_f2.pat test/data/SP1_f1.pat 0 direct')
|
9
|
+
end
|
10
|
+
def test_process_alignment_first_motif_from_stdin
|
11
|
+
assert_equal "0.0017543859649122807\n7.0\t11\n>>>>>>>>>>.\n>>>>>>>>>>>\n0\tdirect\n",
|
12
|
+
Helpers.provide_stdin(File.read('test/data/KLF4_f2.pat')) {
|
13
|
+
Helpers.eval_alignment_output('.stdin test/data/SP1_f1.pat 0 direct')
|
14
|
+
}
|
15
|
+
end
|
16
|
+
def test_process_alignment_second_motif_from_stdin
|
17
|
+
assert_equal "0.0017543859649122807\n7.0\t11\n>>>>>>>>>>.\n>>>>>>>>>>>\n0\tdirect\n",
|
18
|
+
Helpers.provide_stdin(File.read('test/data/SP1_f1.pat')) {
|
19
|
+
Helpers.eval_alignment_output('test/data/KLF4_f2.pat .stdin 0 direct')
|
20
|
+
}
|
21
|
+
end
|
22
|
+
def test_process_alignment_both_motifs_from_stdin
|
23
|
+
assert_equal "0.0017543859649122807\n7.0\t11\n>>>>>>>>>>.\n>>>>>>>>>>>\n0\tdirect\n",
|
24
|
+
Helpers.provide_stdin(File.read('test/data/KLF4_f2.pat') + File.read('test/data/SP1_f1.pat')) {
|
25
|
+
Helpers.eval_alignment_output('.stdin .stdin 0 direct')
|
26
|
+
}
|
27
|
+
end
|
28
|
+
def test_process_at_optimal_alignment_reversed
|
29
|
+
assert_equal "0.0\n0.0\t11\n.>>>>>>>>>>\n<<<<<<<<<<<\n-1\trevcomp\n", Helpers.eval_alignment_output('test/data/KLF4_f2.pat test/data/SP1_f1.pat -1 revcomp')
|
30
|
+
end
|
31
|
+
end
|
@@ -1,27 +1,42 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
puts "\n\neval_similarity test:"
|
4
3
|
class TestEvalSimilarity < Test::Unit::TestCase
|
5
4
|
def test_process_pair_of_pwms
|
6
|
-
|
7
|
-
assert_equal "0.2420758234928527\n779.0\t11\n.>>>>>>>>>>\n>>>>>>>>>>>\n-1\tdirect\n", f.read
|
8
|
-
}
|
5
|
+
assert_equal "0.2420758234928527\n779.0\t11\n.>>>>>>>>>>\n>>>>>>>>>>>\n-1\tdirect\n", Helpers.eval_similarity_output('test/data/KLF4_f2.pat test/data/SP1_f1.pat')
|
9
6
|
end
|
10
7
|
def test_process_another_pair_of_pwms
|
11
|
-
|
12
|
-
assert_equal "0.0037332005973120955\n15.0\t11\n>>>>>>>>>>>\n.>>>>>>>>>.\n1\tdirect\n", f.read
|
13
|
-
}
|
8
|
+
assert_equal "0.0037332005973120955\n15.0\t11\n>>>>>>>>>>>\n.>>>>>>>>>.\n1\tdirect\n", Helpers.eval_similarity_output('test/data/SP1_f1.pat test/data/AHR_si.pat')
|
14
9
|
end
|
15
10
|
|
16
11
|
def test_recognize_orientation_of_alignment
|
17
|
-
|
18
|
-
assert_equal "1.0\n2033.0\t11\n>>>>>>>>>>>\n<<<<<<<<<<<\n0\trevcomp\n", f.read
|
19
|
-
}
|
12
|
+
assert_equal "1.0\n2033.0\t11\n>>>>>>>>>>>\n<<<<<<<<<<<\n0\trevcomp\n", Helpers.eval_similarity_output('test/data/SP1_f1_revcomp.pat test/data/SP1_f1.pat')
|
20
13
|
end
|
21
14
|
|
22
15
|
def test_process_custom_discretization
|
23
|
-
|
24
|
-
assert_equal "0.22754919499105544\n636.0\t11\n>>>>>>>>>>>\n.>>>>>>>>>>\n1\tdirect\n", f.read
|
25
|
-
}
|
16
|
+
assert_equal "0.22754919499105544\n636.0\t11\n>>>>>>>>>>>\n.>>>>>>>>>>\n1\tdirect\n", Helpers.eval_similarity_output('test/data/SP1_f1.pat test/data/KLF4_f2.pat -d 1')
|
26
17
|
end
|
18
|
+
|
19
|
+
def test_process_first_motif_from_stdin
|
20
|
+
assert_equal "0.22754919499105544\n636.0\t11\n>>>>>>>>>>>\n.>>>>>>>>>>\n1\tdirect\n",
|
21
|
+
Helpers.provide_stdin(File.read('test/data/SP1_f1.pat')){
|
22
|
+
Helpers.eval_similarity_output('.stdin test/data/KLF4_f2.pat -d 1')
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_process_second_motif_from_stdin
|
27
|
+
assert_equal "0.22754919499105544\n636.0\t11\n>>>>>>>>>>>\n.>>>>>>>>>>\n1\tdirect\n",
|
28
|
+
Helpers.provide_stdin(File.read('test/data/KLF4_f2.pat')){
|
29
|
+
Helpers.eval_similarity_output('test/data/SP1_f1.pat .stdin -d 1')
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_process_both_motifs_from_stdin
|
34
|
+
assert_equal "0.22754919499105544\n636.0\t11\n>>>>>>>>>>>\n.>>>>>>>>>>\n1\tdirect\n",
|
35
|
+
Helpers.provide_stdin(File.read('test/data/SP1_f1.pat') + File.read('test/data/KLF4_f2.pat')){
|
36
|
+
Helpers.eval_similarity_output('.stdin .stdin -d 1')
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
|
27
42
|
end
|
data/test/find_pvalue_test.rb
CHANGED
@@ -1,26 +1,23 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
puts "\n\nfind_pvalue test:"
|
4
3
|
class FindPvalueTest < Test::Unit::TestCase
|
5
4
|
def test_process_one_threshold
|
6
|
-
|
7
|
-
assert_equal "4.1719\t1048.0\t0.00099945068359375\n", f.read
|
8
|
-
}
|
5
|
+
assert_equal "4.1719\t1048.0\t0.00099945068359375\n", Helpers.find_pvalue_output('test/data/KLF4_f2.pat 4.1719')
|
9
6
|
end
|
10
7
|
def test_process_several_thresholds
|
11
|
-
|
12
|
-
assert_equal "4.1719\t1048.0\t0.00099945068359375\n5.2403\t524.0\t0.000499725341796875\n", f.read
|
13
|
-
}
|
8
|
+
assert_equal "4.1719\t1048.0\t0.00099945068359375\n5.2403\t524.0\t0.000499725341796875\n", Helpers.find_pvalue_output('test/data/KLF4_f2.pat 4.1719 5.2403')
|
14
9
|
end
|
15
10
|
def test_process_several_thresholds_result_is_ordered
|
16
|
-
|
17
|
-
assert_equal "5.2403\t524.0\t0.000499725341796875\n4.1719\t1048.0\t0.00099945068359375\n", f.read
|
18
|
-
}
|
11
|
+
assert_equal "5.2403\t524.0\t0.000499725341796875\n4.1719\t1048.0\t0.00099945068359375\n", Helpers.find_pvalue_output('test/data/KLF4_f2.pat 5.2403 4.1719')
|
19
12
|
end
|
20
13
|
def test_custom_discretization
|
21
|
-
|
22
|
-
|
23
|
-
|
14
|
+
assert_equal "5.2403\t527.0\t0.0005025863647460938\n", Helpers.find_pvalue_output('test/data/KLF4_f2.pat 5.2403 -d 100')
|
15
|
+
end
|
16
|
+
def test_process_pwm_from_stdin
|
17
|
+
assert_equal Helpers.find_pvalue_output('test/data/KLF4_f2.pat 1'),
|
18
|
+
Helpers.provide_stdin(File.read('test/data/KLF4_f2.pat')) {
|
19
|
+
Helpers.find_pvalue_output('.stdin 1')
|
20
|
+
}
|
24
21
|
end
|
25
22
|
end
|
26
23
|
|
data/test/find_threshold_test.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
puts "\n\nfind_threshold test:"
|
4
3
|
class FindThresholdTest < Test::Unit::TestCase
|
5
4
|
def test_process_several_pvalues
|
6
5
|
pvalues = []
|
7
|
-
|
6
|
+
Helpers.find_threshold_output('test/data/KLF4_f2.pat -p 0.001 0.0005').lines.each{|line|
|
8
7
|
pvalue, threshold, real_pvalue = line.strip.split("\t")
|
9
8
|
pvalues << pvalue
|
10
9
|
assert_equal Helpers.obtain_pvalue_by_threshold("test/data/KLF4_f2.pat #{threshold}"), real_pvalue
|
@@ -12,19 +11,25 @@ class FindThresholdTest < Test::Unit::TestCase
|
|
12
11
|
assert_equal pvalues, ['0.0005', '0.001']
|
13
12
|
end
|
14
13
|
def test_process_one_pvalue
|
15
|
-
pvalue, threshold, real_pvalue =
|
14
|
+
pvalue, threshold, real_pvalue = Helpers.find_threshold_output('test/data/KLF4_f2.pat -p 0.001').strip.split("\t")
|
16
15
|
assert_equal '0.001', pvalue
|
17
16
|
assert_equal Helpers.obtain_pvalue_by_threshold("test/data/KLF4_f2.pat #{threshold}"), real_pvalue
|
18
17
|
end
|
19
18
|
def test_process_default_pvalue
|
20
|
-
pvalue, threshold, real_pvalue =
|
19
|
+
pvalue, threshold, real_pvalue = Helpers.find_threshold_output('test/data/KLF4_f2.pat').strip.split("\t")
|
21
20
|
assert_equal '0.0005', pvalue
|
22
21
|
assert_equal Helpers.obtain_pvalue_by_threshold("test/data/KLF4_f2.pat #{threshold}"), real_pvalue
|
23
22
|
end
|
24
23
|
def test_custom_discretization
|
25
|
-
pvalue, threshold, real_pvalue =
|
24
|
+
pvalue, threshold, real_pvalue = Helpers.find_threshold_output('test/data/KLF4_f2.pat -d 100').strip.split("\t")
|
26
25
|
assert_equal '0.0005', pvalue
|
27
26
|
assert_equal Helpers.obtain_pvalue_by_threshold("test/data/KLF4_f2.pat #{threshold} -d 100"), real_pvalue
|
28
27
|
end
|
28
|
+
def test_process_pwm_from_stdin
|
29
|
+
assert_equal Helpers.find_threshold_output('test/data/KLF4_f2.pat'),
|
30
|
+
Helpers.provide_stdin(File.read('test/data/KLF4_f2.pat')) {
|
31
|
+
Helpers.find_threshold_output('.stdin')
|
32
|
+
}
|
33
|
+
end
|
29
34
|
end
|
30
35
|
|
@@ -2,13 +2,47 @@ require 'test_helper'
|
|
2
2
|
require 'yaml'
|
3
3
|
require 'macroape'
|
4
4
|
|
5
|
-
puts "\n\npreprocess_collection test:"
|
6
5
|
class TestPreprocessCollection < Test::Unit::TestCase
|
7
6
|
def test_multipvalue_preproceessing
|
8
|
-
|
7
|
+
Helpers.run_preprocess_collection('test/data/test_collection -o test/data/test_collection.yaml.tmp -p 0.0005 0.0001 0.00005 --silent')
|
9
8
|
# Don't use YAML.load_file() instead of YAML.load(File.read()) because in ruby before v1.93 p194
|
10
9
|
# it doesn't immediately release file descriptor (if I understood error right way) so File.delete fails
|
11
10
|
assert_equal YAML.load(File.read('test/data/test_collection.yaml')), YAML.load(File.read('test/data/test_collection.yaml.tmp'))
|
12
11
|
File.delete 'test/data/test_collection.yaml.tmp'
|
13
12
|
end
|
13
|
+
|
14
|
+
def test_preproceessing_collection_from_a_single_file
|
15
|
+
Helpers.run_preprocess_collection('test/data/test_collection_single_file.txt -o test/data/test_collection.yaml.tmp -p 0.0005 0.0001 0.00005 --silent')
|
16
|
+
assert_equal YAML.load(File.read('test/data/test_collection.yaml')), YAML.load(File.read('test/data/test_collection.yaml.tmp'))
|
17
|
+
File.delete 'test/data/test_collection.yaml.tmp'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_preproceessing_collection_from_stdin
|
21
|
+
Helpers.provide_stdin(File.read('test/data/test_collection_single_file.txt')){
|
22
|
+
Helpers.run_preprocess_collection('.stdin -o test/data/test_collection.yaml.tmp -p 0.0005 0.0001 0.00005 --silent')
|
23
|
+
}
|
24
|
+
assert_equal YAML.load(File.read('test/data/test_collection.yaml')), YAML.load(File.read('test/data/test_collection.yaml.tmp'))
|
25
|
+
File.delete 'test/data/test_collection.yaml.tmp'
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_preproceessing_folder_pcm
|
29
|
+
Helpers.run_preprocess_collection('test/data/test_collection_pcm -o test/data/test_collection.yaml.tmp -p 0.0005 0.0001 0.00005 --silent --pcm')
|
30
|
+
assert_equal YAML.load(File.read('test/data/test_collection.yaml')), YAML.load(File.read('test/data/test_collection.yaml.tmp'))
|
31
|
+
File.delete 'test/data/test_collection.yaml.tmp'
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_preproceessing_collection_from_a_single_file_pcm
|
35
|
+
Helpers.run_preprocess_collection('test/data/test_collection_single_file_pcm.txt -o test/data/test_collection.yaml.tmp -p 0.0005 0.0001 0.00005 --silent --pcm')
|
36
|
+
assert_equal YAML.load(File.read('test/data/test_collection.yaml')), YAML.load(File.read('test/data/test_collection.yaml.tmp'))
|
37
|
+
File.delete 'test/data/test_collection.yaml.tmp'
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_preproceessing_collection_from_stdin_pcm
|
41
|
+
Helpers.provide_stdin(File.read('test/data/test_collection_single_file_pcm.txt')){
|
42
|
+
Helpers.run_preprocess_collection('.stdin -o test/data/test_collection.yaml.tmp -p 0.0005 0.0001 0.00005 --silent --pcm')
|
43
|
+
}
|
44
|
+
assert_equal YAML.load(File.read('test/data/test_collection.yaml')), YAML.load(File.read('test/data/test_collection.yaml.tmp'))
|
45
|
+
File.delete 'test/data/test_collection.yaml.tmp'
|
46
|
+
end
|
47
|
+
|
14
48
|
end
|
@@ -1,18 +1,23 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
puts "\n\nscan_collection test:"
|
4
3
|
class TestScanCollection < Test::Unit::TestCase
|
5
4
|
def test_scan_default_cutoff
|
6
5
|
assert_equal File.read('test/data/KLF4_f2_scan_results_default_cutoff.txt').gsub("\r\n", "\n"),
|
7
|
-
|
6
|
+
Helpers.scan_collection_output('test/data/KLF4_f2.pat test/data/test_collection.yaml --silent').gsub("\r\n","\n")
|
8
7
|
end
|
9
8
|
def test_scan_and_output_all_results
|
10
9
|
assert_equal File.read('test/data/KLF4_f2_scan_results_all.txt').gsub("\r\n", "\n"),
|
11
|
-
|
10
|
+
Helpers.scan_collection_output('test/data/KLF4_f2.pat test/data/test_collection.yaml --all --silent').gsub("\r\n","\n")
|
12
11
|
|
13
12
|
end
|
14
13
|
def test_scan_precise_mode
|
15
14
|
assert_equal File.read('test/data/KLF4_f2_scan_results_precise_mode.txt').gsub("\r\n","\n"),
|
16
|
-
|
15
|
+
Helpers.scan_collection_output('test/data/KLF4_f2.pat test/data/test_collection.yaml --precise --all --silent').gsub("\r\n", "\n")
|
16
|
+
end
|
17
|
+
def test_process_query_pwm_from_stdin
|
18
|
+
assert_equal Helpers.scan_collection_output('test/data/KLF4_f2.pat test/data/test_collection.yaml --silent'),
|
19
|
+
Helpers.provide_stdin(File.read('test/data/KLF4_f2.pat')) {
|
20
|
+
Helpers.scan_collection_output('.stdin test/data/test_collection.yaml --silent')
|
21
|
+
}
|
17
22
|
end
|
18
23
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,12 +1,71 @@
|
|
1
1
|
$lib_folder = File.dirname(__FILE__) + '/../lib'
|
2
2
|
$LOAD_PATH.unshift $lib_folder
|
3
3
|
require 'test/unit'
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
require 'macroape/cli/find_threshold'
|
7
|
+
require 'macroape/cli/find_pvalue'
|
8
|
+
require 'macroape/cli/eval_similarity'
|
9
|
+
require 'macroape/cli/eval_alignment'
|
10
|
+
require 'macroape/cli/preprocess_collection'
|
11
|
+
require 'macroape/cli/scan_collection'
|
12
|
+
require 'macroape/cli/align_motifs'
|
4
13
|
|
5
14
|
module Helpers
|
15
|
+
# from minitest
|
16
|
+
def self.capture_io(&block)
|
17
|
+
orig_stdout, orig_stderr = $stdout, $stderr
|
18
|
+
captured_stdout, captured_stderr = StringIO.new, StringIO.new
|
19
|
+
$stdout, $stderr = captured_stdout, captured_stderr
|
20
|
+
yield
|
21
|
+
return {stdout: captured_stdout.string, stderr: captured_stderr.string}
|
22
|
+
ensure
|
23
|
+
$stdout = orig_stdout
|
24
|
+
$stderr = orig_stderr
|
25
|
+
end
|
26
|
+
|
27
|
+
# Method stubs $stdin not STDIN !
|
28
|
+
def self.provide_stdin(input, &block)
|
29
|
+
orig_stdin = $stdin
|
30
|
+
$stdin = StringIO.new(input)
|
31
|
+
yield
|
32
|
+
ensure
|
33
|
+
$stdin = orig_stdin
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.capture_output(&block)
|
37
|
+
capture_io(&block)[:stdout]
|
38
|
+
end
|
39
|
+
def self.capture_stderr(&block)
|
40
|
+
capture_io(&block)[:stderr]
|
41
|
+
end
|
42
|
+
|
6
43
|
def self.obtain_pvalue_by_threshold(args)
|
7
|
-
|
44
|
+
find_pvalue_output(args).strip.split.last
|
8
45
|
end
|
9
46
|
def self.exec_cmd(executable, param_list)
|
10
|
-
"ruby -I #{$lib_folder} #{$lib_folder}
|
47
|
+
"ruby -I #{$lib_folder} #{$lib_folder}/../bin/#{executable} #{param_list}"
|
48
|
+
end
|
49
|
+
def self.find_threshold_output(param_list)
|
50
|
+
capture_output{ Macroape::CLI::FindThreshold.main(param_list.split) }
|
51
|
+
end
|
52
|
+
def self.align_motifs_output(param_list)
|
53
|
+
capture_output{ Macroape::CLI::AlignMotifs.main(param_list.split) }
|
54
|
+
end
|
55
|
+
def self.find_pvalue_output(param_list)
|
56
|
+
capture_output{ Macroape::CLI::FindPValue.main(param_list.split) }
|
57
|
+
end
|
58
|
+
def self.eval_similarity_output(param_list)
|
59
|
+
capture_output{ Macroape::CLI::EvalSimilarity.main(param_list.split) }
|
60
|
+
end
|
61
|
+
def self.eval_alignment_output(param_list)
|
62
|
+
capture_output{ Macroape::CLI::EvalAlignment.main(param_list.split) }
|
63
|
+
end
|
64
|
+
def self.scan_collection_output(param_list)
|
65
|
+
capture_output{ Macroape::CLI::ScanCollection.main(param_list.split) }
|
66
|
+
end
|
67
|
+
def self.run_preprocess_collection(param_list)
|
68
|
+
Macroape::CLI::PreprocessCollection.main(param_list.split)
|
11
69
|
end
|
70
|
+
|
12
71
|
end
|