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,134 +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: ClasspathError
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 (C)</a> &raquo;
35
-
36
-
37
- <span class="title">ClasspathError</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: ClasspathError
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">ClasspathError</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 BLAST path is not added to the CLASSPATH</p>
108
-
109
-
110
- </div>
111
- </div>
112
- <div class="tags">
113
-
114
-
115
- </div>
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
- </div>
126
-
127
- <div id="footer">
128
- Generated on Sat Sep 28 07:01:32 2013 by
129
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
- 0.8.7.2 (ruby-1.9.3).
131
- </div>
132
-
133
- </body>
134
- </html>
@@ -1,1316 +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: Cluster
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 (C)</a> &raquo;
35
-
36
-
37
- <span class="title">Cluster</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: Cluster
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">Object</span>
77
-
78
- <ul class="fullTree">
79
- <li>Object</li>
80
-
81
- <li class="next">Cluster</li>
82
-
83
- </ul>
84
- <a href="#" class="inheritanceTree">show all</a>
85
-
86
- </dd>
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
- <dt class="r2 last">Defined in:</dt>
97
- <dd class="r2 last">lib/genevalidator/clusterization.rb</dd>
98
-
99
- </dl>
100
- <div class="clear"></div>
101
-
102
- <h2>Overview</h2><div class="docstring">
103
- <div class="discussion">
104
-
105
- <p>Stores the values belonging to one cluster Used for clusterization among a
106
- vector of values</p>
107
-
108
-
109
- </div>
110
- </div>
111
- <div class="tags">
112
-
113
-
114
- </div>
115
-
116
-
117
-
118
- <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
119
- <ul class="summary">
120
-
121
- <li class="public ">
122
- <span class="summary_signature">
123
-
124
- <a href="#lengths-instance_method" title="#lengths (instance method)">- (Object) <strong>lengths</strong> </a>
125
-
126
-
127
-
128
- </span>
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
- <span class="summary_desc"><div class='inline'>
142
- <p>a hash map containing the pair (length, no_occurences).</p>
143
- </div></span>
144
-
145
- </li>
146
-
147
-
148
- </ul>
149
-
150
-
151
-
152
-
153
-
154
- <h2>
155
- Instance Method Summary
156
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
157
- </h2>
158
-
159
- <ul class="summary">
160
-
161
- <li class="public ">
162
- <span class="summary_signature">
163
-
164
- <a href="#add-instance_method" title="#add (instance method)">- (Object) <strong>add</strong>(cluster) </a>
165
-
166
-
167
-
168
- </span>
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
- <span class="summary_desc"><div class='inline'>
179
- <p>Merges the current cluster with the one given as parameter
180
- <tt>clusters</tt> vector of Cluster objects.</p>
181
- </div></span>
182
-
183
- </li>
184
-
185
-
186
- <li class="public ">
187
- <span class="summary_signature">
188
-
189
- <a href="#density-instance_method" title="#density (instance method)">- (Object) <strong>density</strong> </a>
190
-
191
-
192
-
193
- </span>
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
- <span class="summary_desc"><div class='inline'>
204
- <p>Returns the density of the cluster: how many values it contains.</p>
205
- </div></span>
206
-
207
- </li>
208
-
209
-
210
- <li class="public ">
211
- <span class="summary_signature">
212
-
213
- <a href="#deviation-instance_method" title="#deviation (instance method)">- (Object) <strong>deviation</strong>(clusters, queryLength) </a>
214
-
215
-
216
-
217
- </span>
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
- <span class="summary_desc"><div class='inline'>
228
- <p>Returns the deviation of a value from the values in all clusters Params:
229
- <tt>clusters</tt>: a list of Cluster objects <tt>queryLength</tt>: a
230
- reference Sequence object.</p>
231
- </div></span>
232
-
233
- </li>
234
-
235
-
236
- <li class="public ">
237
- <span class="summary_signature">
238
-
239
- <a href="#distance-instance_method" title="#distance (instance method)">- (Object) <strong>distance</strong>(cluster, method = 0) </a>
240
-
241
-
242
-
243
- </span>
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
- <span class="summary_desc"><div class='inline'>
254
- <p>Returns the euclidian distance between the current cluster and the one
255
- given as parameter Params: <tt>cluster</tt>: Cluster object
256
- <tt>method</tt>: 0 or 1 method = 0: do not into condseideration duplicate
257
- values method = 1: average linkage clusterization.</p>
258
- </div></span>
259
-
260
- </li>
261
-
262
-
263
- <li class="public ">
264
- <span class="summary_signature">
265
-
266
- <a href="#get_limits-instance_method" title="#get_limits (instance method)">- (Object) <strong>get_limits</strong> </a>
267
-
268
-
269
-
270
- </span>
271
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
- <span class="summary_desc"><div class='inline'>
281
- <p>Returns the interval limits of the current cluster.</p>
282
- </div></span>
283
-
284
- </li>
285
-
286
-
287
- <li class="public ">
288
- <span class="summary_signature">
289
-
290
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Cluster) <strong>initialize</strong>(lengths) </a>
291
-
292
-
293
-
294
- </span>
295
-
296
-
297
- <span class="note title constructor">constructor</span>
298
-
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
- <span class="summary_desc"><div class='inline'>
307
- <p>A new instance of Cluster.</p>
308
- </div></span>
309
-
310
- </li>
311
-
312
-
313
- <li class="public ">
314
- <span class="summary_signature">
315
-
316
- <a href="#inside_cluster-instance_method" title="#inside_cluster (instance method)">- (Object) <strong>inside_cluster</strong>(value) </a>
317
-
318
-
319
-
320
- </span>
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
-
329
-
330
- <span class="summary_desc"><div class='inline'>
331
- <p>Returns whether the value is inside the cluster Params: <tt>value</tt>:
332
- value to compare Output: :ok or :shorter or :longer.</p>
333
- </div></span>
334
-
335
- </li>
336
-
337
-
338
- <li class="public ">
339
- <span class="summary_signature">
340
-
341
- <a href="#mean-instance_method" title="#mean (instance method)">- (Object) <strong>mean</strong> </a>
342
-
343
-
344
-
345
- </span>
346
-
347
-
348
-
349
-
350
-
351
-
352
-
353
-
354
-
355
- <span class="summary_desc"><div class='inline'>
356
- <p>Returns the weighted mean value of the cluster.</p>
357
- </div></span>
358
-
359
- </li>
360
-
361
-
362
- <li class="public ">
363
- <span class="summary_signature">
364
-
365
- <a href="#print-instance_method" title="#print (instance method)">- (Object) <strong>print</strong> </a>
366
-
367
-
368
-
369
- </span>
370
-
371
-
372
-
373
-
374
-
375
-
376
-
377
-
378
-
379
- <span class="summary_desc"><div class='inline'>
380
- <p>Prints the current cluster.</p>
381
- </div></span>
382
-
383
- </li>
384
-
385
-
386
- <li class="public ">
387
- <span class="summary_signature">
388
-
389
- <a href="#standard_deviation-instance_method" title="#standard_deviation (instance method)">- (Object) <strong>standard_deviation</strong>(lengths = nil) </a>
390
-
391
-
392
-
393
- </span>
394
-
395
-
396
-
397
-
398
-
399
-
400
-
401
-
402
-
403
- <span class="summary_desc"><div class='inline'>
404
- <p>Returns the standard deviation of a set of values Params: <tt>lengths</tt>:
405
- a vector of values (optional, by default it takes the values in the
406
- cluster).</p>
407
- </div></span>
408
-
409
- </li>
410
-
411
-
412
- <li class="public ">
413
- <span class="summary_signature">
414
-
415
- <a href="#t_test-instance_method" title="#t_test (instance method)">- (Object) <strong>t_test</strong>(clusters, queryLength) </a>
416
-
417
-
418
-
419
- </span>
420
-
421
-
422
-
423
-
424
-
425
-
426
-
427
-
428
-
429
- <span class="summary_desc"><div class='inline'>
430
- <p>Returns the p-value of a t-test <tt>clusters</tt>: a list of Cluster
431
- objects <tt>querylength</tt>: a reference Sequence object.</p>
432
- </div></span>
433
-
434
- </li>
435
-
436
-
437
- <li class="public ">
438
- <span class="summary_signature">
439
-
440
- <a href="#wilcox_test-instance_method" title="#wilcox_test (instance method)">- (Object) <strong>wilcox_test</strong>(clusters, queryLength) </a>
441
-
442
-
443
-
444
- </span>
445
-
446
-
447
-
448
-
449
-
450
-
451
-
452
-
453
-
454
- <span class="summary_desc"><div class='inline'>
455
- <p>Returns the p-value of a wilcox test <tt>clusters</tt>: a list of Cluster
456
- objects <tt>querylength</tt>: a reference Sequence object.</p>
457
- </div></span>
458
-
459
- </li>
460
-
461
-
462
- <li class="public ">
463
- <span class="summary_signature">
464
-
465
- <a href="#wss-instance_method" title="#wss (instance method)">- (Object) <strong>wss</strong>(lengths = nil) </a>
466
-
467
-
468
-
469
- </span>
470
-
471
-
472
-
473
-
474
-
475
-
476
-
477
-
478
-
479
- <span class="summary_desc"><div class='inline'>
480
- <p>Returns within cluster sum of squares.</p>
481
- </div></span>
482
-
483
- </li>
484
-
485
-
486
- </ul>
487
-
488
-
489
- <div id="constructor_details" class="method_details_list">
490
- <h2>Constructor Details</h2>
491
-
492
- <div class="method_details first">
493
- <h3 class="signature first" id="initialize-instance_method">
494
-
495
- - (<tt><span class='object_link'><a href="" title="Cluster (class)">Cluster</a></span></tt>) <strong>initialize</strong>(lengths)
496
-
497
-
498
-
499
-
500
-
501
- </h3><div class="docstring">
502
- <div class="discussion">
503
-
504
- <p>Returns a new instance of Cluster</p>
505
-
506
-
507
- </div>
508
- </div>
509
- <div class="tags">
510
-
511
-
512
- </div><table class="source_code">
513
- <tr>
514
- <td>
515
- <pre class="lines">
516
-
517
-
518
- 170
519
- 171
520
- 172</pre>
521
- </td>
522
- <td>
523
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 170</span>
524
-
525
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_lengths'>lengths</span><span class='rparen'>)</span>
526
- <span class='ivar'>@lengths</span> <span class='op'>=</span> <span class='id identifier rubyid_lengths'>lengths</span>
527
- <span class='kw'>end</span></pre>
528
- </td>
529
- </tr>
530
- </table>
531
- </div>
532
-
533
- </div>
534
-
535
- <div id="instance_attr_details" class="attr_details">
536
- <h2>Instance Attribute Details</h2>
537
-
538
-
539
- <span id="lengths=-instance_method"></span>
540
- <div class="method_details first">
541
- <h3 class="signature first" id="lengths-instance_method">
542
-
543
- - (<tt>Object</tt>) <strong>lengths</strong>
544
-
545
-
546
-
547
-
548
-
549
- </h3><div class="docstring">
550
- <div class="discussion">
551
-
552
- <p>a hash map containing the pair (length, no_occurences)</p>
553
-
554
-
555
- </div>
556
- </div>
557
- <div class="tags">
558
-
559
-
560
- </div><table class="source_code">
561
- <tr>
562
- <td>
563
- <pre class="lines">
564
-
565
-
566
- 168
567
- 169
568
- 170</pre>
569
- </td>
570
- <td>
571
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 168</span>
572
-
573
- <span class='kw'>def</span> <span class='id identifier rubyid_lengths'>lengths</span>
574
- <span class='ivar'>@lengths</span>
575
- <span class='kw'>end</span></pre>
576
- </td>
577
- </tr>
578
- </table>
579
- </div>
580
-
581
- </div>
582
-
583
-
584
- <div id="instance_method_details" class="method_details_list">
585
- <h2>Instance Method Details</h2>
586
-
587
-
588
- <div class="method_details first">
589
- <h3 class="signature first" id="add-instance_method">
590
-
591
- - (<tt>Object</tt>) <strong>add</strong>(cluster)
592
-
593
-
594
-
595
-
596
-
597
- </h3><div class="docstring">
598
- <div class="discussion">
599
-
600
- <p>Merges the current cluster with the one given as parameter
601
- <tt>clusters</tt> vector of Cluster objects</p>
602
-
603
-
604
- </div>
605
- </div>
606
- <div class="tags">
607
-
608
-
609
- </div><table class="source_code">
610
- <tr>
611
- <td>
612
- <pre class="lines">
613
-
614
-
615
- 325
616
- 326
617
- 327
618
- 328
619
- 329</pre>
620
- </td>
621
- <td>
622
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 325</span>
623
-
624
- <span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_cluster'>cluster</span><span class='rparen'>)</span>
625
- <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_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_elem'>elem</span><span class='op'>|</span>
626
- <span class='id identifier rubyid_lengths'>lengths</span><span class='lbracket'>[</span><span class='id identifier rubyid_elem'>elem</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_elem'>elem</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
627
- <span class='kw'>end</span>
628
- <span class='kw'>end</span></pre>
629
- </td>
630
- </tr>
631
- </table>
632
- </div>
633
-
634
- <div class="method_details ">
635
- <h3 class="signature " id="density-instance_method">
636
-
637
- - (<tt>Object</tt>) <strong>density</strong>
638
-
639
-
640
-
641
-
642
-
643
- </h3><div class="docstring">
644
- <div class="discussion">
645
-
646
- <p>Returns the density of the cluster: how many values it contains</p>
647
-
648
-
649
- </div>
650
- </div>
651
- <div class="tags">
652
-
653
-
654
- </div><table class="source_code">
655
- <tr>
656
- <td>
657
- <pre class="lines">
658
-
659
-
660
- 190
661
- 191
662
- 192
663
- 193
664
- 194
665
- 195
666
- 196
667
- 197</pre>
668
- </td>
669
- <td>
670
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 190</span>
671
-
672
- <span class='kw'>def</span> <span class='id identifier rubyid_density'>density</span>
673
- <span class='id identifier rubyid_d'>d</span> <span class='op'>=</span> <span class='int'>0</span>
674
- <span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_elem'>elem</span><span class='op'>|</span>
675
- <span class='id identifier rubyid_d'>d</span> <span class='op'>+=</span> <span class='id identifier rubyid_elem'>elem</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
676
- <span class='kw'>end</span>
677
- <span class='id identifier rubyid_d'>d</span>
678
-
679
- <span class='kw'>end</span></pre>
680
- </td>
681
- </tr>
682
- </table>
683
- </div>
684
-
685
- <div class="method_details ">
686
- <h3 class="signature " id="deviation-instance_method">
687
-
688
- - (<tt>Object</tt>) <strong>deviation</strong>(clusters, queryLength)
689
-
690
-
691
-
692
-
693
-
694
- </h3><div class="docstring">
695
- <div class="discussion">
696
-
697
- <p>Returns the deviation of a value from the values in all clusters Params:
698
- <tt>clusters</tt>: a list of Cluster objects <tt>queryLength</tt>: a
699
- reference Sequence object</p>
700
-
701
-
702
- </div>
703
- </div>
704
- <div class="tags">
705
-
706
-
707
- </div><table class="source_code">
708
- <tr>
709
- <td>
710
- <pre class="lines">
711
-
712
-
713
- 266
714
- 267
715
- 268
716
- 269
717
- 270
718
- 271
719
- 272
720
- 273
721
- 274</pre>
722
- </td>
723
- <td>
724
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 266</span>
725
-
726
- <span class='kw'>def</span> <span class='id identifier rubyid_deviation'>deviation</span><span class='lparen'>(</span><span class='id identifier rubyid_clusters'>clusters</span><span class='comma'>,</span> <span class='id identifier rubyid_queryLength'>queryLength</span><span class='rparen'>)</span>
727
- <span class='id identifier rubyid_hits'>hits</span> <span class='op'>=</span> <span class='id identifier rubyid_clusters'>clusters</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_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_lengths'>lengths</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_a'>a</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
728
- <span class='id identifier rubyid_raw_hits'>raw_hits</span> <span class='op'>=</span> <span class='id identifier rubyid_clusters'>clusters</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_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_lengths'>lengths</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_a'>a</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>[</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>]</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
729
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>sd = sd(c(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='rbrace'>}</span><span class='tstring_content'>))</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
730
- <span class='id identifier rubyid_sd'>sd</span> <span class='op'>=</span> <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_pull'>pull</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>sd</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
731
- <span class='id identifier rubyid_sd'>sd</span> <span class='op'>=</span> <span class='id identifier rubyid_standard_deviation'>standard_deviation</span><span class='lparen'>(</span><span class='id identifier rubyid_hits'>hits</span><span class='rparen'>)</span>
732
- <span class='lparen'>(</span><span class='id identifier rubyid_queryLength'>queryLength</span> <span class='op'>-</span> <span class='id identifier rubyid_mean'>mean</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_abs'>abs</span> <span class='op'>/</span> <span class='id identifier rubyid_sd'>sd</span>
733
-
734
- <span class='kw'>end</span></pre>
735
- </td>
736
- </tr>
737
- </table>
738
- </div>
739
-
740
- <div class="method_details ">
741
- <h3 class="signature " id="distance-instance_method">
742
-
743
- - (<tt>Object</tt>) <strong>distance</strong>(cluster, method = 0)
744
-
745
-
746
-
747
-
748
-
749
- </h3><div class="docstring">
750
- <div class="discussion">
751
-
752
- <p>Returns the euclidian distance between the current cluster and the one
753
- given as parameter Params: <tt>cluster</tt>: Cluster object
754
- <tt>method</tt>: 0 or 1 method = 0: do not into condseideration duplicate
755
- values method = 1: average linkage clusterization</p>
756
-
757
-
758
- </div>
759
- </div>
760
- <div class="tags">
761
-
762
-
763
- </div><table class="source_code">
764
- <tr>
765
- <td>
766
- <pre class="lines">
767
-
768
-
769
- 205
770
- 206
771
- 207
772
- 208
773
- 209
774
- 210
775
- 211
776
- 212
777
- 213
778
- 214
779
- 215
780
- 216
781
- 217
782
- 218
783
- 219
784
- 220
785
- 221
786
- 222
787
- 223
788
- 224
789
- 225</pre>
790
- </td>
791
- <td>
792
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 205</span>
793
-
794
- <span class='kw'>def</span> <span class='id identifier rubyid_distance'>distance</span><span class='lparen'>(</span><span class='id identifier rubyid_cluster'>cluster</span><span class='comma'>,</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='int'>0</span><span class='rparen'>)</span>
795
- <span class='id identifier rubyid_d'>d</span> <span class='op'>=</span> <span class='int'>0</span>
796
- <span class='id identifier rubyid_norm'>norm</span> <span class='op'>=</span> <span class='int'>0</span>
797
-
798
- <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_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_elem1'>elem1</span><span class='op'>|</span>
799
- <span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_elem2'>elem2</span><span class='op'>|</span>
800
- <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>==</span> <span class='int'>1</span>
801
- <span class='id identifier rubyid_d'>d</span> <span class='op'>+=</span> <span class='id identifier rubyid_elem1'>elem1</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>*</span> <span class='id identifier rubyid_elem2'>elem2</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>*</span> <span class='lparen'>(</span><span class='id identifier rubyid_elem1'>elem1</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='id identifier rubyid_elem2'>elem2</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_abs'>abs</span>
802
- <span class='id identifier rubyid_norm'>norm</span> <span class='op'>+=</span> <span class='id identifier rubyid_elem1'>elem1</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>*</span> <span class='id identifier rubyid_elem2'>elem2</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
803
- <span class='kw'>else</span>
804
- <span class='id identifier rubyid_d'>d</span> <span class='op'>+=</span> <span class='lparen'>(</span><span class='id identifier rubyid_elem1'>elem1</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='id identifier rubyid_elem2'>elem2</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_abs'>abs</span>
805
- <span class='id identifier rubyid_norm'>norm</span> <span class='op'>=</span> <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_length'>length</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>
806
- <span class='kw'>end</span>
807
- <span class='kw'>end</span>
808
- <span class='kw'>end</span>
809
-
810
- <span class='comment'>#group average distance
811
- </span> <span class='id identifier rubyid_d'>d</span> <span class='op'>/=</span> <span class='lparen'>(</span><span class='id identifier rubyid_norm'>norm</span> <span class='op'>+</span> <span class='float'>0.0</span><span class='rparen'>)</span>
812
- <span class='kw'>return</span> <span class='id identifier rubyid_d'>d</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>4</span><span class='rparen'>)</span>
813
-
814
- <span class='kw'>end</span></pre>
815
- </td>
816
- </tr>
817
- </table>
818
- </div>
819
-
820
- <div class="method_details ">
821
- <h3 class="signature " id="get_limits-instance_method">
822
-
823
- - (<tt>Object</tt>) <strong>get_limits</strong>
824
-
825
-
826
-
827
-
828
-
829
- </h3><div class="docstring">
830
- <div class="discussion">
831
-
832
- <p>Returns the interval limits of the current cluster</p>
833
-
834
-
835
- </div>
836
- </div>
837
- <div class="tags">
838
-
839
-
840
- </div><table class="source_code">
841
- <tr>
842
- <td>
843
- <pre class="lines">
844
-
845
-
846
- 343
847
- 344
848
- 345</pre>
849
- </td>
850
- <td>
851
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 343</span>
852
-
853
- <span class='kw'>def</span> <span class='id identifier rubyid_get_limits'>get_limits</span>
854
- <span class='id identifier rubyid_lengths'>lengths</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_elem'>elem</span><span class='op'>|</span> <span class='id identifier rubyid_elem'>elem</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_minmax'>minmax</span>
855
- <span class='kw'>end</span></pre>
856
- </td>
857
- </tr>
858
- </table>
859
- </div>
860
-
861
- <div class="method_details ">
862
- <h3 class="signature " id="inside_cluster-instance_method">
863
-
864
- - (<tt>Object</tt>) <strong>inside_cluster</strong>(value)
865
-
866
-
867
-
868
-
869
-
870
- </h3><div class="docstring">
871
- <div class="discussion">
872
-
873
- <p>Returns whether the value is inside the cluster Params: <tt>value</tt>:
874
- value to compare Output: :ok or :shorter or :longer</p>
875
-
876
-
877
- </div>
878
- </div>
879
- <div class="tags">
880
-
881
-
882
- </div><table class="source_code">
883
- <tr>
884
- <td>
885
- <pre class="lines">
886
-
887
-
888
- 353
889
- 354
890
- 355
891
- 356
892
- 357
893
- 358
894
- 359
895
- 360
896
- 361
897
- 362
898
- 363
899
- 364
900
- 365
901
- 366
902
- 367
903
- 368
904
- 369</pre>
905
- </td>
906
- <td>
907
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 353</span>
908
-
909
- <span class='kw'>def</span> <span class='id identifier rubyid_inside_cluster'>inside_cluster</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
910
- <span class='id identifier rubyid_limits'>limits</span> <span class='op'>=</span> <span class='id identifier rubyid_get_limits'>get_limits</span>
911
- <span class='id identifier rubyid_left'>left</span> <span class='op'>=</span> <span class='id identifier rubyid_limits'>limits</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
912
- <span class='id identifier rubyid_right'>right</span> <span class='op'>=</span> <span class='id identifier rubyid_limits'>limits</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
913
-
914
- <span class='kw'>if</span> <span class='id identifier rubyid_left'>left</span> <span class='op'>&lt;=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>and</span> <span class='id identifier rubyid_right'>right</span> <span class='op'>&gt;=</span> <span class='id identifier rubyid_value'>value</span>
915
- <span class='symbol'>:ok</span>
916
- <span class='kw'>end</span>
917
-
918
- <span class='kw'>if</span> <span class='id identifier rubyid_left'>left</span> <span class='op'>&gt;=</span> <span class='id identifier rubyid_value'>value</span>
919
- <span class='symbol'>:shorter</span>
920
- <span class='kw'>end</span>
921
-
922
- <span class='kw'>if</span> <span class='id identifier rubyid_right'>right</span> <span class='op'>&lt;=</span> <span class='id identifier rubyid_value'>value</span>
923
- <span class='symbol'>:longer</span>
924
- <span class='kw'>end</span>
925
- <span class='kw'>end</span></pre>
926
- </td>
927
- </tr>
928
- </table>
929
- </div>
930
-
931
- <div class="method_details ">
932
- <h3 class="signature " id="mean-instance_method">
933
-
934
- - (<tt>Object</tt>) <strong>mean</strong>
935
-
936
-
937
-
938
-
939
-
940
- </h3><div class="docstring">
941
- <div class="discussion">
942
-
943
- <p>Returns the weighted mean value of the cluster</p>
944
-
945
-
946
- </div>
947
- </div>
948
- <div class="tags">
949
-
950
-
951
- </div><table class="source_code">
952
- <tr>
953
- <td>
954
- <pre class="lines">
955
-
956
-
957
- 176
958
- 177
959
- 178
960
- 179
961
- 180
962
- 181
963
- 182
964
- 183
965
- 184
966
- 185
967
- 186</pre>
968
- </td>
969
- <td>
970
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 176</span>
971
-
972
- <span class='kw'>def</span> <span class='id identifier rubyid_mean'>mean</span>
973
- <span class='id identifier rubyid_mean_len'>mean_len</span> <span class='op'>=</span> <span class='int'>0</span>
974
- <span class='id identifier rubyid_weight'>weight</span> <span class='op'>=</span> <span class='int'>0</span>
975
-
976
- <span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_length'>length</span><span class='comma'>,</span> <span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
977
- <span class='id identifier rubyid_mean_len'>mean_len</span> <span class='op'>+=</span> <span class='id identifier rubyid_length'>length</span> <span class='op'>*</span> <span class='id identifier rubyid_n'>n</span>
978
- <span class='id identifier rubyid_weight'>weight</span> <span class='op'>+=</span> <span class='id identifier rubyid_n'>n</span>
979
- <span class='kw'>end</span>
980
- <span class='id identifier rubyid_mean_len'>mean_len</span> <span class='op'>/=</span> <span class='id identifier rubyid_weight'>weight</span>
981
-
982
- <span class='kw'>end</span></pre>
983
- </td>
984
- </tr>
985
- </table>
986
- </div>
987
-
988
- <div class="method_details ">
989
- <h3 class="signature " id="print-instance_method">
990
-
991
- - (<tt>Object</tt>) <strong>print</strong>
992
-
993
-
994
-
995
-
996
-
997
- </h3><div class="docstring">
998
- <div class="discussion">
999
-
1000
- <p>Prints the current cluster</p>
1001
-
1002
-
1003
- </div>
1004
- </div>
1005
- <div class="tags">
1006
-
1007
-
1008
- </div><table class="source_code">
1009
- <tr>
1010
- <td>
1011
- <pre class="lines">
1012
-
1013
-
1014
- 333
1015
- 334
1016
- 335
1017
- 336
1018
- 337
1019
- 338
1020
- 339</pre>
1021
- </td>
1022
- <td>
1023
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 333</span>
1024
-
1025
- <span class='kw'>def</span> <span class='id identifier rubyid_print'>print</span>
1026
- <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cluster: mean = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_mean'>mean</span><span class='lparen'>(</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'>, density = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_density'>density</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1027
- <span class='id identifier rubyid_lengths'>lengths</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><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_elem'>elem</span><span class='op'>|</span>
1028
- <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_elem'>elem</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='embexpr_beg'>#{</span><span class='id identifier rubyid_elem'>elem</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1029
- <span class='kw'>end</span>
1030
- <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--------------------------</span><span class='tstring_end'>&quot;</span></span>
1031
- <span class='kw'>end</span></pre>
1032
- </td>
1033
- </tr>
1034
- </table>
1035
- </div>
1036
-
1037
- <div class="method_details ">
1038
- <h3 class="signature " id="standard_deviation-instance_method">
1039
-
1040
- - (<tt>Object</tt>) <strong>standard_deviation</strong>(lengths = nil)
1041
-
1042
-
1043
-
1044
-
1045
-
1046
- </h3><div class="docstring">
1047
- <div class="discussion">
1048
-
1049
- <p>Returns the standard deviation of a set of values Params: <tt>lengths</tt>:
1050
- a vector of values (optional, by default it takes the values in the
1051
- cluster)</p>
1052
-
1053
-
1054
- </div>
1055
- </div>
1056
- <div class="tags">
1057
-
1058
-
1059
- </div><table class="source_code">
1060
- <tr>
1061
- <td>
1062
- <pre class="lines">
1063
-
1064
-
1065
- 247
1066
- 248
1067
- 249
1068
- 250
1069
- 251
1070
- 252
1071
- 253
1072
- 254
1073
- 255
1074
- 256
1075
- 257
1076
- 258
1077
- 259</pre>
1078
- </td>
1079
- <td>
1080
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 247</span>
1081
-
1082
- <span class='kw'>def</span> <span class='id identifier rubyid_standard_deviation'>standard_deviation</span><span class='lparen'>(</span><span class='id identifier rubyid_lengths'>lengths</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1083
- <span class='kw'>if</span> <span class='id identifier rubyid_lengths'>lengths</span> <span class='op'>==</span> <span class='kw'>nil</span>
1084
- <span class='id identifier rubyid_lengths'>lengths</span> <span class='op'>=</span> <span class='ivar'>@lengths</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_a'>a</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
1085
- <span class='kw'>end</span>
1086
-
1087
- <span class='id identifier rubyid_cluster_mean'>cluster_mean</span> <span class='op'>=</span> <span class='id identifier rubyid_mean'>mean</span><span class='lparen'>(</span><span class='rparen'>)</span>
1088
- <span class='id identifier rubyid_std_deviation'>std_deviation</span> <span class='op'>=</span> <span class='int'>0</span>
1089
- <span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_len'>len</span><span class='op'>|</span>
1090
- <span class='id identifier rubyid_std_deviation'>std_deviation</span> <span class='op'>+=</span> <span class='lparen'>(</span><span class='id identifier rubyid_cluster_mean'>cluster_mean</span> <span class='op'>-</span> <span class='id identifier rubyid_len'>len</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='lparen'>(</span><span class='id identifier rubyid_cluster_mean'>cluster_mean</span> <span class='op'>-</span> <span class='id identifier rubyid_len'>len</span><span class='rparen'>)</span>
1091
- <span class='kw'>end</span>
1092
- <span class='id identifier rubyid_std_deviation'>std_deviation</span> <span class='op'>=</span> <span class='const'>Math</span><span class='period'>.</span><span class='id identifier rubyid_sqrt'>sqrt</span><span class='lparen'>(</span><span class='id identifier rubyid_std_deviation'>std_deviation</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span> <span class='op'>/</span> <span class='lparen'>(</span><span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>-</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
1093
-
1094
- <span class='kw'>end</span></pre>
1095
- </td>
1096
- </tr>
1097
- </table>
1098
- </div>
1099
-
1100
- <div class="method_details ">
1101
- <h3 class="signature " id="t_test-instance_method">
1102
-
1103
- - (<tt>Object</tt>) <strong>t_test</strong>(clusters, queryLength)
1104
-
1105
-
1106
-
1107
-
1108
-
1109
- </h3><div class="docstring">
1110
- <div class="discussion">
1111
-
1112
- <p>Returns the p-value of a t-test <tt>clusters</tt>: a list of Cluster
1113
- objects <tt>querylength</tt>: a reference Sequence object</p>
1114
-
1115
-
1116
- </div>
1117
- </div>
1118
- <div class="tags">
1119
-
1120
-
1121
- </div><table class="source_code">
1122
- <tr>
1123
- <td>
1124
- <pre class="lines">
1125
-
1126
-
1127
- 302
1128
- 303
1129
- 304
1130
- 305
1131
- 306
1132
- 307
1133
- 308
1134
- 309
1135
- 310
1136
- 311
1137
- 312
1138
- 313
1139
- 314
1140
- 315
1141
- 316
1142
- 317
1143
- 318
1144
- 319
1145
- 320</pre>
1146
- </td>
1147
- <td>
1148
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 302</span>
1149
-
1150
- <span class='kw'>def</span> <span class='id identifier rubyid_t_test'>t_test</span><span class='lparen'>(</span><span class='id identifier rubyid_clusters'>clusters</span><span class='comma'>,</span> <span class='id identifier rubyid_queryLength'>queryLength</span><span class='rparen'>)</span>
1151
- <span class='comment'>#normalize the data so that to fit a bell curve
1152
- </span> <span class='comment'>#raw_hits = lengths.map{ |x| a = Array.new(x[1],x[0])}.flatten.to_s.gsub('[','').gsub(']','')
1153
- </span> <span class='id identifier rubyid_raw_hits'>raw_hits</span> <span class='op'>=</span> <span class='id identifier rubyid_clusters'>clusters</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_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_lengths'>lengths</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_a'>a</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>[</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>]</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
1154
-
1155
- <span class='kw'>if</span> <span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span>
1156
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>library(preprocessCore)</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1157
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>x = matrix(c(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='rbrace'>}</span><span class='tstring_content'>), ncol=1)</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1158
- <span class='id identifier rubyid_mean_length'>mean_length</span> <span class='op'>=</span> <span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='period'>.</span><span class='id identifier rubyid_sum'>sum</span> <span class='op'>/</span> <span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
1159
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>target = rnorm(10000, m=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_mean'>mean</span><span class='rbrace'>}</span><span class='tstring_content'>, sd=sd(c(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='rbrace'>}</span><span class='tstring_content'>)))</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1160
-
1161
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>hits = normalize.quantiles.use.target(x,target,copy=TRUE)</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1162
-
1163
- <span class='comment'>#make the t-test and get the p-value
1164
- </span> <span class='const'>R</span><span class='period'>.</span> <span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pval = t.test(hits - </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queryLength'>queryLength</span><span class='rbrace'>}</span><span class='tstring_content'>)$p.value</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1165
- <span class='id identifier rubyid_pval'>pval</span> <span class='op'>=</span> <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_pull'>pull</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pval</span><span class='tstring_end'>&quot;</span></span>
1166
- <span class='kw'>end</span>
1167
-
1168
- <span class='kw'>end</span></pre>
1169
- </td>
1170
- </tr>
1171
- </table>
1172
- </div>
1173
-
1174
- <div class="method_details ">
1175
- <h3 class="signature " id="wilcox_test-instance_method">
1176
-
1177
- - (<tt>Object</tt>) <strong>wilcox_test</strong>(clusters, queryLength)
1178
-
1179
-
1180
-
1181
-
1182
-
1183
- </h3><div class="docstring">
1184
- <div class="discussion">
1185
-
1186
- <p>Returns the p-value of a wilcox test <tt>clusters</tt>: a list of Cluster
1187
- objects <tt>querylength</tt>: a reference Sequence object</p>
1188
-
1189
-
1190
- </div>
1191
- </div>
1192
- <div class="tags">
1193
-
1194
-
1195
- </div><table class="source_code">
1196
- <tr>
1197
- <td>
1198
- <pre class="lines">
1199
-
1200
-
1201
- 280
1202
- 281
1203
- 282
1204
- 283
1205
- 284
1206
- 285
1207
- 286
1208
- 287
1209
- 288
1210
- 289
1211
- 290
1212
- 291
1213
- 292
1214
- 293
1215
- 294
1216
- 295
1217
- 296</pre>
1218
- </td>
1219
- <td>
1220
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 280</span>
1221
-
1222
- <span class='kw'>def</span> <span class='id identifier rubyid_wilcox_test'>wilcox_test</span><span class='lparen'>(</span><span class='id identifier rubyid_clusters'>clusters</span><span class='comma'>,</span> <span class='id identifier rubyid_queryLength'>queryLength</span><span class='rparen'>)</span>
1223
- <span class='id identifier rubyid_raw_hits'>raw_hits</span> <span class='op'>=</span> <span class='id identifier rubyid_clusters'>clusters</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_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_lengths'>lengths</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_a'>a</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>[</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>]</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
1224
-
1225
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>library(preprocessCore)</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1226
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>x = matrix(c(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='rbrace'>}</span><span class='tstring_content'>), ncol=1)</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1227
- <span class='id identifier rubyid_mean_length'>mean_length</span> <span class='op'>=</span> <span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='period'>.</span><span class='id identifier rubyid_sum'>sum</span> <span class='op'>/</span> <span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
1228
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>target = rnorm(10000, m=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_mean'>mean</span><span class='rbrace'>}</span><span class='tstring_content'>, sd=sd(c(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='rbrace'>}</span><span class='tstring_content'>)))</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1229
-
1230
- <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>hits = normalize.quantiles.use.target(x,target,copy=TRUE)</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1231
-
1232
- <span class='comment'>#make the wilcox-test and get the p-value
1233
- </span> <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>hits = c(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_raw_hits'>raw_hits</span><span class='rbrace'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1234
- <span class='comment'>#R. eval(&quot;pval = wilcox.test(hits - #{queryLength})$p.value&quot;)
1235
- </span> <span class='comment'>#pval = R.pull &quot;pval&quot;
1236
- </span> <span class='int'>0</span>
1237
-
1238
- <span class='kw'>end</span></pre>
1239
- </td>
1240
- </tr>
1241
- </table>
1242
- </div>
1243
-
1244
- <div class="method_details ">
1245
- <h3 class="signature " id="wss-instance_method">
1246
-
1247
- - (<tt>Object</tt>) <strong>wss</strong>(lengths = nil)
1248
-
1249
-
1250
-
1251
-
1252
-
1253
- </h3><div class="docstring">
1254
- <div class="discussion">
1255
-
1256
- <p>Returns within cluster sum of squares</p>
1257
-
1258
-
1259
- </div>
1260
- </div>
1261
- <div class="tags">
1262
-
1263
-
1264
- </div><table class="source_code">
1265
- <tr>
1266
- <td>
1267
- <pre class="lines">
1268
-
1269
-
1270
- 229
1271
- 230
1272
- 231
1273
- 232
1274
- 233
1275
- 234
1276
- 235
1277
- 236
1278
- 237
1279
- 238
1280
- 239
1281
- 240
1282
- 241</pre>
1283
- </td>
1284
- <td>
1285
- <pre class="code"><span class="info file"># File 'lib/genevalidator/clusterization.rb', line 229</span>
1286
-
1287
- <span class='kw'>def</span> <span class='id identifier rubyid_wss'>wss</span><span class='lparen'>(</span><span class='id identifier rubyid_lengths'>lengths</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1288
- <span class='kw'>if</span> <span class='id identifier rubyid_lengths'>lengths</span> <span class='op'>==</span> <span class='kw'>nil</span>
1289
- <span class='id identifier rubyid_lengths'>lengths</span> <span class='op'>=</span> <span class='ivar'>@lengths</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_a'>a</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_x'>x</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
1290
- <span class='kw'>end</span>
1291
-
1292
- <span class='id identifier rubyid_cluster_mean'>cluster_mean</span> <span class='op'>=</span> <span class='id identifier rubyid_mean'>mean</span>
1293
- <span class='id identifier rubyid_ss'>ss</span> <span class='op'>=</span> <span class='int'>0</span>
1294
- <span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_len'>len</span><span class='op'>|</span>
1295
- <span class='id identifier rubyid_ss'>ss</span> <span class='op'>+=</span> <span class='lparen'>(</span><span class='id identifier rubyid_cluster_mean'>cluster_mean</span> <span class='op'>-</span> <span class='id identifier rubyid_len'>len</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='lparen'>(</span><span class='id identifier rubyid_cluster_mean'>cluster_mean</span> <span class='op'>-</span> <span class='id identifier rubyid_len'>len</span><span class='rparen'>)</span>
1296
- <span class='kw'>end</span>
1297
- <span class='id identifier rubyid_ss'>ss</span>
1298
-
1299
- <span class='kw'>end</span></pre>
1300
- </td>
1301
- </tr>
1302
- </table>
1303
- </div>
1304
-
1305
- </div>
1306
-
1307
- </div>
1308
-
1309
- <div id="footer">
1310
- Generated on Sat Sep 28 07:01:32 2013 by
1311
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1312
- 0.8.7.2 (ruby-1.9.3).
1313
- </div>
1314
-
1315
- </body>
1316
- </html>