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,135 +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
- Exception: InconsistentTabularFormat
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 (I)</a> &raquo;
35
-
36
-
37
- <span class="title">InconsistentTabularFormat</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>Exception: InconsistentTabularFormat
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">Exception</span>
77
-
78
- <ul class="fullTree">
79
- <li>Object</li>
80
-
81
- <li class="next">Exception</li>
82
-
83
- <li class="next">InconsistentTabularFormat</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/exceptions.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>Exception raised when the tabular format does not correspond to the tabular
108
- argumet</p>
109
-
110
-
111
- </div>
112
- </div>
113
- <div class="tags">
114
-
115
-
116
- </div>
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
- </div>
127
-
128
- <div id="footer">
129
- Generated on Sat Sep 28 07:01:32 2013 by
130
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
131
- 0.8.7.2 (ruby-1.9.3).
132
- </div>
133
-
134
- </body>
135
- </html>
@@ -1,982 +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: LengthClusterValidation
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">LengthClusterValidation</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: LengthClusterValidation
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">LengthClusterValidation</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_cluster.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 hit
108
- length clusterization</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="#clusters-instance_method" title="#clusters (instance method)">- (Object) <strong>clusters</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 clusters.</p>
147
- </div></span>
148
-
149
- </li>
150
-
151
-
152
- <li class="public ">
153
- <span class="summary_signature">
154
-
155
- <a href="#filename-instance_method" title="#filename (instance method)">- (Object) <strong>filename</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 filename.</p>
176
- </div></span>
177
-
178
- </li>
179
-
180
-
181
- <li class="public ">
182
- <span class="summary_signature">
183
-
184
- <a href="#max_density_cluster-instance_method" title="#max_density_cluster (instance method)">- (Object) <strong>max_density_cluster</strong> </a>
185
-
186
-
187
-
188
- </span>
189
-
190
-
191
-
192
-
193
- <span class="note title readonly">readonly</span>
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
- <span class="summary_desc"><div class='inline'>
204
- <p>Returns the value of attribute max_density_cluster.</p>
205
- </div></span>
206
-
207
- </li>
208
-
209
-
210
- </ul>
211
-
212
-
213
-
214
-
215
-
216
- <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="ValidationTest.html" title="ValidationTest (class)">ValidationTest</a></span></h3>
217
- <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>
218
-
219
-
220
-
221
- <h2>
222
- Instance Method Summary
223
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
224
- </h2>
225
-
226
- <ul class="summary">
227
-
228
- <li class="public ">
229
- <span class="summary_signature">
230
-
231
- <a href="#clusterization_by_length-instance_method" title="#clusterization_by_length (instance method)">- (Object) <strong>clusterization_by_length</strong>(debug = false, lst = @hits, predicted_seq = @prediction) </a>
232
-
233
-
234
-
235
- </span>
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
- <span class="summary_desc"><div class='inline'><table class="rdoc-list"><tr><td class="rdoc-term"><p>Clusterization by length from a list of sequences Params: <tt>debug</tt> (optional)</p></td>
246
- <td><table class="rdoc-list"><tr><td class="rdoc-term"><p>true to display debug information, false by default (optional argument) <tt>lst</tt></p></td>
247
- <td><table class="rdoc-list"><tr><td class="rdoc-term"><p>array of <tt>Sequence</tt> objects <tt>predicted_seq</tt></p></td>
248
- <td><table class="rdoc-list"><tr><td class="rdoc-term"><p><tt>Sequence</tt> objetc Output output 1</p></td>
249
- <td><table class="rdoc-list"><tr><td class="rdoc-term"><p>array of Cluster objects output 2</p></td>
250
- <td>
251
- <p>the index of the most dense cluster.</p>
252
- </td></tr></table>
253
- </td></tr></table>
254
- </td></tr></table>
255
- </td></tr></table>
256
- </td></tr></table>
257
- </div></span>
258
-
259
- </li>
260
-
261
-
262
- <li class="public ">
263
- <span class="summary_signature">
264
-
265
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (LengthClusterValidation) <strong>initialize</strong>(type, prediction, hits, filename) </a>
266
-
267
-
268
-
269
- </span>
270
-
271
-
272
- <span class="note title constructor">constructor</span>
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
- <span class="summary_desc"><div class='inline'>
282
- <p>Initilizes the object Params: <tt>type</tt>: type of the predicted sequence
283
- (:nucleotide or :protein) <tt>prediction</tt>: a <tt>Sequence</tt> object
284
- representing the blast query <tt>hits</tt>: a vector of <tt>Sequence</tt>
285
- objects (usually representig the blast hits).</p>
286
- </div></span>
287
-
288
- </li>
289
-
290
-
291
- <li class="public ">
292
- <span class="summary_signature">
293
-
294
- <a href="#plot_histo_clusters-instance_method" title="#plot_histo_clusters (instance method)">- (Object) <strong>plot_histo_clusters</strong>(output = &quot;#{@filename}_len_clusters.json&quot;, clusters = @clusters, max_density_cluster = @max_density_cluster, prediction = @prediction) </a>
295
-
296
-
297
-
298
- </span>
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
-
307
-
308
- <span class="summary_desc"><div class='inline'>
309
- <p>Generates a json file containing data used for plotting the histogram of
310
- the length distribution given a lust of Cluster objects <tt>output</tt>:
311
- filename where to save the graph <tt>clusters</tt>: array of
312
- <tt>Cluster</tt> objects <tt>max_density_cluster</tt>: index of the most
313
- dense cluster <tt>prediction</tt>: <tt>Sequence</tt> object Output:
314
- <tt>Plot</tt> object.</p>
315
- </div></span>
316
-
317
- </li>
318
-
319
-
320
- <li class="public ">
321
- <span class="summary_signature">
322
-
323
- <a href="#plot_len_clusters-instance_method" title="#plot_len_clusters (instance method)">- (Object) <strong>plot_len_clusters</strong>(output = &quot;#{@filename}_len.json&quot;, hits = @hits) </a>
324
-
325
-
326
-
327
- </span>
328
-
329
-
330
-
331
-
332
-
333
-
334
-
335
-
336
-
337
- <span class="summary_desc"><div class='inline'>
338
- <p>Generates a json file cotaining data used for plotting lines corresponding
339
- to the start and end hit offsets Params: <tt>output</tt>: filename where to
340
- save the graph <tt>hits</tt>: array of Sequence objects Output:
341
- <tt>Plot</tt> object.</p>
342
- </div></span>
343
-
344
- </li>
345
-
346
-
347
- <li class="public ">
348
- <span class="summary_signature">
349
-
350
- <a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong> </a>
351
-
352
-
353
-
354
- </span>
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
- <span class="summary_desc"><div class='inline'>
365
- <p>Validates the length of the predicted gene by comparing the length of the
366
- prediction to the most dense cluster The most dense cluster is obtained by
367
- hierarchical clusterization Plots are generated if required (see
368
- <tt>plot</tt> variable) Output: <tt>LengthClusterValidationOutput</tt>
369
- object.</p>
370
- </div></span>
371
-
372
- </li>
373
-
374
-
375
- </ul>
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
-
384
- <div id="constructor_details" class="method_details_list">
385
- <h2>Constructor Details</h2>
386
-
387
- <div class="method_details first">
388
- <h3 class="signature first" id="initialize-instance_method">
389
-
390
- - (<tt><span class='object_link'><a href="" title="LengthClusterValidation (class)">LengthClusterValidation</a></span></tt>) <strong>initialize</strong>(type, prediction, hits, filename)
391
-
392
-
393
-
394
-
395
-
396
- </h3><div class="docstring">
397
- <div class="discussion">
398
-
399
- <p>Initilizes the object Params: <tt>type</tt>: type of the predicted sequence
400
- (:nucleotide or :protein) <tt>prediction</tt>: a <tt>Sequence</tt> object
401
- representing the blast query <tt>hits</tt>: a vector of <tt>Sequence</tt>
402
- objects (usually representig the blast hits)</p>
403
-
404
-
405
- </div>
406
- </div>
407
- <div class="tags">
408
-
409
-
410
- </div><table class="source_code">
411
- <tr>
412
- <td>
413
- <pre class="lines">
414
-
415
-
416
- 51
417
- 52
418
- 53
419
- 54
420
- 55
421
- 56
422
- 57
423
- 58
424
- 59
425
- 60</pre>
426
- </td>
427
- <td>
428
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_cluster.rb', line 51</span>
429
-
430
- <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_filename'>filename</span><span class='rparen'>)</span>
431
- <span class='kw'>super</span>
432
- <span class='ivar'>@filename</span> <span class='op'>=</span> <span class='id identifier rubyid_filename'>filename</span>
433
- <span class='ivar'>@short_header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LengthCluster</span><span class='tstring_end'>&quot;</span></span>
434
- <span class='ivar'>@header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Length Cluster</span><span class='tstring_end'>&quot;</span></span>
435
- <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 prediction length fits most of the BLAST hit lengths,</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
436
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> by 1D hierarchical clusterization. Meaning of the output displayed: Prediction_len</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
437
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> [Main Cluster Length Interval]</span><span class='tstring_end'>&quot;</span></span>
438
- <span class='ivar'>@cli_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>lenc</span><span class='tstring_end'>&quot;</span></span>
439
- <span class='kw'>end</span></pre>
440
- </td>
441
- </tr>
442
- </table>
443
- </div>
444
-
445
- </div>
446
-
447
- <div id="instance_attr_details" class="attr_details">
448
- <h2>Instance Attribute Details</h2>
449
-
450
-
451
- <span id=""></span>
452
- <div class="method_details first">
453
- <h3 class="signature first" id="clusters-instance_method">
454
-
455
- - (<tt>Object</tt>) <strong>clusters</strong> <span class="extras">(readonly)</span>
456
-
457
-
458
-
459
-
460
-
461
- </h3><div class="docstring">
462
- <div class="discussion">
463
-
464
- <p>Returns the value of attribute clusters</p>
465
-
466
-
467
- </div>
468
- </div>
469
- <div class="tags">
470
-
471
-
472
- </div><table class="source_code">
473
- <tr>
474
- <td>
475
- <pre class="lines">
476
-
477
-
478
- 42
479
- 43
480
- 44</pre>
481
- </td>
482
- <td>
483
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_cluster.rb', line 42</span>
484
-
485
- <span class='kw'>def</span> <span class='id identifier rubyid_clusters'>clusters</span>
486
- <span class='ivar'>@clusters</span>
487
- <span class='kw'>end</span></pre>
488
- </td>
489
- </tr>
490
- </table>
491
- </div>
492
-
493
-
494
- <span id=""></span>
495
- <div class="method_details ">
496
- <h3 class="signature " id="filename-instance_method">
497
-
498
- - (<tt>Object</tt>) <strong>filename</strong> <span class="extras">(readonly)</span>
499
-
500
-
501
-
502
-
503
-
504
- </h3><div class="docstring">
505
- <div class="discussion">
506
-
507
- <p>Returns the value of attribute filename</p>
508
-
509
-
510
- </div>
511
- </div>
512
- <div class="tags">
513
-
514
-
515
- </div><table class="source_code">
516
- <tr>
517
- <td>
518
- <pre class="lines">
519
-
520
-
521
- 41
522
- 42
523
- 43</pre>
524
- </td>
525
- <td>
526
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_cluster.rb', line 41</span>
527
-
528
- <span class='kw'>def</span> <span class='id identifier rubyid_filename'>filename</span>
529
- <span class='ivar'>@filename</span>
530
- <span class='kw'>end</span></pre>
531
- </td>
532
- </tr>
533
- </table>
534
- </div>
535
-
536
-
537
- <span id=""></span>
538
- <div class="method_details ">
539
- <h3 class="signature " id="max_density_cluster-instance_method">
540
-
541
- - (<tt>Object</tt>) <strong>max_density_cluster</strong> <span class="extras">(readonly)</span>
542
-
543
-
544
-
545
-
546
-
547
- </h3><div class="docstring">
548
- <div class="discussion">
549
-
550
- <p>Returns the value of attribute max_density_cluster</p>
551
-
552
-
553
- </div>
554
- </div>
555
- <div class="tags">
556
-
557
-
558
- </div><table class="source_code">
559
- <tr>
560
- <td>
561
- <pre class="lines">
562
-
563
-
564
- 43
565
- 44
566
- 45</pre>
567
- </td>
568
- <td>
569
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_cluster.rb', line 43</span>
570
-
571
- <span class='kw'>def</span> <span class='id identifier rubyid_max_density_cluster'>max_density_cluster</span>
572
- <span class='ivar'>@max_density_cluster</span>
573
- <span class='kw'>end</span></pre>
574
- </td>
575
- </tr>
576
- </table>
577
- </div>
578
-
579
- </div>
580
-
581
-
582
- <div id="instance_method_details" class="method_details_list">
583
- <h2>Instance Method Details</h2>
584
-
585
-
586
- <div class="method_details first">
587
- <h3 class="signature first" id="clusterization_by_length-instance_method">
588
-
589
- - (<tt>Object</tt>) <strong>clusterization_by_length</strong>(debug = false, lst = @hits, predicted_seq = @prediction)
590
-
591
-
592
-
593
-
594
-
595
- </h3><div class="docstring">
596
- <div class="discussion">
597
-
598
- <p>Clusterization by length from a list of sequences Params:</p>
599
- <table class="rdoc-list"><tr><td class="rdoc-term"><p><tt>debug</tt> (optional)</p></td>
600
- <td>
601
- <p>true to display debug information, false by default (optional argument)</p>
602
- </td></tr><tr><td class="rdoc-term"><p><tt>lst</tt></p></td>
603
- <td>
604
- <p>array of <tt>Sequence</tt> objects</p>
605
- </td></tr><tr><td class="rdoc-term"><p><tt>predicted_seq</tt></p></td>
606
- <td>
607
- <p><tt>Sequence</tt> objetc</p>
608
- </td></tr></table>
609
-
610
- <p>Output</p>
611
- <table class="rdoc-list"><tr><td class="rdoc-term"><p>output 1</p></td>
612
- <td>
613
- <p>array of Cluster objects</p>
614
- </td></tr><tr><td class="rdoc-term"><p>output 2</p></td>
615
- <td>
616
- <p>the index of the most dense cluster</p>
617
- </td></tr></table>
618
-
619
-
620
- </div>
621
- </div>
622
- <div class="tags">
623
-
624
-
625
- </div><table class="source_code">
626
- <tr>
627
- <td>
628
- <pre class="lines">
629
-
630
-
631
- 115
632
- 116
633
- 117
634
- 118
635
- 119
636
- 120
637
- 121
638
- 122
639
- 123
640
- 124
641
- 125
642
- 126
643
- 127
644
- 128
645
- 129
646
- 130
647
- 131
648
- 132
649
- 133
650
- 134
651
- 135
652
- 136
653
- 137
654
- 138
655
- 139
656
- 140
657
- 141
658
- 142
659
- 143
660
- 144</pre>
661
- </td>
662
- <td>
663
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_cluster.rb', line 115</span>
664
-
665
- <span class='kw'>def</span> <span class='id identifier rubyid_clusterization_by_length'>clusterization_by_length</span><span class='lparen'>(</span><span class='id identifier rubyid_debug'>debug</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span>
666
- <span class='id identifier rubyid_lst'>lst</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='comma'>,</span>
667
- <span class='id identifier rubyid_predicted_seq'>predicted_seq</span> <span class='op'>=</span> <span class='ivar'>@prediction</span><span class='rparen'>)</span>
668
- <span class='kw'>begin</span>
669
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>TypeError</span> <span class='kw'>unless</span> <span class='id identifier rubyid_lst'>lst</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> <span class='kw'>and</span>
670
- <span class='id identifier rubyid_predicted_seq'>predicted_seq</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Sequence</span>
671
-
672
- <span class='id identifier rubyid_contents'>contents</span> <span class='op'>=</span> <span class='id identifier rubyid_lst'>lst</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>
673
-
674
- <span class='id identifier rubyid_hc'>hc</span> <span class='op'>=</span> <span class='const'>HierarchicalClusterization</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_contents'>contents</span><span class='rparen'>)</span>
675
- <span class='id identifier rubyid_clusters'>clusters</span> <span class='op'>=</span> <span class='id identifier rubyid_hc'>hc</span><span class='period'>.</span><span class='id identifier rubyid_hierarchical_clusterization'>hierarchical_clusterization</span>
676
-
677
- <span class='id identifier rubyid_max_density'>max_density</span> <span class='op'>=</span> <span class='int'>0</span><span class='semicolon'>;</span>
678
- <span class='id identifier rubyid_max_density_cluster_idx'>max_density_cluster_idx</span> <span class='op'>=</span> <span class='int'>0</span><span class='semicolon'>;</span>
679
- <span class='id identifier rubyid_clusters'>clusters</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
680
- <span class='kw'>if</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_density'>density</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_max_density'>max_density</span>
681
- <span class='id identifier rubyid_max_density'>max_density</span> <span class='op'>=</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_density'>density</span>
682
- <span class='id identifier rubyid_max_density_cluster_idx'>max_density_cluster_idx</span> <span class='op'>=</span> <span class='id identifier rubyid_i'>i</span><span class='semicolon'>;</span>
683
- <span class='kw'>end</span>
684
- <span class='kw'>end</span>
685
-
686
- <span class='kw'>return</span> <span class='lbracket'>[</span><span class='id identifier rubyid_clusters'>clusters</span><span class='comma'>,</span> <span class='id identifier rubyid_max_density_cluster_idx'>max_density_cluster_idx</span><span class='rbracket'>]</span>
687
-
688
- <span class='kw'>rescue</span> <span class='const'>TypeError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
689
- <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Type error at </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='lbracket'>[</span><span class='int'>0</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'>\/([^\/]+:\d+):.*</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
690
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> Possible cause: one of the arguments of 'clusterization_by_length'</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
691
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> method has not the proper type.\n</span><span class='tstring_end'>&quot;</span></span>
692
- <span class='id identifier rubyid_exit'>exit</span>
693
- <span class='kw'>end</span>
694
- <span class='kw'>end</span></pre>
695
- </td>
696
- </tr>
697
- </table>
698
- </div>
699
-
700
- <div class="method_details ">
701
- <h3 class="signature " id="plot_histo_clusters-instance_method">
702
-
703
- - (<tt>Object</tt>) <strong>plot_histo_clusters</strong>(output = &quot;#{@filename}_len_clusters.json&quot;, clusters = @clusters, max_density_cluster = @max_density_cluster, prediction = @prediction)
704
-
705
-
706
-
707
-
708
-
709
- </h3><div class="docstring">
710
- <div class="discussion">
711
-
712
- <p>Generates a json file containing data used for plotting the histogram of
713
- the length distribution given a lust of Cluster objects <tt>output</tt>:
714
- filename where to save the graph <tt>clusters</tt>: array of
715
- <tt>Cluster</tt> objects <tt>max_density_cluster</tt>: index of the most
716
- dense cluster <tt>prediction</tt>: <tt>Sequence</tt> object Output:
717
- <tt>Plot</tt> object</p>
718
-
719
-
720
- </div>
721
- </div>
722
- <div class="tags">
723
-
724
-
725
- </div><table class="source_code">
726
- <tr>
727
- <td>
728
- <pre class="lines">
729
-
730
-
731
- 155
732
- 156
733
- 157
734
- 158
735
- 159
736
- 160
737
- 161
738
- 162
739
- 163
740
- 164
741
- 165
742
- 166
743
- 167
744
- 168
745
- 169
746
- 170
747
- 171
748
- 172
749
- 173</pre>
750
- </td>
751
- <td>
752
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_cluster.rb', line 155</span>
753
-
754
- <span class='kw'>def</span> <span class='id identifier rubyid_plot_histo_clusters'>plot_histo_clusters</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@filename</span><span class='rbrace'>}</span><span class='tstring_content'>_len_clusters.json</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
755
- <span class='id identifier rubyid_clusters'>clusters</span> <span class='op'>=</span> <span class='ivar'>@clusters</span><span class='comma'>,</span>
756
- <span class='id identifier rubyid_max_density_cluster'>max_density_cluster</span> <span class='op'>=</span> <span class='ivar'>@max_density_cluster</span><span class='comma'>,</span>
757
- <span class='id identifier rubyid_prediction'>prediction</span> <span class='op'>=</span> <span class='ivar'>@prediction</span><span class='rparen'>)</span>
758
-
759
- <span class='id identifier rubyid_f'>f</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
760
- <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_clusters'>clusters</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</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_cluster'>cluster</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
761
- <span class='id identifier rubyid_cluster'>cluster</span><span class='period'>.</span><span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
762
- <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>key</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>value</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='id identifier rubyid_v'>v</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>main</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span><span class='op'>==</span><span class='id identifier rubyid_max_density_cluster'>max_density_cluster</span><span class='rparen'>)</span><span class='rbrace'>}</span>
763
- <span class='rbrace'>}</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rparen'>)</span>
764
- <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
765
- <span class='const'>Plot</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</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='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span>
766
- <span class='symbol'>:bars</span><span class='comma'>,</span>
767
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Length distribution histogram</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
768
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>prediction, black;most dense cluster,red;other hits, blue</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
769
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>length</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
770
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>frequency</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
771
- <span class='id identifier rubyid_prediction'>prediction</span><span class='period'>.</span><span class='id identifier rubyid_length_protein'>length_protein</span><span class='rparen'>)</span>
772
- <span class='kw'>end</span></pre>
773
- </td>
774
- </tr>
775
- </table>
776
- </div>
777
-
778
- <div class="method_details ">
779
- <h3 class="signature " id="plot_len_clusters-instance_method">
780
-
781
- - (<tt>Object</tt>) <strong>plot_len_clusters</strong>(output = &quot;#{@filename}_len.json&quot;, hits = @hits)
782
-
783
-
784
-
785
-
786
-
787
- </h3><div class="docstring">
788
- <div class="discussion">
789
-
790
- <p>Generates a json file cotaining data used for plotting lines corresponding
791
- to the start and end hit offsets Params: <tt>output</tt>: filename where to
792
- save the graph <tt>hits</tt>: array of Sequence objects Output:
793
- <tt>Plot</tt> object</p>
794
-
795
-
796
- </div>
797
- </div>
798
- <div class="tags">
799
-
800
-
801
- </div><table class="source_code">
802
- <tr>
803
- <td>
804
- <pre class="lines">
805
-
806
-
807
- 183
808
- 184
809
- 185
810
- 186
811
- 187
812
- 188
813
- 189
814
- 190
815
- 191
816
- 192
817
- 193
818
- 194
819
- 195
820
- 196
821
- 197
822
- 198
823
- 199
824
- 200
825
- 201
826
- 202
827
- 203
828
- 204
829
- 205
830
- 206</pre>
831
- </td>
832
- <td>
833
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_cluster.rb', line 183</span>
834
-
835
- <span class='kw'>def</span> <span class='id identifier rubyid_plot_len_clusters'>plot_len_clusters</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@filename</span><span class='rbrace'>}</span><span class='tstring_content'>_len.json</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_hits'>hits</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='rparen'>)</span>
836
-
837
- <span class='id identifier rubyid_f'>f</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span> <span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
838
- <span class='id identifier rubyid_lst'>lst</span> <span class='op'>=</span> <span class='ivar'>@hits</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='period'>.</span><span class='id identifier rubyid_length_protein'>length_protein</span><span class='op'>&lt;=&gt;</span><span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_length_protein'>length_protein</span><span class='rbrace'>}</span>
839
-
840
- <span class='id identifier rubyid_no_lines'>no_lines</span> <span class='op'>=</span> <span class='int'>100</span>
841
- <span class='id identifier rubyid_ratio'>ratio</span> <span class='op'>=</span> <span class='lparen'>(</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='id identifier rubyid_no_lines'>no_lines</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
842
- <span class='kw'>if</span> <span class='id identifier rubyid_ratio'>ratio</span> <span class='op'>==</span> <span class='int'>0</span>
843
- <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_lst'>lst</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</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_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>y</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>start</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='int'>0</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>stop</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</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='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>color</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>gray</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span> <span class='op'>+</span>
844
- <span class='id identifier rubyid_lst'>lst</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</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_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <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_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hsp'>hsp</span><span class='op'>|</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>y</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>start</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</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='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>stop</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</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='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>color</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>red</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rparen'>)</span>
845
- <span class='kw'>else</span>
846
- <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_lst'>lst</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='op'>%</span><span class='id identifier rubyid_ratio'>ratio</span><span class='op'>==</span><span class='int'>0</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</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_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>y</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>start</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='int'>0</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>stop</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</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='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>color</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>gray</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span> <span class='op'>+</span>
847
- <span class='id identifier rubyid_lst'>lst</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='op'>%</span><span class='id identifier rubyid_ratio'>ratio</span><span class='op'>==</span><span class='int'>0</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</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_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <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_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hsp'>hsp</span><span class='op'>|</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>y</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>start</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</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='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>stop</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</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='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>color</span><span class='tstring_end'>&quot;</span></span><span class='op'>=&gt;</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>red</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rparen'>)</span>
848
- <span class='kw'>end</span>
849
-
850
- <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
851
- <span class='const'>Plot</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</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='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span>
852
- <span class='symbol'>:lines</span><span class='comma'>,</span>
853
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hits vs prediction</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
854
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>hit length, gray;high-scoring segment pairs (hsp), red</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
855
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>length</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
856
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>idx</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
857
- <span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span>
858
- <span class='kw'>end</span></pre>
859
- </td>
860
- </tr>
861
- </table>
862
- </div>
863
-
864
- <div class="method_details ">
865
- <h3 class="signature " id="run-instance_method">
866
-
867
- - (<tt>Object</tt>) <strong>run</strong>
868
-
869
-
870
-
871
-
872
-
873
- </h3><div class="docstring">
874
- <div class="discussion">
875
-
876
- <p>Validates the length of the predicted gene by comparing the length of the
877
- prediction to the most dense cluster The most dense cluster is obtained by
878
- hierarchical clusterization Plots are generated if required (see
879
- <tt>plot</tt> variable) Output: <tt>LengthClusterValidationOutput</tt>
880
- object</p>
881
-
882
-
883
- </div>
884
- </div>
885
- <div class="tags">
886
-
887
-
888
- </div><table class="source_code">
889
- <tr>
890
- <td>
891
- <pre class="lines">
892
-
893
-
894
- 70
895
- 71
896
- 72
897
- 73
898
- 74
899
- 75
900
- 76
901
- 77
902
- 78
903
- 79
904
- 80
905
- 81
906
- 82
907
- 83
908
- 84
909
- 85
910
- 86
911
- 87
912
- 88
913
- 89
914
- 90
915
- 91
916
- 92
917
- 93
918
- 94
919
- 95
920
- 96
921
- 97
922
- 98
923
- 99
924
- 100
925
- 101
926
- 102
927
- 103</pre>
928
- </td>
929
- <td>
930
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_length_cluster.rb', line 70</span>
931
-
932
- <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span>
933
- <span class='kw'>begin</span>
934
- <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>
935
- <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>
936
- <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>
937
-
938
- <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>
939
- <span class='comment'># get [clusters, max_density_cluster_idx]
940
- </span> <span class='id identifier rubyid_clusterization'>clusterization</span> <span class='op'>=</span> <span class='id identifier rubyid_clusterization_by_length'>clusterization_by_length</span>
941
-
942
- <span class='ivar'>@clusters</span> <span class='op'>=</span> <span class='id identifier rubyid_clusterization'>clusterization</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
943
- <span class='ivar'>@max_density_cluster</span> <span class='op'>=</span> <span class='id identifier rubyid_clusterization'>clusterization</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
944
- <span class='id identifier rubyid_limits'>limits</span> <span class='op'>=</span> <span class='ivar'>@clusters</span><span class='lbracket'>[</span><span class='ivar'>@max_density_cluster</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_get_limits'>get_limits</span>
945
- <span class='id identifier rubyid_prediction_len'>prediction_len</span> <span class='op'>=</span> <span class='ivar'>@prediction</span><span class='period'>.</span><span class='id identifier rubyid_length_protein'>length_protein</span>
946
-
947
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>LengthClusterValidationOutput</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_prediction_len'>prediction_len</span><span class='comma'>,</span> <span class='id identifier rubyid_limits'>limits</span><span class='rparen'>)</span>
948
- <span class='id identifier rubyid_plot1'>plot1</span> <span class='op'>=</span> <span class='id identifier rubyid_plot_histo_clusters'>plot_histo_clusters</span>
949
- <span class='ivar'>@validation_report</span><span class='period'>.</span><span class='id identifier rubyid_plot_files'>plot_files</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_plot1'>plot1</span><span class='rparen'>)</span>
950
- <span class='id identifier rubyid_plot2'>plot2</span> <span class='op'>=</span> <span class='id identifier rubyid_plot_len_clusters'>plot_len_clusters</span>
951
- <span class='ivar'>@validation_report</span><span class='period'>.</span><span class='id identifier rubyid_plot_files'>plot_files</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_plot2'>plot2</span><span class='rparen'>)</span>
952
- <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>
953
-
954
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
955
-
956
- <span class='comment'># Exception is raised when blast founds no hits
957
- </span> <span class='kw'>rescue</span> <span class='const'>NotEnoughHitsError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
958
- <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>
959
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
960
- <span class='kw'>else</span>
961
- <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>
962
- <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>
963
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
964
- <span class='kw'>end</span>
965
- <span class='kw'>end</span></pre>
966
- </td>
967
- </tr>
968
- </table>
969
- </div>
970
-
971
- </div>
972
-
973
- </div>
974
-
975
- <div id="footer">
976
- Generated on Sat Sep 28 07:01:33 2013 by
977
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
978
- 0.8.7.2 (ruby-1.9.3).
979
- </div>
980
-
981
- </body>
982
- </html>