genevalidator 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.travis.yml +2 -0
  4. data/README.md +78 -30
  5. data/Rakefile +11 -8
  6. data/aux/app_template_footer.erb +1 -6
  7. data/aux/app_template_header.erb +12 -32
  8. data/aux/files/css/style.css +2 -8
  9. data/aux/files/js/plots.js +564 -576
  10. data/aux/files/js/script.js +10 -0
  11. data/aux/json_footer.erb +8 -0
  12. data/aux/json_header.erb +19 -0
  13. data/aux/json_query.erb +14 -0
  14. data/aux/template_footer.erb +9 -58
  15. data/aux/template_header.erb +18 -58
  16. data/aux/template_query.erb +8 -36
  17. data/bin/genevalidator +45 -32
  18. data/genevalidator.gemspec +11 -7
  19. data/lib/genevalidator.rb +75 -455
  20. data/lib/genevalidator/arg_validation.rb +78 -107
  21. data/lib/genevalidator/blast.rb +57 -60
  22. data/lib/genevalidator/clusterization.rb +15 -15
  23. data/lib/genevalidator/exceptions.rb +32 -5
  24. data/lib/genevalidator/get_raw_sequences.rb +70 -33
  25. data/lib/genevalidator/hsp.rb +1 -4
  26. data/lib/genevalidator/json_to_gv_results.rb +109 -0
  27. data/lib/genevalidator/output.rb +177 -185
  28. data/lib/genevalidator/pool.rb +2 -1
  29. data/lib/genevalidator/sequences.rb +3 -3
  30. data/lib/genevalidator/tabular_parser.rb +24 -18
  31. data/lib/genevalidator/validation.rb +279 -0
  32. data/lib/genevalidator/validation_alignment.rb +31 -47
  33. data/lib/genevalidator/validation_blast_reading_frame.rb +19 -18
  34. data/lib/genevalidator/validation_duplication.rb +23 -19
  35. data/lib/genevalidator/validation_gene_merge.rb +30 -65
  36. data/lib/genevalidator/validation_length_cluster.rb +14 -53
  37. data/lib/genevalidator/validation_length_rank.rb +10 -11
  38. data/lib/genevalidator/validation_open_reading_frame.rb +18 -19
  39. data/lib/genevalidator/validation_report.rb +2 -5
  40. data/lib/genevalidator/validation_test.rb +8 -4
  41. data/lib/genevalidator/version.rb +1 -1
  42. data/test/test_all_validations.rb +51 -66
  43. data/test/test_blast.rb +68 -51
  44. data/test/test_clusterization.rb +1 -1
  45. data/test/test_clusterization_2d.rb +19 -13
  46. data/test/test_extended_array_methods.rb +1 -1
  47. data/test/test_files/all_validations_mrna/mrna.blast_tab6 +1806 -0
  48. data/test/test_files/all_validations_mrna/mrna.blast_tab7 +1865 -0
  49. data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta.blast_xml → mrna.blast_xml} +18642 -1
  50. data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta.blast_xml.index → mrna.blast_xml.index} +300 -0
  51. data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta → mrna.fa} +0 -0
  52. data/test/test_files/all_validations_mrna/mrna.raw_seq +3970 -0
  53. data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta.blast_xml.raw_seq.idx → mrna.raw_seq.idx} +901 -1
  54. data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_tab → prot.blast_tab6} +416 -0
  55. data/test/test_files/all_validations_prot/prot.blast_tab7 +2400 -0
  56. data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml → prot.blast_xml} +18299 -6723
  57. data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml.index → prot.blast_xml.index} +408 -0
  58. data/test/test_files/all_validations_prot/{all_validations_prot.fasta → prot.fa} +0 -0
  59. data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml.raw_seq → prot.raw_seq} +2735 -0
  60. data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml.raw_seq.idx → prot.raw_seq.idx} +3032 -1808
  61. data/test/test_sequences.rb +46 -41
  62. data/test/test_validation_open_reading_frame.rb +318 -202
  63. data/test/test_validations.rb +48 -32
  64. metadata +76 -102
  65. data/doc/AliasDuplicationError.html +0 -134
  66. data/doc/AlignmentValidation.html +0 -1687
  67. data/doc/AlignmentValidationOutput.html +0 -659
  68. data/doc/Blast.html +0 -1905
  69. data/doc/BlastRFValidationOutput.html +0 -545
  70. data/doc/BlastReadingFrameValidation.html +0 -370
  71. data/doc/BlastUtils.html +0 -875
  72. data/doc/ClasspathError.html +0 -134
  73. data/doc/Cluster.html +0 -1316
  74. data/doc/DuplciationValidationOutput.html +0 -564
  75. data/doc/DuplicationValidation.html +0 -920
  76. data/doc/DuplicationValidationOutput.html +0 -564
  77. data/doc/FileNotFoundException.html +0 -134
  78. data/doc/GeneMergeValidation.html +0 -935
  79. data/doc/GeneMergeValidationOutput.html +0 -652
  80. data/doc/HierarchicalClusterization.html +0 -994
  81. data/doc/Hsp.html +0 -1485
  82. data/doc/InconsistentTabularFormat.html +0 -135
  83. data/doc/LengthClusterValidation.html +0 -982
  84. data/doc/LengthClusterValidationOutput.html +0 -515
  85. data/doc/LengthRankValidation.html +0 -496
  86. data/doc/LengthRankValidationOutput.html +0 -517
  87. data/doc/NoInternetError.html +0 -135
  88. data/doc/NoMafftInstallationError.html +0 -134
  89. data/doc/NoPIdentError.html +0 -134
  90. data/doc/NoValidationError.html +0 -134
  91. data/doc/NotEnoughHitsError.html +0 -135
  92. data/doc/ORFValidationOutput.html +0 -593
  93. data/doc/OpenReadingFrameValidation.html +0 -1107
  94. data/doc/OtherError.html +0 -123
  95. data/doc/Output.html +0 -1540
  96. data/doc/Pair.html +0 -309
  97. data/doc/PairCluster.html +0 -767
  98. data/doc/Plot.html +0 -837
  99. data/doc/QueryError.html +0 -134
  100. data/doc/ReportClassError.html +0 -135
  101. data/doc/Sequence.html +0 -1299
  102. data/doc/SequenceTypeError.html +0 -135
  103. data/doc/TabularEntry.html +0 -837
  104. data/doc/TabularParser.html +0 -1104
  105. data/doc/Validation.html +0 -2147
  106. data/doc/ValidationClassError.html +0 -134
  107. data/doc/ValidationOutput.html +0 -460
  108. data/doc/ValidationReport.html +0 -940
  109. data/doc/ValidationTest.html +0 -939
  110. data/doc/_index.html +0 -449
  111. data/doc/class_list.html +0 -54
  112. data/doc/css/common.css +0 -1
  113. data/doc/css/full_list.css +0 -57
  114. data/doc/css/style.css +0 -338
  115. data/doc/file.README.html +0 -151
  116. data/doc/file_list.html +0 -56
  117. data/doc/frames.html +0 -26
  118. data/doc/index.html +0 -151
  119. data/doc/js/app.js +0 -214
  120. data/doc/js/full_list.js +0 -178
  121. data/doc/js/jquery.js +0 -4
  122. data/doc/method_list.html +0 -1505
  123. data/doc/top-level-namespace.html +0 -112
  124. data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab +0 -967
  125. data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab.index +0 -967
  126. data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab.raw_seq +0 -4929
  127. data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab.raw_seq.idx +0 -1006
  128. data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_xml.raw_seq +0 -2075
  129. data/test/test_files/all_validations_prot/all_validations_prot.fasta.blast_tab.index +0 -1864
  130. data/test/test_files/all_validations_prot/all_validations_prot.fasta.blast_tab.raw_seq +0 -42411
  131. data/test/test_files/all_validations_prot/all_validations_prot.fasta.blast_tab.raw_seq.idx +0 -3751
@@ -1,920 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- Class: DuplicationValidation
8
-
9
- &mdash; Documentation by YARD 0.8.7.2
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- hasFrames = window.top.frames.main ? true : false;
19
- relpath = '';
20
- framesUrl = "frames.html#!" + escape(window.location.href);
21
- </script>
22
-
23
-
24
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
-
26
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
-
28
-
29
- </head>
30
- <body>
31
- <div id="header">
32
- <div id="menu">
33
-
34
- <a href="_index.html">Index (D)</a> &raquo;
35
-
36
-
37
- <span class="title">DuplicationValidation</span>
38
-
39
-
40
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
- </div>
42
-
43
- <div id="search">
44
-
45
- <a class="full_list_link" id="class_list_link"
46
- href="class_list.html">
47
- Class List
48
- </a>
49
-
50
- <a class="full_list_link" id="method_list_link"
51
- href="method_list.html">
52
- Method List
53
- </a>
54
-
55
- <a class="full_list_link" id="file_list_link"
56
- href="file_list.html">
57
- File List
58
- </a>
59
-
60
- </div>
61
- <div class="clear"></div>
62
- </div>
63
-
64
- <iframe id="search_frame"></iframe>
65
-
66
- <div id="content"><h1>Class: DuplicationValidation
67
-
68
-
69
-
70
- </h1>
71
-
72
- <dl class="box">
73
-
74
- <dt class="r1">Inherits:</dt>
75
- <dd class="r1">
76
- <span class="inheritName"><span class='object_link'><a href="ValidationTest.html" title="ValidationTest (class)">ValidationTest</a></span></span>
77
-
78
- <ul class="fullTree">
79
- <li>Object</li>
80
-
81
- <li class="next"><span class='object_link'><a href="ValidationTest.html" title="ValidationTest (class)">ValidationTest</a></span></li>
82
-
83
- <li class="next">DuplicationValidation</li>
84
-
85
- </ul>
86
- <a href="#" class="inheritanceTree">show all</a>
87
-
88
- </dd>
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
- <dt class="r2 last">Defined in:</dt>
99
- <dd class="r2 last">lib/genevalidator/validation_duplication.rb</dd>
100
-
101
- </dl>
102
- <div class="clear"></div>
103
-
104
- <h2>Overview</h2><div class="docstring">
105
- <div class="discussion">
106
-
107
- <p>This class contains the methods necessary for finding duplicated
108
- subsequences in the predicted gene</p>
109
-
110
-
111
- </div>
112
- </div>
113
- <div class="tags">
114
-
115
-
116
- </div>
117
-
118
-
119
-
120
- <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
121
- <ul class="summary">
122
-
123
- <li class="public ">
124
- <span class="summary_signature">
125
-
126
- <a href="#index_file_name-instance_method" title="#index_file_name (instance method)">- (Object) <strong>index_file_name</strong> </a>
127
-
128
-
129
-
130
- </span>
131
-
132
-
133
-
134
-
135
- <span class="note title readonly">readonly</span>
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
- <span class="summary_desc"><div class='inline'>
146
- <p>Returns the value of attribute index_file_name.</p>
147
- </div></span>
148
-
149
- </li>
150
-
151
-
152
- <li class="public ">
153
- <span class="summary_signature">
154
-
155
- <a href="#mafft_path-instance_method" title="#mafft_path (instance method)">- (Object) <strong>mafft_path</strong> </a>
156
-
157
-
158
-
159
- </span>
160
-
161
-
162
-
163
-
164
- <span class="note title readonly">readonly</span>
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
- <span class="summary_desc"><div class='inline'>
175
- <p>Returns the value of attribute mafft_path.</p>
176
- </div></span>
177
-
178
- </li>
179
-
180
-
181
- </ul>
182
-
183
-
184
-
185
-
186
-
187
- <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="ValidationTest.html" title="ValidationTest (class)">ValidationTest</a></span></h3>
188
- <p class="inherited"><span class='object_link'><a href="ValidationTest.html#cli_name-instance_method" title="ValidationTest#cli_name (method)">#cli_name</a></span>, <span class='object_link'><a href="ValidationTest.html#description-instance_method" title="ValidationTest#description (method)">#description</a></span>, <span class='object_link'><a href="ValidationTest.html#header-instance_method" title="ValidationTest#header (method)">#header</a></span>, <span class='object_link'><a href="ValidationTest.html#hits-instance_method" title="ValidationTest#hits (method)">#hits</a></span>, <span class='object_link'><a href="ValidationTest.html#prediction-instance_method" title="ValidationTest#prediction (method)">#prediction</a></span>, <span class='object_link'><a href="ValidationTest.html#running_time-instance_method" title="ValidationTest#running_time (method)">#running_time</a></span>, <span class='object_link'><a href="ValidationTest.html#short_header-instance_method" title="ValidationTest#short_header (method)">#short_header</a></span>, <span class='object_link'><a href="ValidationTest.html#type-instance_method" title="ValidationTest#type (method)">#type</a></span>, <span class='object_link'><a href="ValidationTest.html#validation_report-instance_method" title="ValidationTest#validation_report (method)">#validation_report</a></span></p>
189
-
190
-
191
-
192
- <h2>
193
- Instance Method Summary
194
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
195
- </h2>
196
-
197
- <ul class="summary">
198
-
199
- <li class="public ">
200
- <span class="summary_signature">
201
-
202
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (DuplicationValidation) <strong>initialize</strong>(type, prediction, hits, mafft_path, index_file_name) </a>
203
-
204
-
205
-
206
- </span>
207
-
208
-
209
- <span class="note title constructor">constructor</span>
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
- <span class="summary_desc"><div class='inline'>
219
- <p>A new instance of DuplicationValidation.</p>
220
- </div></span>
221
-
222
- </li>
223
-
224
-
225
- <li class="public ">
226
- <span class="summary_signature">
227
-
228
- <a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong>(n = 10) </a>
229
-
230
-
231
-
232
- </span>
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
- <span class="summary_desc"><div class='inline'>
243
- <p>Check duplication in the first n hits Output:
244
- <tt>DuplicationValidationOutput</tt> object.</p>
245
- </div></span>
246
-
247
- </li>
248
-
249
-
250
- <li class="public ">
251
- <span class="summary_signature">
252
-
253
- <a href="#wilcox_test-instance_method" title="#wilcox_test (instance method)">- (Object) <strong>wilcox_test</strong>(averages) </a>
254
-
255
-
256
-
257
- </span>
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
- <span class="summary_desc"><div class='inline'>
268
- <p>wilcox test implementation from statsample ruby gem many thanks to Claudio
269
- for helping us with the implementation!.</p>
270
- </div></span>
271
-
272
- </li>
273
-
274
-
275
- <li class="public ">
276
- <span class="summary_signature">
277
-
278
- <a href="#wilcox_test_R-instance_method" title="#wilcox_test_R (instance method)">- (Object) <strong>wilcox_test_R</strong>(averages) </a>
279
-
280
-
281
-
282
- </span>
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
- <span class="summary_desc"><div class='inline'>
293
- <p>Calls R to calculate the p value for the wilcoxon-test Input
294
- <tt>vector</tt> Array of values with nonparametric distribution.</p>
295
- </div></span>
296
-
297
- </li>
298
-
299
-
300
- </ul>
301
-
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
- <div id="constructor_details" class="method_details_list">
310
- <h2>Constructor Details</h2>
311
-
312
- <div class="method_details first">
313
- <h3 class="signature first" id="initialize-instance_method">
314
-
315
- - (<tt><span class='object_link'><a href="" title="DuplicationValidation (class)">DuplicationValidation</a></span></tt>) <strong>initialize</strong>(type, prediction, hits, mafft_path, index_file_name)
316
-
317
-
318
-
319
-
320
-
321
- </h3><div class="docstring">
322
- <div class="discussion">
323
-
324
- <p>Returns a new instance of DuplicationValidation</p>
325
-
326
-
327
- </div>
328
- </div>
329
- <div class="tags">
330
-
331
-
332
- </div><table class="source_code">
333
- <tr>
334
- <td>
335
- <pre class="lines">
336
-
337
-
338
- 47
339
- 48
340
- 49
341
- 50
342
- 51
343
- 52
344
- 53
345
- 54
346
- 55
347
- 56
348
- 57
349
- 58
350
- 59
351
- 60</pre>
352
- </td>
353
- <td>
354
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_duplication.rb', line 47</span>
355
-
356
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_prediction'>prediction</span><span class='comma'>,</span> <span class='id identifier rubyid_hits'>hits</span><span class='comma'>,</span> <span class='id identifier rubyid_mafft_path'>mafft_path</span><span class='comma'>,</span> <span class='id identifier rubyid_index_file_name'>index_file_name</span><span class='rparen'>)</span>
357
- <span class='kw'>super</span>
358
- <span class='ivar'>@mafft_path</span> <span class='op'>=</span> <span class='id identifier rubyid_mafft_path'>mafft_path</span>
359
- <span class='ivar'>@index_file_name</span> <span class='op'>=</span> <span class='id identifier rubyid_index_file_name'>index_file_name</span>
360
- <span class='ivar'>@short_header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Duplication</span><span class='tstring_end'>&quot;</span></span>
361
- <span class='ivar'>@header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Duplication</span><span class='tstring_end'>&quot;</span></span>
362
- <span class='ivar'>@description</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Check whether there is a duplicated subsequence in the</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
363
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> predicted gene by counting the hsp residue coverag of the prediction,</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
364
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> for each hit. Meaning of the output displayed: P-value of the Wilcoxon</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
365
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> test which test the distribution of hit average coverage against 1.</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
366
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> P-values higher than 5% pass the validation test.</span><span class='tstring_end'>&quot;</span></span>
367
- <span class='ivar'>@cli_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>dup</span><span class='tstring_end'>&quot;</span></span>
368
-
369
- <span class='kw'>end</span></pre>
370
- </td>
371
- </tr>
372
- </table>
373
- </div>
374
-
375
- </div>
376
-
377
- <div id="instance_attr_details" class="attr_details">
378
- <h2>Instance Attribute Details</h2>
379
-
380
-
381
- <span id=""></span>
382
- <div class="method_details first">
383
- <h3 class="signature first" id="index_file_name-instance_method">
384
-
385
- - (<tt>Object</tt>) <strong>index_file_name</strong> <span class="extras">(readonly)</span>
386
-
387
-
388
-
389
-
390
-
391
- </h3><div class="docstring">
392
- <div class="discussion">
393
-
394
- <p>Returns the value of attribute index_file_name</p>
395
-
396
-
397
- </div>
398
- </div>
399
- <div class="tags">
400
-
401
-
402
- </div><table class="source_code">
403
- <tr>
404
- <td>
405
- <pre class="lines">
406
-
407
-
408
- 45
409
- 46
410
- 47</pre>
411
- </td>
412
- <td>
413
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_duplication.rb', line 45</span>
414
-
415
- <span class='kw'>def</span> <span class='id identifier rubyid_index_file_name'>index_file_name</span>
416
- <span class='ivar'>@index_file_name</span>
417
- <span class='kw'>end</span></pre>
418
- </td>
419
- </tr>
420
- </table>
421
- </div>
422
-
423
-
424
- <span id=""></span>
425
- <div class="method_details ">
426
- <h3 class="signature " id="mafft_path-instance_method">
427
-
428
- - (<tt>Object</tt>) <strong>mafft_path</strong> <span class="extras">(readonly)</span>
429
-
430
-
431
-
432
-
433
-
434
- </h3><div class="docstring">
435
- <div class="discussion">
436
-
437
- <p>Returns the value of attribute mafft_path</p>
438
-
439
-
440
- </div>
441
- </div>
442
- <div class="tags">
443
-
444
-
445
- </div><table class="source_code">
446
- <tr>
447
- <td>
448
- <pre class="lines">
449
-
450
-
451
- 44
452
- 45
453
- 46</pre>
454
- </td>
455
- <td>
456
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_duplication.rb', line 44</span>
457
-
458
- <span class='kw'>def</span> <span class='id identifier rubyid_mafft_path'>mafft_path</span>
459
- <span class='ivar'>@mafft_path</span>
460
- <span class='kw'>end</span></pre>
461
- </td>
462
- </tr>
463
- </table>
464
- </div>
465
-
466
- </div>
467
-
468
-
469
- <div id="instance_method_details" class="method_details_list">
470
- <h2>Instance Method Details</h2>
471
-
472
-
473
- <div class="method_details first">
474
- <h3 class="signature first" id="run-instance_method">
475
-
476
- - (<tt>Object</tt>) <strong>run</strong>(n = 10)
477
-
478
-
479
-
480
-
481
-
482
- </h3><div class="docstring">
483
- <div class="discussion">
484
-
485
- <p>Check duplication in the first n hits Output:
486
- <tt>DuplicationValidationOutput</tt> object</p>
487
-
488
-
489
- </div>
490
- </div>
491
- <div class="tags">
492
-
493
-
494
- </div><table class="source_code">
495
- <tr>
496
- <td>
497
- <pre class="lines">
498
-
499
-
500
- 66
501
- 67
502
- 68
503
- 69
504
- 70
505
- 71
506
- 72
507
- 73
508
- 74
509
- 75
510
- 76
511
- 77
512
- 78
513
- 79
514
- 80
515
- 81
516
- 82
517
- 83
518
- 84
519
- 85
520
- 86
521
- 87
522
- 88
523
- 89
524
- 90
525
- 91
526
- 92
527
- 93
528
- 94
529
- 95
530
- 96
531
- 97
532
- 98
533
- 99
534
- 100
535
- 101
536
- 102
537
- 103
538
- 104
539
- 105
540
- 106
541
- 107
542
- 108
543
- 109
544
- 110
545
- 111
546
- 112
547
- 113
548
- 114
549
- 115
550
- 116
551
- 117
552
- 118
553
- 119
554
- 120
555
- 121
556
- 122
557
- 123
558
- 124
559
- 125
560
- 126
561
- 127
562
- 128
563
- 129
564
- 130
565
- 131
566
- 132
567
- 133
568
- 134
569
- 135
570
- 136
571
- 137
572
- 138
573
- 139
574
- 140
575
- 141
576
- 142
577
- 143
578
- 144
579
- 145
580
- 146
581
- 147
582
- 148
583
- 149
584
- 150
585
- 151
586
- 152
587
- 153
588
- 154
589
- 155
590
- 156
591
- 157
592
- 158
593
- 159
594
- 160
595
- 161
596
- 162
597
- 163
598
- 164
599
- 165
600
- 166
601
- 167
602
- 168
603
- 169
604
- 170
605
- 171
606
- 172
607
- 173
608
- 174
609
- 175
610
- 176
611
- 177
612
- 178
613
- 179
614
- 180
615
- 181
616
- 182
617
- 183
618
- 184
619
- 185
620
- 186
621
- 187
622
- 188
623
- 189
624
- 190
625
- 191
626
- 192
627
- 193
628
- 194
629
- 195
630
- 196</pre>
631
- </td>
632
- <td>
633
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_duplication.rb', line 66</span>
634
-
635
- <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_n'>n</span><span class='op'>=</span><span class='int'>10</span><span class='rparen'>)</span>
636
- <span class='kw'>begin</span>
637
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotEnoughHitsError</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&gt;=</span> <span class='int'>5</span>
638
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exception</span> <span class='kw'>unless</span> <span class='id identifier rubyid_prediction'>prediction</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Sequence</span> <span class='kw'>and</span>
639
- <span class='id identifier rubyid_prediction'>prediction</span><span class='period'>.</span><span class='id identifier rubyid_raw_sequence'>raw_sequence</span> <span class='op'>!=</span> <span class='kw'>nil</span> <span class='kw'>and</span>
640
- <span class='id identifier rubyid_hits'>hits</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Sequence</span>
641
-
642
- <span class='id identifier rubyid_start'>start</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
643
- <span class='comment'># get the first n hits
644
- </span> <span class='id identifier rubyid_less_hits'>less_hits</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='lbracket'>[</span><span class='id identifier rubyid_n'>n</span><span class='op'>-</span><span class='int'>1</span><span class='comma'>,</span><span class='ivar'>@hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='rbracket'>]</span>
645
- <span class='id identifier rubyid_useless_hits'>useless_hits</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
646
- <span class='kw'>begin</span>
647
- <span class='comment'># get raw sequences for less_hits
648
- </span> <span class='id identifier rubyid_less_hits'>less_hits</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='op'>|</span>
649
- <span class='comment'>#get gene by accession number
650
- </span> <span class='kw'>if</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_raw_sequence'>raw_sequence</span> <span class='op'>==</span> <span class='kw'>nil</span>
651
- <span class='comment'>#hit.get_sequence_from_index_file(@index_file_name, hit.identifier)
652
- </span> <span class='kw'>if</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='symbol'>:protein</span>
653
- <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_get_sequence_by_accession_no'>get_sequence_by_accession_no</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_accession_no'>accession_no</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>protein</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
654
- <span class='kw'>else</span>
655
- <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_get_sequence_by_accession_no'>get_sequence_by_accession_no</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_accession_no'>accession_no</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>nucleotide</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
656
- <span class='kw'>end</span>
657
- <span class='kw'>if</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_raw_sequence'>raw_sequence</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
658
- <span class='id identifier rubyid_useless_hits'>useless_hits</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='rparen'>)</span>
659
- <span class='kw'>end</span>
660
- <span class='kw'>end</span>
661
- <span class='kw'>end</span>
662
- <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
663
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoInternetError</span>
664
- <span class='kw'>end</span>
665
- <span class='id identifier rubyid_useless_hits'>useless_hits</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='op'>|</span> <span class='id identifier rubyid_less_hits'>less_hits</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='rparen'>)</span><span class='rbrace'>}</span>
666
-
667
- <span class='kw'>if</span> <span class='id identifier rubyid_less_hits'>less_hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>0</span>
668
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoInternetError</span>
669
- <span class='kw'>end</span>
670
-
671
- <span class='id identifier rubyid_averages'>averages</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
672
-
673
- <span class='id identifier rubyid_less_hits'>less_hits</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='op'>|</span>
674
- <span class='id identifier rubyid_coverage'>coverage</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_length_protein'>length_protein</span><span class='comma'>,</span><span class='int'>0</span><span class='rparen'>)</span>
675
- <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_hsp_list'>hsp_list</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hsp'>hsp</span><span class='op'>|</span>
676
- <span class='comment'># align subsequences from the hit and prediction that match (if it's the case)
677
- </span> <span class='kw'>if</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_alignment'>hit_alignment</span> <span class='op'>!=</span> <span class='kw'>nil</span> <span class='kw'>and</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_query_alignment'>query_alignment</span> <span class='op'>!=</span> <span class='kw'>nil</span>
678
- <span class='id identifier rubyid_hit_alignment'>hit_alignment</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_alignment'>hit_alignment</span>
679
- <span class='id identifier rubyid_query_alignment'>query_alignment</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_query_alignment'>query_alignment</span>
680
- <span class='kw'>else</span>
681
- <span class='comment'># indexing in blast starts from 1
682
- </span> <span class='id identifier rubyid_hit_local'>hit_local</span> <span class='op'>=</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_raw_sequence'>raw_sequence</span><span class='lbracket'>[</span><span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_from'>hit_from</span><span class='op'>-</span><span class='int'>1</span><span class='op'>..</span><span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_to'>hit_to</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span>
683
- <span class='id identifier rubyid_query_local'>query_local</span> <span class='op'>=</span> <span class='id identifier rubyid_prediction'>prediction</span><span class='period'>.</span><span class='id identifier rubyid_raw_sequence'>raw_sequence</span><span class='lbracket'>[</span><span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_from'>match_query_from</span><span class='op'>-</span><span class='int'>1</span><span class='op'>..</span><span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_to'>match_query_to</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span>
684
-
685
- <span class='comment'># in case of nucleotide prediction sequence translate into protein
686
- </span> <span class='comment'># use translate with reading frame 1 because
687
- </span> <span class='comment'># to/from coordinates of the hsp already correspond to the
688
- </span> <span class='comment'># reading frame in which the prediction was read to match this hsp
689
- </span> <span class='kw'>if</span> <span class='ivar'>@type</span> <span class='op'>==</span> <span class='symbol'>:nucleotide</span>
690
- <span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='const'>Bio</span><span class='op'>::</span><span class='const'>Sequence</span><span class='op'>::</span><span class='const'>NA</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_query_local'>query_local</span><span class='rparen'>)</span>
691
- <span class='id identifier rubyid_query_local'>query_local</span> <span class='op'>=</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span>
692
- <span class='kw'>end</span>
693
-
694
- <span class='comment'># local alignment for hit and query
695
- </span> <span class='id identifier rubyid_seqs'>seqs</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_hit_local'>hit_local</span><span class='comma'>,</span> <span class='id identifier rubyid_query_local'>query_local</span><span class='rbracket'>]</span>
696
-
697
- <span class='kw'>begin</span>
698
- <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--maxiterate</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1000</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--localpair</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--quiet</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
699
- <span class='id identifier rubyid_mafft'>mafft</span> <span class='op'>=</span> <span class='const'>Bio</span><span class='op'>::</span><span class='const'>MAFFT</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@mafft_path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
700
- <span class='id identifier rubyid_report'>report</span> <span class='op'>=</span> <span class='id identifier rubyid_mafft'>mafft</span><span class='period'>.</span><span class='id identifier rubyid_query_align'>query_align</span><span class='lparen'>(</span><span class='id identifier rubyid_seqs'>seqs</span><span class='rparen'>)</span>
701
- <span class='id identifier rubyid_raw_align'>raw_align</span> <span class='op'>=</span> <span class='id identifier rubyid_report'>report</span><span class='period'>.</span><span class='id identifier rubyid_alignment'>alignment</span>
702
- <span class='id identifier rubyid_align'>align</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
703
-
704
- <span class='id identifier rubyid_raw_align'>raw_align</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_align'>align</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
705
- <span class='id identifier rubyid_hit_alignment'>hit_alignment</span> <span class='op'>=</span> <span class='id identifier rubyid_align'>align</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
706
- <span class='id identifier rubyid_query_alignment'>query_alignment</span> <span class='op'>=</span> <span class='id identifier rubyid_align'>align</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
707
- <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
708
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoMafftInstallationError</span>
709
- <span class='kw'>end</span>
710
- <span class='kw'>end</span>
711
-
712
- <span class='comment'># check multiple coverage
713
- </span>
714
- <span class='comment'># for each hsp of the curent hit
715
- </span> <span class='comment'># iterate through the alignment and count the matching residues
716
- </span> <span class='lbracket'>[</span><span class='op'>*</span><span class='lparen'>(</span><span class='int'>0</span> <span class='op'>..</span> <span class='id identifier rubyid_hit_alignment'>hit_alignment</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='int'>1</span><span class='rparen'>)</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
717
- <span class='id identifier rubyid_residue_hit'>residue_hit</span> <span class='op'>=</span> <span class='id identifier rubyid_hit_alignment'>hit_alignment</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span>
718
- <span class='id identifier rubyid_residue_query'>residue_query</span> <span class='op'>=</span> <span class='id identifier rubyid_query_alignment'>query_alignment</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span>
719
- <span class='kw'>if</span> <span class='id identifier rubyid_residue_hit'>residue_hit</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span> <span class='kw'>and</span> <span class='id identifier rubyid_residue_hit'>residue_hit</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>+</span><span class='tstring_end'>'</span></span> <span class='kw'>and</span> <span class='id identifier rubyid_residue_hit'>residue_hit</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span>
720
- <span class='kw'>if</span> <span class='id identifier rubyid_residue_hit'>residue_hit</span> <span class='op'>==</span> <span class='id identifier rubyid_residue_query'>residue_query</span>
721
- <span class='comment'># indexing in blast starts from 1
722
- </span> <span class='id identifier rubyid_idx'>idx</span> <span class='op'>=</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_from'>hit_from</span><span class='op'>-</span><span class='int'>1</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='id identifier rubyid_hit_alignment'>hit_alignment</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>-</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
723
- <span class='id identifier rubyid_coverage'>coverage</span><span class='lbracket'>[</span><span class='id identifier rubyid_idx'>idx</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='int'>1</span>
724
- <span class='comment'>#end
725
- </span> <span class='kw'>end</span>
726
- <span class='kw'>end</span>
727
- <span class='kw'>end</span>
728
- <span class='kw'>end</span>
729
- <span class='id identifier rubyid_overlap'>overlap</span> <span class='op'>=</span> <span class='id identifier rubyid_coverage'>coverage</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_x'>x</span><span class='op'>==</span><span class='int'>0</span><span class='rbrace'>}</span>
730
- <span class='kw'>if</span> <span class='id identifier rubyid_overlap'>overlap</span> <span class='op'>!=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
731
- <span class='id identifier rubyid_averages'>averages</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_overlap'>overlap</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='symbol'>:+</span><span class='rparen'>)</span><span class='op'>/</span><span class='lparen'>(</span><span class='id identifier rubyid_overlap'>overlap</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>+</span> <span class='float'>0.0</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_x'>x</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='rbrace'>}</span>
732
- <span class='kw'>end</span>
733
- <span class='kw'>end</span>
734
-
735
- <span class='comment'># if all hsps match only one time
736
- </span> <span class='kw'>if</span> <span class='id identifier rubyid_averages'>averages</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_x'>x</span><span class='op'>==</span><span class='int'>1</span><span class='rbrace'>}</span> <span class='op'>==</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
737
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>DuplicationValidationOutput</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
738
- <span class='ivar'>@running_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='id identifier rubyid_start'>start</span>
739
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
740
- <span class='kw'>end</span>
741
-
742
- <span class='id identifier rubyid_pval'>pval</span> <span class='op'>=</span> <span class='id identifier rubyid_wilcox_test'>wilcox_test</span><span class='lparen'>(</span><span class='id identifier rubyid_averages'>averages</span><span class='rparen'>)</span>
743
-
744
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>DuplicationValidationOutput</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_pval'>pval</span><span class='rparen'>)</span>
745
- <span class='ivar'>@running_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='id identifier rubyid_start'>start</span>
746
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
747
-
748
- <span class='kw'>rescue</span> <span class='const'>NotEnoughHitsError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
749
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>ValidationReport</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Not enough evidence</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:warning</span><span class='rparen'>)</span>
750
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
751
- <span class='kw'>rescue</span> <span class='const'>NoMafftInstallationError</span>
752
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>ValidationReport</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Mafft error</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:error</span><span class='rparen'>)</span>
753
- <span class='ivar'>@validation_report</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='const'>NoMafftInstallationError</span>
754
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
755
- <span class='kw'>rescue</span> <span class='const'>NoInternetError</span>
756
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>ValidationReport</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Internet error</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:error</span><span class='rparen'>)</span>
757
- <span class='ivar'>@validation_report</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='const'>NoInternetError</span>
758
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
759
- <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
760
- <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span>
761
- <span class='ivar'>@validation_report</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='const'>OtherError</span>
762
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>ValidationReport</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unexpected error</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:error</span><span class='rparen'>)</span>
763
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
764
- <span class='kw'>end</span>
765
- <span class='kw'>end</span></pre>
766
- </td>
767
- </tr>
768
- </table>
769
- </div>
770
-
771
- <div class="method_details ">
772
- <h3 class="signature " id="wilcox_test-instance_method">
773
-
774
- - (<tt>Object</tt>) <strong>wilcox_test</strong>(averages)
775
-
776
-
777
-
778
-
779
-
780
- </h3><div class="docstring">
781
- <div class="discussion">
782
-
783
- <p>wilcox test implementation from statsample ruby gem many thanks to Claudio
784
- for helping us with the implementation!</p>
785
-
786
-
787
- </div>
788
- </div>
789
- <div class="tags">
790
-
791
-
792
- </div><table class="source_code">
793
- <tr>
794
- <td>
795
- <pre class="lines">
796
-
797
-
798
- 201
799
- 202
800
- 203
801
- 204
802
- 205
803
- 206
804
- 207
805
- 208
806
- 209</pre>
807
- </td>
808
- <td>
809
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_duplication.rb', line 201</span>
810
-
811
- <span class='kw'>def</span> <span class='id identifier rubyid_wilcox_test'>wilcox_test</span> <span class='lparen'>(</span><span class='id identifier rubyid_averages'>averages</span><span class='rparen'>)</span>
812
- <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>statsample</span><span class='tstring_end'>'</span></span>
813
- <span class='id identifier rubyid_wilcox'>wilcox</span> <span class='op'>=</span> <span class='const'>Statsample</span><span class='op'>::</span><span class='const'>Test</span><span class='period'>.</span><span class='id identifier rubyid_wilcoxon_signed_rank'>wilcoxon_signed_rank</span><span class='lparen'>(</span><span class='id identifier rubyid_averages'>averages</span><span class='period'>.</span><span class='id identifier rubyid_to_scale'>to_scale</span><span class='comma'>,</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_averages'>averages</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='comma'>,</span><span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_scale'>to_scale</span><span class='rparen'>)</span>
814
- <span class='kw'>if</span> <span class='id identifier rubyid_averages'>averages</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&lt;</span> <span class='int'>15</span>
815
- <span class='kw'>return</span> <span class='id identifier rubyid_wilcox'>wilcox</span><span class='period'>.</span><span class='id identifier rubyid_probability_exact'>probability_exact</span>
816
- <span class='kw'>else</span>
817
- <span class='kw'>return</span> <span class='id identifier rubyid_wilcox'>wilcox</span><span class='period'>.</span><span class='id identifier rubyid_probability_z'>probability_z</span>
818
- <span class='kw'>end</span>
819
- <span class='kw'>end</span></pre>
820
- </td>
821
- </tr>
822
- </table>
823
- </div>
824
-
825
- <div class="method_details ">
826
- <h3 class="signature " id="wilcox_test_R-instance_method">
827
-
828
- - (<tt>Object</tt>) <strong>wilcox_test_R</strong>(averages)
829
-
830
-
831
-
832
-
833
-
834
- </h3><div class="docstring">
835
- <div class="discussion">
836
-
837
- <p>Calls R to calculate the p value for the wilcoxon-test Input
838
- <tt>vector</tt> Array of values with nonparametric distribution</p>
839
-
840
-
841
- </div>
842
- </div>
843
- <div class="tags">
844
-
845
-
846
- </div><table class="source_code">
847
- <tr>
848
- <td>
849
- <pre class="lines">
850
-
851
-
852
- 216
853
- 217
854
- 218
855
- 219
856
- 220
857
- 221
858
- 222
859
- 223
860
- 224
861
- 225
862
- 226
863
- 227
864
- 228
865
- 229
866
- 230
867
- 231
868
- 232
869
- 233
870
- 234
871
- 235
872
- 236
873
- 237
874
- 238
875
- 239</pre>
876
- </td>
877
- <td>
878
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_duplication.rb', line 216</span>
879
-
880
- <span class='kw'>def</span> <span class='id identifier rubyid_wilcox_test_R'>wilcox_test_R</span> <span class='lparen'>(</span><span class='id identifier rubyid_averages'>averages</span><span class='rparen'>)</span>
881
- <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rinruby</span><span class='tstring_end'>'</span></span>
882
- <span class='kw'>begin</span>
883
- <span class='id identifier rubyid_original_stdout'>original_stdout</span> <span class='op'>=</span> <span class='gvar'>$stdout</span>
884
- <span class='id identifier rubyid_original_stderr'>original_stderr</span> <span class='op'>=</span> <span class='gvar'>$stderr</span>
885
-
886
- <span class='gvar'>$stdout</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/dev/null</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
887
- <span class='gvar'>$stderr</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/dev/null</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
888
-
889
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_echo'>echo</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enable = nil, stderr = nil, warn = nil</span><span class='tstring_end'>&quot;</span></span>
890
- <span class='comment'>#make the wilcox-test and get the p-value
891
- </span> <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>coverageDistrib = c</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_averages'>averages</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>[</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>]</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>)</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
892
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>coverageDistrib = c</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_averages'>averages</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>[</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>]</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>)</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
893
- <span class='const'>R</span><span class='period'>.</span> <span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pval = wilcox.test(coverageDistrib - 1)$p.value</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
894
-
895
- <span class='id identifier rubyid_pval'>pval</span> <span class='op'>=</span> <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_pull'>pull</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pval</span><span class='tstring_end'>&quot;</span></span>
896
- <span class='gvar'>$stdout</span> <span class='op'>=</span> <span class='id identifier rubyid_original_stdout'>original_stdout</span>
897
- <span class='gvar'>$stderr</span> <span class='op'>=</span> <span class='id identifier rubyid_original_stderr'>original_stderr</span>
898
-
899
- <span class='kw'>return</span> <span class='id identifier rubyid_pval'>pval</span>
900
- <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
901
- <span class='comment'>#return nil
902
- </span> <span class='kw'>end</span>
903
- <span class='kw'>end</span></pre>
904
- </td>
905
- </tr>
906
- </table>
907
- </div>
908
-
909
- </div>
910
-
911
- </div>
912
-
913
- <div id="footer">
914
- Generated on Sat Sep 28 07:01:33 2013 by
915
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
916
- 0.8.7.2 (ruby-1.9.3).
917
- </div>
918
-
919
- </body>
920
- </html>