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,496 +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: LengthRankValidation
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 (L)</a> &raquo;
35
-
36
-
37
- <span class="title">LengthRankValidation</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: LengthRankValidation
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">LengthRankValidation</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_length_rank.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 length validation by ranking
108
- the hit lengths</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="#threshold-instance_method" title="#threshold (instance method)">- (Object) <strong>threshold</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 threshold.</p>
147
- </div></span>
148
-
149
- </li>
150
-
151
-
152
- </ul>
153
-
154
-
155
-
156
-
157
-
158
- <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="ValidationTest.html" title="ValidationTest (class)">ValidationTest</a></span></h3>
159
- <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>
160
-
161
-
162
-
163
- <h2>
164
- Instance Method Summary
165
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
166
- </h2>
167
-
168
- <ul class="summary">
169
-
170
- <li class="public ">
171
- <span class="summary_signature">
172
-
173
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (LengthRankValidation) <strong>initialize</strong>(type, prediction, hits, threshold = 0.2) </a>
174
-
175
-
176
-
177
- </span>
178
-
179
-
180
- <span class="note title constructor">constructor</span>
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
- <span class="summary_desc"><div class='inline'>
190
- <p>Initilizes the object Params: <tt>hits</tt>: a vector of <tt>Sequence</tt>
191
- objects (usually representig the blast hits) <tt>prediction</tt>: a
192
- <tt>Sequence</tt> object representing the blast query <tt>threashold</tt>:
193
- threashold below which the prediction length rank is considered to be
194
- inadequate.</p>
195
- </div></span>
196
-
197
- </li>
198
-
199
-
200
- <li class="public ">
201
- <span class="summary_signature">
202
-
203
- <a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong>(hits = @hits, prediction = @prediction) </a>
204
-
205
-
206
-
207
- </span>
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
- <span class="summary_desc"><div class='inline'>
218
- <p>Calculates a precentage based on the rank of the predicion among the hit
219
- lengths Params: <tt>hits</tt> (optional): a vector of <tt>Sequence</tt>
220
- objects <tt>prediction</tt> (optional): a <tt>Sequence</tt> object Output:
221
- <tt>LengthRankValidationOutput</tt> object.</p>
222
- </div></span>
223
-
224
- </li>
225
-
226
-
227
- </ul>
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
- <div id="constructor_details" class="method_details_list">
237
- <h2>Constructor Details</h2>
238
-
239
- <div class="method_details first">
240
- <h3 class="signature first" id="initialize-instance_method">
241
-
242
- - (<tt><span class='object_link'><a href="" title="LengthRankValidation (class)">LengthRankValidation</a></span></tt>) <strong>initialize</strong>(type, prediction, hits, threshold = 0.2)
243
-
244
-
245
-
246
-
247
-
248
- </h3><div class="docstring">
249
- <div class="discussion">
250
-
251
- <p>Initilizes the object Params: <tt>hits</tt>: a vector of <tt>Sequence</tt>
252
- objects (usually representig the blast hits) <tt>prediction</tt>: a
253
- <tt>Sequence</tt> object representing the blast query <tt>threashold</tt>:
254
- threashold below which the prediction length rank is considered to be
255
- inadequate</p>
256
-
257
-
258
- </div>
259
- </div>
260
- <div class="tags">
261
-
262
-
263
- </div><table class="source_code">
264
- <tr>
265
- <td>
266
- <pre class="lines">
267
-
268
-
269
- 49
270
- 50
271
- 51
272
- 52
273
- 53
274
- 54
275
- 55
276
- 56
277
- 57</pre>
278
- </td>
279
- <td>
280
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_rank.rb', line 49</span>
281
-
282
- <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_threshold'>threshold</span> <span class='op'>=</span> <span class='float'>0.2</span><span class='rparen'>)</span>
283
- <span class='kw'>super</span>
284
- <span class='ivar'>@threshold</span> <span class='op'>=</span> <span class='id identifier rubyid_threshold'>threshold</span>
285
- <span class='ivar'>@short_header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LengthRank</span><span class='tstring_end'>&quot;</span></span>
286
- <span class='ivar'>@header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Length Rank</span><span class='tstring_end'>&quot;</span></span>
287
- <span class='ivar'>@description</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Check whether the rank of the prediction length lies among 80% of </span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
288
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>all the BLAST hit lengths. Meaning of the output displayed: no of extreme length hits / total no of hits</span><span class='tstring_end'>&quot;</span></span>
289
- <span class='ivar'>@cli_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>lenr</span><span class='tstring_end'>&quot;</span></span>
290
- <span class='kw'>end</span></pre>
291
- </td>
292
- </tr>
293
- </table>
294
- </div>
295
-
296
- </div>
297
-
298
- <div id="instance_attr_details" class="attr_details">
299
- <h2>Instance Attribute Details</h2>
300
-
301
-
302
- <span id=""></span>
303
- <div class="method_details first">
304
- <h3 class="signature first" id="threshold-instance_method">
305
-
306
- - (<tt>Object</tt>) <strong>threshold</strong> <span class="extras">(readonly)</span>
307
-
308
-
309
-
310
-
311
-
312
- </h3><div class="docstring">
313
- <div class="discussion">
314
-
315
- <p>Returns the value of attribute threshold</p>
316
-
317
-
318
- </div>
319
- </div>
320
- <div class="tags">
321
-
322
-
323
- </div><table class="source_code">
324
- <tr>
325
- <td>
326
- <pre class="lines">
327
-
328
-
329
- 41
330
- 42
331
- 43</pre>
332
- </td>
333
- <td>
334
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_rank.rb', line 41</span>
335
-
336
- <span class='kw'>def</span> <span class='id identifier rubyid_threshold'>threshold</span>
337
- <span class='ivar'>@threshold</span>
338
- <span class='kw'>end</span></pre>
339
- </td>
340
- </tr>
341
- </table>
342
- </div>
343
-
344
- </div>
345
-
346
-
347
- <div id="instance_method_details" class="method_details_list">
348
- <h2>Instance Method Details</h2>
349
-
350
-
351
- <div class="method_details first">
352
- <h3 class="signature first" id="run-instance_method">
353
-
354
- - (<tt>Object</tt>) <strong>run</strong>(hits = @hits, prediction = @prediction)
355
-
356
-
357
-
358
-
359
-
360
- </h3><div class="docstring">
361
- <div class="discussion">
362
-
363
- <p>Calculates a precentage based on the rank of the predicion among the hit
364
- lengths Params: <tt>hits</tt> (optional): a vector of <tt>Sequence</tt>
365
- objects <tt>prediction</tt> (optional): a <tt>Sequence</tt> object Output:
366
- <tt>LengthRankValidationOutput</tt> object</p>
367
-
368
-
369
- </div>
370
- </div>
371
- <div class="tags">
372
-
373
-
374
- </div><table class="source_code">
375
- <tr>
376
- <td>
377
- <pre class="lines">
378
-
379
-
380
- 66
381
- 67
382
- 68
383
- 69
384
- 70
385
- 71
386
- 72
387
- 73
388
- 74
389
- 75
390
- 76
391
- 77
392
- 78
393
- 79
394
- 80
395
- 81
396
- 82
397
- 83
398
- 84
399
- 85
400
- 86
401
- 87
402
- 88
403
- 89
404
- 90
405
- 91
406
- 92
407
- 93
408
- 94
409
- 95
410
- 96
411
- 97
412
- 98
413
- 99
414
- 100
415
- 101
416
- 102
417
- 103
418
- 104
419
- 105
420
- 106
421
- 107
422
- 108
423
- 109
424
- 110
425
- 111
426
- 112
427
- 113</pre>
428
- </td>
429
- <td>
430
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_rank.rb', line 66</span>
431
-
432
- <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_hits'>hits</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='comma'>,</span> <span class='id identifier rubyid_prediction'>prediction</span> <span class='op'>=</span> <span class='ivar'>@prediction</span><span class='rparen'>)</span>
433
- <span class='kw'>begin</span>
434
- <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>
435
- <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>
436
- <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>
437
-
438
- <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_now'>now</span>
439
-
440
- <span class='id identifier rubyid_lengths'>lengths</span> <span class='op'>=</span> <span class='id identifier rubyid_hits'>hits</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_length_protein'>length_protein</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='op'>&lt;=&gt;</span><span class='id identifier rubyid_b'>b</span><span class='rbrace'>}</span>
441
- <span class='id identifier rubyid_len'>len</span> <span class='op'>=</span> <span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
442
- <span class='id identifier rubyid_median'>median</span> <span class='op'>=</span> <span class='id identifier rubyid_len'>len</span> <span class='op'>%</span> <span class='int'>2</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>?</span>
443
- <span class='id identifier rubyid_lengths'>lengths</span><span class='lbracket'>[</span><span class='id identifier rubyid_len'>len</span><span class='op'>/</span><span class='int'>2</span><span class='rbracket'>]</span> <span class='op'>:</span>
444
- <span class='lparen'>(</span><span class='id identifier rubyid_lengths'>lengths</span><span class='lbracket'>[</span><span class='id identifier rubyid_len'>len</span><span class='op'>/</span><span class='int'>2</span> <span class='op'>-</span> <span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='id identifier rubyid_lengths'>lengths</span><span class='lbracket'>[</span><span class='id identifier rubyid_len'>len</span><span class='op'>/</span><span class='int'>2</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span> <span class='op'>/</span> <span class='int'>2</span>
445
-
446
- <span class='id identifier rubyid_predicted_len'>predicted_len</span> <span class='op'>=</span> <span class='id identifier rubyid_prediction'>prediction</span><span class='period'>.</span><span class='id identifier rubyid_length_protein'>length_protein</span>
447
-
448
- <span class='kw'>if</span> <span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span>
449
- <span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
450
- <span class='id identifier rubyid_percentage'>percentage</span> <span class='op'>=</span> <span class='int'>1</span>
451
- <span class='kw'>else</span>
452
- <span class='kw'>if</span> <span class='id identifier rubyid_predicted_len'>predicted_len</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_median'>median</span>
453
- <span class='id identifier rubyid_rank'>rank</span> <span class='op'>=</span> <span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</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'>&lt;</span> <span class='id identifier rubyid_predicted_len'>predicted_len</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
454
- <span class='id identifier rubyid_percentage'>percentage</span> <span class='op'>=</span> <span class='id identifier rubyid_rank'>rank</span> <span class='op'>/</span> <span class='lparen'>(</span><span class='id identifier rubyid_len'>len</span> <span class='op'>+</span> <span class='float'>0.0</span><span class='rparen'>)</span>
455
- <span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TOO_SHORT</span><span class='tstring_end'>&quot;</span></span>
456
- <span class='kw'>else</span>
457
- <span class='id identifier rubyid_rank'>rank</span> <span class='op'>=</span> <span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</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'>&gt;</span> <span class='id identifier rubyid_predicted_len'>predicted_len</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
458
- <span class='id identifier rubyid_percentage'>percentage</span> <span class='op'>=</span> <span class='id identifier rubyid_rank'>rank</span> <span class='op'>/</span> <span class='lparen'>(</span><span class='id identifier rubyid_len'>len</span> <span class='op'>+</span> <span class='float'>0.0</span><span class='rparen'>)</span>
459
- <span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TOO_LONG</span><span class='tstring_end'>&quot;</span></span>
460
- <span class='kw'>end</span>
461
- <span class='kw'>end</span>
462
-
463
- <span class='kw'>if</span> <span class='id identifier rubyid_percentage'>percentage</span> <span class='op'>&gt;=</span> <span class='id identifier rubyid_threshold'>threshold</span>
464
- <span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
465
- <span class='kw'>end</span>
466
-
467
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>LengthRankValidationOutput</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='comma'>,</span> <span class='id identifier rubyid_percentage'>percentage</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='rparen'>)</span>
468
- <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>
469
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
470
-
471
- <span class='comment'># Exception is raised when blast founds no hits
472
- </span> <span class='kw'>rescue</span> <span class='const'>NotEnoughHitsError</span><span class='comment'>#Exception
473
- </span> <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>
474
- <span class='kw'>else</span>
475
- <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>
476
- <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>
477
- <span class='kw'>end</span>
478
-
479
- <span class='kw'>end</span></pre>
480
- </td>
481
- </tr>
482
- </table>
483
- </div>
484
-
485
- </div>
486
-
487
- </div>
488
-
489
- <div id="footer">
490
- Generated on Sat Sep 28 07:01:33 2013 by
491
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
492
- 0.8.7.2 (ruby-1.9.3).
493
- </div>
494
-
495
- </body>
496
- </html>