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,1687 +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: AlignmentValidation
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 (A)</a> &raquo;
35
-
36
-
37
- <span class="title">AlignmentValidation</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: AlignmentValidation
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">AlignmentValidation</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_alignment.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 validations based on multiple
108
- alignment</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="#filename-instance_method" title="#filename (instance method)">- (Object) <strong>filename</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 filename.</p>
147
- </div></span>
148
-
149
- </li>
150
-
151
-
152
- <li class="public ">
153
- <span class="summary_signature">
154
-
155
- <a href="#index_file_name-instance_method" title="#index_file_name (instance method)">- (Object) <strong>index_file_name</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 index_file_name.</p>
176
- </div></span>
177
-
178
- </li>
179
-
180
-
181
- <li class="public ">
182
- <span class="summary_signature">
183
-
184
- <a href="#mafft_path-instance_method" title="#mafft_path (instance method)">- (Object) <strong>mafft_path</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 mafft_path.</p>
205
- </div></span>
206
-
207
- </li>
208
-
209
-
210
- <li class="public ">
211
- <span class="summary_signature">
212
-
213
- <a href="#multiple_alignment-instance_method" title="#multiple_alignment (instance method)">- (Object) <strong>multiple_alignment</strong> </a>
214
-
215
-
216
-
217
- </span>
218
-
219
-
220
-
221
-
222
- <span class="note title readonly">readonly</span>
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
- <span class="summary_desc"><div class='inline'>
233
- <p>Returns the value of attribute multiple_alignment.</p>
234
- </div></span>
235
-
236
- </li>
237
-
238
-
239
- </ul>
240
-
241
-
242
-
243
-
244
-
245
- <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="ValidationTest.html" title="ValidationTest (class)">ValidationTest</a></span></h3>
246
- <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>
247
-
248
-
249
-
250
- <h2>
251
- Instance Method Summary
252
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
253
- </h2>
254
-
255
- <ul class="summary">
256
-
257
- <li class="public ">
258
- <span class="summary_signature">
259
-
260
- <a href="#consensus_validation-instance_method" title="#consensus_validation (instance method)">- (Object) <strong>consensus_validation</strong>(prediction_raw, consensus) </a>
261
-
262
-
263
-
264
- </span>
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
- <span class="summary_desc"><div class='inline'>
275
- <p>Returns the percentage of consesnsus residues from the ma that are in the
276
- prediction Params: <tt>prediction</tt>: <tt>String</tt> corresponding to
277
- the prediction sequence <tt>consensus</tt>: <tt>String</tt> corresponding
278
- to the statistical model Output: <tt>Fixnum</tt> with the score.</p>
279
- </div></span>
280
-
281
- </li>
282
-
283
-
284
- <li class="public ">
285
- <span class="summary_signature">
286
-
287
- <a href="#extra_sequence_validation-instance_method" title="#extra_sequence_validation (instance method)">- (Object) <strong>extra_sequence_validation</strong>(prediction_raw, sm) </a>
288
-
289
-
290
-
291
- </span>
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
- <span class="summary_desc"><div class='inline'>
302
- <p>Returns the percentage of extra sequences in the prediction with respect
303
- to the statistical model Params: <tt>prediction</tt>: <tt>String</tt>
304
- corresponding to the prediction sequence <tt>sm</tt>: <tt>String</tt>
305
- corresponding to the statistical model Output: <tt>Fixnum</tt> with the
306
- score.</p>
307
- </div></span>
308
-
309
- </li>
310
-
311
-
312
- <li class="public ">
313
- <span class="summary_signature">
314
-
315
- <a href="#gap_validation-instance_method" title="#gap_validation (instance method)">- (Object) <strong>gap_validation</strong>(prediction_raw, sm) </a>
316
-
317
-
318
-
319
- </span>
320
-
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
-
329
- <span class="summary_desc"><div class='inline'>
330
- <p>Returns the percentage of gaps in the prediction with respect to the
331
- statistical model Params: <tt>prediction</tt>: <tt>String</tt>
332
- corresponding to the prediction sequence <tt>sm</tt>: <tt>String</tt>
333
- corresponding to the statistical model Output: <tt>Fixnum</tt> with the
334
- score.</p>
335
- </div></span>
336
-
337
- </li>
338
-
339
-
340
- <li class="public ">
341
- <span class="summary_signature">
342
-
343
- <a href="#get_consensus-instance_method" title="#get_consensus (instance method)">- (Object) <strong>get_consensus</strong>(ma = @multiple_alignment) </a>
344
-
345
-
346
-
347
- </span>
348
-
349
-
350
-
351
-
352
-
353
-
354
-
355
-
356
-
357
- <span class="summary_desc"><div class='inline'>
358
- <p>Returns the consensus regions among a set of multiple aligned sequences
359
- i.e positions where there is the same element in all sequences Params:
360
- <tt>ma</tt>: array of <tt>String</tt>s, corresponding to the multiple aligned
361
- sequences Output: <tt>String</tt> with the consensus regions.</p>
362
- </div></span>
363
-
364
- </li>
365
-
366
-
367
- <li class="public ">
368
- <span class="summary_signature">
369
-
370
- <a href="#get_sm_pssm-instance_method" title="#get_sm_pssm (instance method)">- (Object) <strong>get_sm_pssm</strong>(ma = @multiple_alignment, threshold = 0.7) </a>
371
-
372
-
373
-
374
- </span>
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
-
384
- <span class="summary_desc"><div class='inline'>
385
- <p>Builds a statistical model from a set of multiple aligned sequences based
386
- on PSSM (Position Specific Matrix) Params: <tt>ma</tt>: array of <tt>String</tt>s,
387
- corresponding to the multiple aligned sequences <tt>threshold</tt>: the
388
- percentage of the genes that will be considered in the statistical model
389
- Output: <tt>String</tt> representing the statistical model.</p>
390
- </div></span>
391
-
392
- </li>
393
-
394
-
395
- <li class="public ">
396
- <span class="summary_signature">
397
-
398
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (AlignmentValidation) <strong>initialize</strong>(type, prediction, hits, filename, mafft_path, index_file_name) </a>
399
-
400
-
401
-
402
- </span>
403
-
404
-
405
- <span class="note title constructor">constructor</span>
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
- <span class="summary_desc"><div class='inline'>
415
- <p>A new instance of AlignmentValidation.</p>
416
- </div></span>
417
-
418
- </li>
419
-
420
-
421
- <li class="public ">
422
- <span class="summary_signature">
423
-
424
- <a href="#isalpha-instance_method" title="#isalpha (instance method)">- (Object) <strong>isalpha</strong>(str) </a>
425
-
426
-
427
-
428
- </span>
429
-
430
-
431
-
432
-
433
-
434
-
435
-
436
-
437
-
438
- <span class="summary_desc"><div class='inline'>
439
- <p>Returns true if the string contains only letters and false otherwise.</p>
440
- </div></span>
441
-
442
- </li>
443
-
444
-
445
- <li class="public ">
446
- <span class="summary_signature">
447
-
448
- <a href="#multiple_align_mafft-instance_method" title="#multiple_align_mafft (instance method)">- (Object) <strong>multiple_align_mafft</strong>(prediction = @prediction, hits = @hits, path = @mafft_path) </a>
449
-
450
-
451
-
452
- </span>
453
-
454
-
455
-
456
-
457
-
458
-
459
-
460
-
461
-
462
- <span class="summary_desc"><div class='inline'>
463
- <p>Builds the multiple alignment between all the hits and the prediction
464
- using MAFFT tool Also creates a fasta file with the alignment Params:
465
- <tt>prediction</tt>: a <tt>Sequence</tt> object representing the blast
466
- query <tt>hits</tt>: a vector of <tt>Sequience</tt> objects (usually
467
- representig the blast hits) <tt>path</tt>: path of mafft installation
468
- Output: Array of <tt>String</tt>s, corresponding to the multiple aligned
469
- sequences.</p>
470
- </div></span>
471
-
472
- </li>
473
-
474
-
475
- <li class="public ">
476
- <span class="summary_signature">
477
-
478
- <a href="#plot_alignment-instance_method" title="#plot_alignment (instance method)">- (Object) <strong>plot_alignment</strong>(output = &quot;#{@filename}_ma.json&quot;, ma = @multiple_alignment, prediction = @prediction, sm) </a>
479
-
480
-
481
-
482
- </span>
483
-
484
-
485
-
486
-
487
-
488
-
489
-
490
-
491
-
492
- <span class="summary_desc"><div class='inline'>
493
- <p>Generates a json file cotaining data used for plotting lines for multiple
494
- hits alignment, prediction and statistical model Params: <tt>output</tt>:
495
- filneme of the json file <tt>ma</tt>: <tt>String</tt> array with the
496
- multiple alignmened hits and prediction <tt>prediction</tt>:
497
- <tt>Sequence</tt> object <tt>sm</tt>: <tt>String</tt> with the statistical
498
- model.</p>
499
- </div></span>
500
-
501
- </li>
502
-
503
-
504
- <li class="public ">
505
- <span class="summary_signature">
506
-
507
- <a href="#remove_isolated_residues-instance_method" title="#remove_isolated_residues (instance method)">- (Object) <strong>remove_isolated_residues</strong>(seq, len = 2) </a>
508
-
509
-
510
-
511
- </span>
512
-
513
-
514
-
515
-
516
-
517
-
518
-
519
-
520
-
521
- <span class="summary_desc"><div class='inline'>
522
- <p>Remove isolated residues inside long gaps from a given sequence Params:
523
- <tt>seq</tt>:<tt>String</tt>: sequence of residues
524
- <tt>len</tt>:<tt>Fixnum</tt>: number of isolated residues to be removed
525
- Output: <tt>String</tt>: the new sequence.</p>
526
- </div></span>
527
-
528
- </li>
529
-
530
-
531
- <li class="public ">
532
- <span class="summary_signature">
533
-
534
- <a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong>(n = 10) </a>
535
-
536
-
537
-
538
- </span>
539
-
540
-
541
-
542
-
543
-
544
-
545
-
546
-
547
-
548
- <span class="summary_desc"><div class='inline'>
549
- <p>Find gaps/extra regions based on the multiple alignment of the first n
550
- hits Output: <tt>AlignmentValidationOutput</tt> object.</p>
551
- </div></span>
552
-
553
- </li>
554
-
555
-
556
- </ul>
557
-
558
-
559
-
560
-
561
-
562
-
563
-
564
-
565
- <div id="constructor_details" class="method_details_list">
566
- <h2>Constructor Details</h2>
567
-
568
- <div class="method_details first">
569
- <h3 class="signature first" id="initialize-instance_method">
570
-
571
- - (<tt><span class='object_link'><a href="" title="AlignmentValidation (class)">AlignmentValidation</a></span></tt>) <strong>initialize</strong>(type, prediction, hits, filename, mafft_path, index_file_name)
572
-
573
-
574
-
575
-
576
-
577
- </h3><div class="docstring">
578
- <div class="discussion">
579
-
580
- <p>Returns a new instance of AlignmentValidation</p>
581
-
582
-
583
- </div>
584
- </div>
585
- <div class="tags">
586
-
587
-
588
- </div><table class="source_code">
589
- <tr>
590
- <td>
591
- <pre class="lines">
592
-
593
-
594
- 47
595
- 48
596
- 49
597
- 50
598
- 51
599
- 52
600
- 53
601
- 54
602
- 55
603
- 56
604
- 57
605
- 58
606
- 59
607
- 60
608
- 61
609
- 62</pre>
610
- </td>
611
- <td>
612
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 47</span>
613
-
614
- <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='comma'>,</span> <span class='id identifier rubyid_mafft_path'>mafft_path</span><span class='comma'>,</span> <span class='id identifier rubyid_index_file_name'>index_file_name</span><span class='rparen'>)</span>
615
- <span class='kw'>super</span>
616
- <span class='ivar'>@filename</span> <span class='op'>=</span> <span class='id identifier rubyid_filename'>filename</span>
617
- <span class='ivar'>@mafft_path</span> <span class='op'>=</span> <span class='id identifier rubyid_mafft_path'>mafft_path</span>
618
- <span class='ivar'>@index_file_name</span> <span class='op'>=</span> <span class='id identifier rubyid_index_file_name'>index_file_name</span>
619
- <span class='ivar'>@short_header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>MA</span><span class='tstring_end'>&quot;</span></span>
620
- <span class='ivar'>@header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Missing/Extra sequences</span><span class='tstring_end'>&quot;</span></span>
621
- <span class='ivar'>@description</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Finds missing and extra sequences in the prediction, based</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
622
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> on the multiple alignment of the best hits. Also counts the percentahe of</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
623
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> the conserved regions that appear in the prediction. Meaning of the output:</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
624
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> the percentages of the missing/extra sequences with respect to the multiple</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
625
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> alignment. Validation fails if one of these values is higher than 20%.</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
626
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> Percentage of the conserved residues.</span><span class='tstring_end'>&quot;</span></span>
627
- <span class='ivar'>@multiple_alignment</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
628
- <span class='ivar'>@cli_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>align</span><span class='tstring_end'>&quot;</span></span>
629
- <span class='kw'>end</span></pre>
630
- </td>
631
- </tr>
632
- </table>
633
- </div>
634
-
635
- </div>
636
-
637
- <div id="instance_attr_details" class="attr_details">
638
- <h2>Instance Attribute Details</h2>
639
-
640
-
641
- <span id=""></span>
642
- <div class="method_details first">
643
- <h3 class="signature first" id="filename-instance_method">
644
-
645
- - (<tt>Object</tt>) <strong>filename</strong> <span class="extras">(readonly)</span>
646
-
647
-
648
-
649
-
650
-
651
- </h3><div class="docstring">
652
- <div class="discussion">
653
-
654
- <p>Returns the value of attribute filename</p>
655
-
656
-
657
- </div>
658
- </div>
659
- <div class="tags">
660
-
661
-
662
- </div><table class="source_code">
663
- <tr>
664
- <td>
665
- <pre class="lines">
666
-
667
-
668
- 42
669
- 43
670
- 44</pre>
671
- </td>
672
- <td>
673
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 42</span>
674
-
675
- <span class='kw'>def</span> <span class='id identifier rubyid_filename'>filename</span>
676
- <span class='ivar'>@filename</span>
677
- <span class='kw'>end</span></pre>
678
- </td>
679
- </tr>
680
- </table>
681
- </div>
682
-
683
-
684
- <span id=""></span>
685
- <div class="method_details ">
686
- <h3 class="signature " id="index_file_name-instance_method">
687
-
688
- - (<tt>Object</tt>) <strong>index_file_name</strong> <span class="extras">(readonly)</span>
689
-
690
-
691
-
692
-
693
-
694
- </h3><div class="docstring">
695
- <div class="discussion">
696
-
697
- <p>Returns the value of attribute index_file_name</p>
698
-
699
-
700
- </div>
701
- </div>
702
- <div class="tags">
703
-
704
-
705
- </div><table class="source_code">
706
- <tr>
707
- <td>
708
- <pre class="lines">
709
-
710
-
711
- 45
712
- 46
713
- 47</pre>
714
- </td>
715
- <td>
716
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 45</span>
717
-
718
- <span class='kw'>def</span> <span class='id identifier rubyid_index_file_name'>index_file_name</span>
719
- <span class='ivar'>@index_file_name</span>
720
- <span class='kw'>end</span></pre>
721
- </td>
722
- </tr>
723
- </table>
724
- </div>
725
-
726
-
727
- <span id=""></span>
728
- <div class="method_details ">
729
- <h3 class="signature " id="mafft_path-instance_method">
730
-
731
- - (<tt>Object</tt>) <strong>mafft_path</strong> <span class="extras">(readonly)</span>
732
-
733
-
734
-
735
-
736
-
737
- </h3><div class="docstring">
738
- <div class="discussion">
739
-
740
- <p>Returns the value of attribute mafft_path</p>
741
-
742
-
743
- </div>
744
- </div>
745
- <div class="tags">
746
-
747
-
748
- </div><table class="source_code">
749
- <tr>
750
- <td>
751
- <pre class="lines">
752
-
753
-
754
- 44
755
- 45
756
- 46</pre>
757
- </td>
758
- <td>
759
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 44</span>
760
-
761
- <span class='kw'>def</span> <span class='id identifier rubyid_mafft_path'>mafft_path</span>
762
- <span class='ivar'>@mafft_path</span>
763
- <span class='kw'>end</span></pre>
764
- </td>
765
- </tr>
766
- </table>
767
- </div>
768
-
769
-
770
- <span id=""></span>
771
- <div class="method_details ">
772
- <h3 class="signature " id="multiple_alignment-instance_method">
773
-
774
- - (<tt>Object</tt>) <strong>multiple_alignment</strong> <span class="extras">(readonly)</span>
775
-
776
-
777
-
778
-
779
-
780
- </h3><div class="docstring">
781
- <div class="discussion">
782
-
783
- <p>Returns the value of attribute multiple_alignment</p>
784
-
785
-
786
- </div>
787
- </div>
788
- <div class="tags">
789
-
790
-
791
- </div><table class="source_code">
792
- <tr>
793
- <td>
794
- <pre class="lines">
795
-
796
-
797
- 43
798
- 44
799
- 45</pre>
800
- </td>
801
- <td>
802
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 43</span>
803
-
804
- <span class='kw'>def</span> <span class='id identifier rubyid_multiple_alignment'>multiple_alignment</span>
805
- <span class='ivar'>@multiple_alignment</span>
806
- <span class='kw'>end</span></pre>
807
- </td>
808
- </tr>
809
- </table>
810
- </div>
811
-
812
- </div>
813
-
814
-
815
- <div id="instance_method_details" class="method_details_list">
816
- <h2>Instance Method Details</h2>
817
-
818
-
819
- <div class="method_details first">
820
- <h3 class="signature first" id="consensus_validation-instance_method">
821
-
822
- - (<tt>Object</tt>) <strong>consensus_validation</strong>(prediction_raw, consensus)
823
-
824
-
825
-
826
-
827
-
828
- </h3><div class="docstring">
829
- <div class="discussion">
830
-
831
- <p>Returns the percentage of consesnsus residues from the ma that are in the
832
- prediction Params: <tt>prediction</tt>: <tt>String</tt> corresponding to
833
- the prediction sequence <tt>consensus</tt>: <tt>String</tt> corresponding
834
- to the statistical model Output: <tt>Fixnum</tt> with the score</p>
835
-
836
-
837
- </div>
838
- </div>
839
- <div class="tags">
840
-
841
-
842
- </div><table class="source_code">
843
- <tr>
844
- <td>
845
- <pre class="lines">
846
-
847
-
848
- 253
849
- 254
850
- 255
851
- 256
852
- 257
853
- 258
854
- 259
855
- 260
856
- 261
857
- 262
858
- 263
859
- 264
860
- 265
861
- 266
862
- 267
863
- 268
864
- 269
865
- 270</pre>
866
- </td>
867
- <td>
868
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 253</span>
869
-
870
- <span class='kw'>def</span> <span class='id identifier rubyid_consensus_validation'>consensus_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='comma'>,</span> <span class='id identifier rubyid_consensus'>consensus</span><span class='rparen'>)</span>
871
- <span class='kw'>if</span> <span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>!=</span> <span class='id identifier rubyid_consensus'>consensus</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
872
- <span class='kw'>return</span> <span class='int'>1</span>
873
- <span class='kw'>end</span>
874
- <span class='comment'># find consnsus that are in the ma
875
- </span> <span class='comment'># but not in the prediction
876
- </span> <span class='id identifier rubyid_no_conserved_pred'>no_conserved_pred</span> <span class='op'>=</span> <span class='int'>0</span>
877
- <span class='id identifier rubyid_no_conserved_residues'>no_conserved_residues</span> <span class='op'>=</span> <span class='int'>0</span>
878
- <span class='lparen'>(</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_consensus'>consensus</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='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
879
- <span class='kw'>if</span> <span class='id identifier rubyid_consensus'>consensus</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span>
880
- <span class='id identifier rubyid_no_conserved_residues'>no_conserved_residues</span> <span class='op'>+=</span> <span class='int'>1</span>
881
- <span class='kw'>end</span>
882
- <span class='kw'>if</span> <span class='id identifier rubyid_consensus'>consensus</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span> <span class='kw'>and</span> <span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_consensus'>consensus</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span>
883
- <span class='id identifier rubyid_no_conserved_pred'>no_conserved_pred</span> <span class='op'>+=</span> <span class='int'>1</span>
884
- <span class='kw'>end</span>
885
- <span class='kw'>end</span>
886
- <span class='kw'>return</span> <span class='id identifier rubyid_no_conserved_pred'>no_conserved_pred</span><span class='op'>/</span><span class='lparen'>(</span><span class='id identifier rubyid_no_conserved_residues'>no_conserved_residues</span> <span class='op'>+</span> <span class='float'>0.0</span><span class='rparen'>)</span>
887
- <span class='kw'>end</span></pre>
888
- </td>
889
- </tr>
890
- </table>
891
- </div>
892
-
893
- <div class="method_details ">
894
- <h3 class="signature " id="extra_sequence_validation-instance_method">
895
-
896
- - (<tt>Object</tt>) <strong>extra_sequence_validation</strong>(prediction_raw, sm)
897
-
898
-
899
-
900
-
901
-
902
- </h3><div class="docstring">
903
- <div class="discussion">
904
-
905
- <p>Returns the percentage of extra sequences in the prediction with respect
906
- to the statistical model Params: <tt>prediction</tt>: <tt>String</tt>
907
- corresponding to the prediction sequence <tt>sm</tt>: <tt>String</tt>
908
- corresponding to the statistical model Output: <tt>Fixnum</tt> with the
909
- score</p>
910
-
911
-
912
- </div>
913
- </div>
914
- <div class="tags">
915
-
916
-
917
- </div><table class="source_code">
918
- <tr>
919
- <td>
920
- <pre class="lines">
921
-
922
-
923
- 229
924
- 230
925
- 231
926
- 232
927
- 233
928
- 234
929
- 235
930
- 236
931
- 237
932
- 238
933
- 239
934
- 240
935
- 241
936
- 242
937
- 243</pre>
938
- </td>
939
- <td>
940
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 229</span>
941
-
942
- <span class='kw'>def</span> <span class='id identifier rubyid_extra_sequence_validation'>extra_sequence_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='comma'>,</span> <span class='id identifier rubyid_sm'>sm</span><span class='rparen'>)</span>
943
- <span class='kw'>if</span> <span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>!=</span> <span class='id identifier rubyid_sm'>sm</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
944
- <span class='kw'>return</span> <span class='int'>1</span>
945
- <span class='kw'>end</span>
946
- <span class='comment'># find residues that are in the prediction
947
- </span> <span class='comment'># but not in the statistical model
948
- </span> <span class='id identifier rubyid_no_insertions'>no_insertions</span> <span class='op'>=</span> <span class='int'>0</span>
949
- <span class='lparen'>(</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_sm'>sm</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='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
950
- <span class='kw'>if</span> <span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span> <span class='kw'>and</span> <span class='id identifier rubyid_sm'>sm</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='op'>==</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span>
951
- <span class='id identifier rubyid_no_insertions'>no_insertions</span> <span class='op'>+=</span> <span class='int'>1</span>
952
- <span class='kw'>end</span>
953
- <span class='kw'>end</span>
954
- <span class='id identifier rubyid_no_insertions'>no_insertions</span><span class='op'>/</span><span class='lparen'>(</span><span class='id identifier rubyid_sm'>sm</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>+</span><span class='float'>0.0</span><span class='rparen'>)</span>
955
-
956
- <span class='kw'>end</span></pre>
957
- </td>
958
- </tr>
959
- </table>
960
- </div>
961
-
962
- <div class="method_details ">
963
- <h3 class="signature " id="gap_validation-instance_method">
964
-
965
- - (<tt>Object</tt>) <strong>gap_validation</strong>(prediction_raw, sm)
966
-
967
-
968
-
969
-
970
-
971
- </h3><div class="docstring">
972
- <div class="discussion">
973
-
974
- <p>Returns the percentage of gaps in the prediction with respect to the
975
- statistical model Params: <tt>prediction</tt>: <tt>String</tt>
976
- corresponding to the prediction sequence <tt>sm</tt>: <tt>String</tt>
977
- corresponding to the statistical model Output: <tt>Fixnum</tt> with the
978
- score</p>
979
-
980
-
981
- </div>
982
- </div>
983
- <div class="tags">
984
-
985
-
986
- </div><table class="source_code">
987
- <tr>
988
- <td>
989
- <pre class="lines">
990
-
991
-
992
- 206
993
- 207
994
- 208
995
- 209
996
- 210
997
- 211
998
- 212
999
- 213
1000
- 214
1001
- 215
1002
- 216
1003
- 217
1004
- 218
1005
- 219</pre>
1006
- </td>
1007
- <td>
1008
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 206</span>
1009
-
1010
- <span class='kw'>def</span> <span class='id identifier rubyid_gap_validation'>gap_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='comma'>,</span> <span class='id identifier rubyid_sm'>sm</span><span class='rparen'>)</span>
1011
- <span class='comment'># find gaps in the prediction and
1012
- </span> <span class='comment'># not in the statistical model
1013
- </span> <span class='kw'>if</span> <span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>!=</span> <span class='id identifier rubyid_sm'>sm</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
1014
- <span class='kw'>return</span> <span class='int'>1</span>
1015
- <span class='kw'>end</span>
1016
- <span class='id identifier rubyid_no_gaps'>no_gaps</span> <span class='op'>=</span> <span class='int'>0</span>
1017
- <span class='lparen'>(</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_sm'>sm</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='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
1018
- <span class='kw'>if</span> <span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span> <span class='kw'>and</span> <span class='id identifier rubyid_sm'>sm</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='op'>!=</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span>
1019
- <span class='id identifier rubyid_no_gaps'>no_gaps</span> <span class='op'>+=</span> <span class='int'>1</span>
1020
- <span class='kw'>end</span>
1021
- <span class='kw'>end</span>
1022
- <span class='id identifier rubyid_no_gaps'>no_gaps</span><span class='op'>/</span><span class='lparen'>(</span><span class='id identifier rubyid_sm'>sm</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>+</span><span class='float'>0.0</span><span class='rparen'>)</span>
1023
- <span class='kw'>end</span></pre>
1024
- </td>
1025
- </tr>
1026
- </table>
1027
- </div>
1028
-
1029
- <div class="method_details ">
1030
- <h3 class="signature " id="get_consensus-instance_method">
1031
-
1032
- - (<tt>Object</tt>) <strong>get_consensus</strong>(ma = @multiple_alignment)
1033
-
1034
-
1035
-
1036
-
1037
-
1038
- </h3><div class="docstring">
1039
- <div class="discussion">
1040
-
1041
- <p>Returns the consensus regions among a set of multiple aligned sequences
1042
- i.e positions where there is the same element in all sequences Params:
1043
- <tt>ma</tt>: array of <tt>String</tt>s, corresponding to the multiple aligned
1044
- sequences Output: <tt>String</tt> with the consensus regions</p>
1045
-
1046
-
1047
- </div>
1048
- </div>
1049
- <div class="tags">
1050
-
1051
-
1052
- </div><table class="source_code">
1053
- <tr>
1054
- <td>
1055
- <pre class="lines">
1056
-
1057
-
1058
- 193
1059
- 194
1060
- 195
1061
- 196</pre>
1062
- </td>
1063
- <td>
1064
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 193</span>
1065
-
1066
- <span class='kw'>def</span> <span class='id identifier rubyid_get_consensus'>get_consensus</span><span class='lparen'>(</span><span class='id identifier rubyid_ma'>ma</span> <span class='op'>=</span> <span class='ivar'>@multiple_alignment</span><span class='rparen'>)</span>
1067
- <span class='id identifier rubyid_align'>align</span> <span class='op'>=</span> <span class='const'>Bio</span><span class='op'>::</span><span class='const'>Alignment</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_ma'>ma</span><span class='rparen'>)</span>
1068
- <span class='id identifier rubyid_consensus'>consensus</span> <span class='op'>=</span> <span class='id identifier rubyid_align'>align</span><span class='period'>.</span><span class='id identifier rubyid_consensus'>consensus</span>
1069
- <span class='kw'>end</span></pre>
1070
- </td>
1071
- </tr>
1072
- </table>
1073
- </div>
1074
-
1075
- <div class="method_details ">
1076
- <h3 class="signature " id="get_sm_pssm-instance_method">
1077
-
1078
- - (<tt>Object</tt>) <strong>get_sm_pssm</strong>(ma = @multiple_alignment, threshold = 0.7)
1079
-
1080
-
1081
-
1082
-
1083
-
1084
- </h3><div class="docstring">
1085
- <div class="discussion">
1086
-
1087
- <p>Builds a statistical model from a set of multiple aligned sequences based
1088
- on PSSM (Position Specific Matrix) Params: <tt>ma</tt>: array of <tt>String</tt>s,
1089
- corresponding to the multiple aligned sequences <tt>threshold</tt>: the
1090
- percentage of the genes that will be considered in the statistical model
1091
- Output: <tt>String</tt> representing the statistical model</p>
1092
-
1093
-
1094
- </div>
1095
- </div>
1096
- <div class="tags">
1097
-
1098
-
1099
- </div><table class="source_code">
1100
- <tr>
1101
- <td>
1102
- <pre class="lines">
1103
-
1104
-
1105
- 281
1106
- 282
1107
- 283
1108
- 284
1109
- 285
1110
- 286
1111
- 287
1112
- 288
1113
- 289
1114
- 290
1115
- 291
1116
- 292
1117
- 293
1118
- 294
1119
- 295
1120
- 296</pre>
1121
- </td>
1122
- <td>
1123
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 281</span>
1124
-
1125
- <span class='kw'>def</span> <span class='id identifier rubyid_get_sm_pssm'>get_sm_pssm</span><span class='lparen'>(</span><span class='id identifier rubyid_ma'>ma</span> <span class='op'>=</span> <span class='ivar'>@multiple_alignment</span><span class='comma'>,</span> <span class='id identifier rubyid_threshold'>threshold</span> <span class='op'>=</span> <span class='float'>0.7</span><span class='rparen'>)</span>
1126
- <span class='id identifier rubyid_sm'>sm</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
1127
- <span class='lparen'>(</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_ma'>ma</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</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='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
1128
- <span class='id identifier rubyid_freqs'>freqs</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
1129
- <span class='id identifier rubyid_ma'>ma</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_seq'>seq</span><span class='op'>|</span> <span class='id identifier rubyid_seq'>seq</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_res'>res</span><span class='op'>|</span> <span class='id identifier rubyid_freqs'>freqs</span><span class='lbracket'>[</span><span class='id identifier rubyid_res'>res</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='int'>1</span><span class='rbrace'>}</span>
1130
- <span class='comment'># get the residue with the highest frequency
1131
- </span> <span class='id identifier rubyid_max_freq'>max_freq</span> <span class='op'>=</span> <span class='id identifier rubyid_freqs'>freqs</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_res'>res</span><span class='comma'>,</span> <span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='id identifier rubyid_n'>n</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span>
1132
- <span class='kw'>if</span> <span class='id identifier rubyid_max_freq'>max_freq</span><span class='op'>/</span><span class='lparen'>(</span><span class='id identifier rubyid_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>+</span><span class='float'>0.0</span><span class='rparen'>)</span> <span class='op'>&gt;=</span> <span class='id identifier rubyid_threshold'>threshold</span>
1133
- <span class='id identifier rubyid_residue'>residue</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_freqs'>freqs</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_res'>res</span><span class='comma'>,</span> <span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='id identifier rubyid_n'>n</span> <span class='op'>==</span> <span class='id identifier rubyid_max_freq'>max_freq</span> <span class='op'>?</span> <span class='id identifier rubyid_res'>res</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
1134
- <span class='id identifier rubyid_sm'>sm</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_residue'>residue</span>
1135
- <span class='kw'>else</span>
1136
- <span class='id identifier rubyid_sm'>sm</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>?</span><span class='tstring_end'>&quot;</span></span>
1137
- <span class='kw'>end</span>
1138
- <span class='kw'>end</span>
1139
- <span class='id identifier rubyid_sm'>sm</span>
1140
- <span class='kw'>end</span></pre>
1141
- </td>
1142
- </tr>
1143
- </table>
1144
- </div>
1145
-
1146
- <div class="method_details ">
1147
- <h3 class="signature " id="isalpha-instance_method">
1148
-
1149
- - (<tt>Object</tt>) <strong>isalpha</strong>(str)
1150
-
1151
-
1152
-
1153
-
1154
-
1155
- </h3><div class="docstring">
1156
- <div class="discussion">
1157
-
1158
- <p>Returns true if the string contains only letters and false otherwise</p>
1159
-
1160
-
1161
- </div>
1162
- </div>
1163
- <div class="tags">
1164
-
1165
-
1166
- </div><table class="source_code">
1167
- <tr>
1168
- <td>
1169
- <pre class="lines">
1170
-
1171
-
1172
- 333
1173
- 334
1174
- 335</pre>
1175
- </td>
1176
- <td>
1177
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 333</span>
1178
-
1179
- <span class='kw'>def</span> <span class='id identifier rubyid_isalpha'>isalpha</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
1180
- <span class='op'>!</span><span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[^A-Za-z]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
1181
- <span class='kw'>end</span></pre>
1182
- </td>
1183
- </tr>
1184
- </table>
1185
- </div>
1186
-
1187
- <div class="method_details ">
1188
- <h3 class="signature " id="multiple_align_mafft-instance_method">
1189
-
1190
- - (<tt>Object</tt>) <strong>multiple_align_mafft</strong>(prediction = @prediction, hits = @hits, path = @mafft_path)
1191
-
1192
-
1193
-
1194
-
1195
-
1196
- </h3><div class="docstring">
1197
- <div class="discussion">
1198
-
1199
- <p>Builds the multiple alignment between all the hits and the prediction
1200
- using MAFFT tool Also creates a fasta file with the alignment Params:
1201
- <tt>prediction</tt>: a <tt>Sequence</tt> object representing the blast
1202
- query <tt>hits</tt>: a vector of <tt>Sequience</tt> objects (usually
1203
- representig the blast hits) <tt>path</tt>: path of mafft installation
1204
- Output: Array of <tt>String</tt>s, corresponding to the multiple aligned sequences</p>
1205
-
1206
-
1207
- </div>
1208
- </div>
1209
- <div class="tags">
1210
-
1211
- <p class="tag_title">Raises:</p>
1212
- <ul class="raise">
1213
-
1214
- <li>
1215
-
1216
-
1217
- <span class='type'>(<tt>Exception</tt>)</span>
1218
-
1219
-
1220
-
1221
- </li>
1222
-
1223
- </ul>
1224
-
1225
- </div><table class="source_code">
1226
- <tr>
1227
- <td>
1228
- <pre class="lines">
1229
-
1230
-
1231
- 159
1232
- 160
1233
- 161
1234
- 162
1235
- 163
1236
- 164
1237
- 165
1238
- 166
1239
- 167
1240
- 168
1241
- 169
1242
- 170
1243
- 171
1244
- 172
1245
- 173
1246
- 174
1247
- 175
1248
- 176
1249
- 177
1250
- 178
1251
- 179
1252
- 180
1253
- 181
1254
- 182</pre>
1255
- </td>
1256
- <td>
1257
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 159</span>
1258
-
1259
- <span class='kw'>def</span> <span class='id identifier rubyid_multiple_align_mafft'>multiple_align_mafft</span><span class='lparen'>(</span><span class='id identifier rubyid_prediction'>prediction</span> <span class='op'>=</span> <span class='ivar'>@prediction</span><span class='comma'>,</span> <span class='id identifier rubyid_hits'>hits</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='ivar'>@mafft_path</span><span class='rparen'>)</span>
1260
- <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> <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>
1261
-
1262
- <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--maxiterate</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1000</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--localpair</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--quiet</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
1263
- <span class='id identifier rubyid_mafft'>mafft</span> <span class='op'>=</span> <span class='const'>Bio</span><span class='op'>::</span><span class='const'>MAFFT</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
1264
- <span class='id identifier rubyid_sequences'>sequences</span> <span class='op'>=</span> <span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='op'>|</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_raw_sequence'>raw_sequence</span><span class='rbrace'>}</span>
1265
- <span class='id identifier rubyid_sequences'>sequences</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_prediction'>prediction</span><span class='period'>.</span><span class='id identifier rubyid_raw_sequence'>raw_sequence</span><span class='rparen'>)</span>
1266
-
1267
- <span class='id identifier rubyid_report'>report</span> <span class='op'>=</span> <span class='id identifier rubyid_mafft'>mafft</span><span class='period'>.</span><span class='id identifier rubyid_query_align'>query_align</span><span class='lparen'>(</span><span class='id identifier rubyid_sequences'>sequences</span><span class='rparen'>)</span>
1268
- <span class='comment'># Accesses the actual alignment.
1269
- </span> <span class='id identifier rubyid_align'>align</span> <span class='op'>=</span> <span class='id identifier rubyid_report'>report</span><span class='period'>.</span><span class='id identifier rubyid_alignment'>alignment</span>
1270
-
1271
- <span class='comment'># Prints each sequence to a file.
1272
- </span> <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='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'>_ma.fasta</span><span class='tstring_end'>&quot;</span></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>
1273
- <span class='id identifier rubyid_align'>align</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_s'>s</span><span class='comma'>,</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
1274
- <span class='ivar'>@multiple_alignment</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
1275
- <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='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&gt;seq</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_i'>i</span><span class='rbrace'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1276
- <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_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
1277
- <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='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1278
- <span class='kw'>end</span>
1279
- <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
1280
-
1281
- <span class='kw'>return</span> <span class='ivar'>@multiple_alignment</span>
1282
- <span class='kw'>end</span></pre>
1283
- </td>
1284
- </tr>
1285
- </table>
1286
- </div>
1287
-
1288
- <div class="method_details ">
1289
- <h3 class="signature " id="plot_alignment-instance_method">
1290
-
1291
- - (<tt>Object</tt>) <strong>plot_alignment</strong>(output = &quot;#{@filename}_ma.json&quot;, ma = @multiple_alignment, prediction = @prediction, sm)
1292
-
1293
-
1294
-
1295
-
1296
-
1297
- </h3><div class="docstring">
1298
- <div class="discussion">
1299
-
1300
- <p>Generates a json file cotaining data used for plotting lines for multiple
1301
- hits alignment, prediction and statistical model Params: <tt>output</tt>:
1302
- filneme of the json file <tt>ma</tt>: <tt>String</tt> array with the
1303
- multiple alignmened hits and prediction <tt>prediction</tt>:
1304
- <tt>Sequence</tt> object <tt>sm</tt>: <tt>String</tt> with the statistical
1305
- model</p>
1306
-
1307
-
1308
- </div>
1309
- </div>
1310
- <div class="tags">
1311
-
1312
-
1313
- </div><table class="source_code">
1314
- <tr>
1315
- <td>
1316
- <pre class="lines">
1317
-
1318
-
1319
- 344
1320
- 345
1321
- 346
1322
- 347
1323
- 348
1324
- 349
1325
- 350
1326
- 351
1327
- 352
1328
- 353
1329
- 354
1330
- 355
1331
- 356
1332
- 357
1333
- 358
1334
- 359
1335
- 360
1336
- 361
1337
- 362
1338
- 363
1339
- 364
1340
- 365
1341
- 366
1342
- 367
1343
- 368
1344
- 369
1345
- 370
1346
- 371
1347
- 372
1348
- 373
1349
- 374
1350
- 375
1351
- 376
1352
- 377
1353
- 378
1354
- 379</pre>
1355
- </td>
1356
- <td>
1357
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 344</span>
1358
-
1359
- <span class='kw'>def</span> <span class='id identifier rubyid_plot_alignment'>plot_alignment</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'>_ma.json</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_ma'>ma</span> <span class='op'>=</span> <span class='ivar'>@multiple_alignment</span><span class='comma'>,</span> <span class='id identifier rubyid_prediction'>prediction</span> <span class='op'>=</span> <span class='ivar'>@prediction</span><span class='comma'>,</span> <span class='id identifier rubyid_sm'>sm</span><span class='rparen'>)</span>
1360
-
1361
- <span class='comment'># get indeces of consensus in the multiple alignment
1362
- </span> <span class='id identifier rubyid_consensus'>consensus</span> <span class='op'>=</span> <span class='id identifier rubyid_get_consensus'>get_consensus</span><span class='lparen'>(</span><span class='ivar'>@multiple_alignment</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='ivar'>@multiple_alignment</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</span><span class='rparen'>)</span>
1363
- <span class='id identifier rubyid_consensus_idxs'>consensus_idxs</span> <span class='op'>=</span> <span class='id identifier rubyid_consensus'>consensus</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each_index'>each_index</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_j'>j</span><span class='op'>|</span> <span class='id identifier rubyid_isalpha'>isalpha</span><span class='lparen'>(</span><span class='id identifier rubyid_consensus'>consensus</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span>
1364
-
1365
- <span class='id identifier rubyid_len'>len</span> <span class='op'>=</span> <span class='id identifier rubyid_ma'>ma</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
1366
-
1367
- <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>
1368
- <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_ma'>ma</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</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_seq'>seq</span><span class='comma'>,</span> <span class='id identifier rubyid_j'>j</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_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='id identifier rubyid_j'>j</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_len'>len</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='op'>+</span>
1369
- <span class='id identifier rubyid_ma'>ma</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</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_seq'>seq</span><span class='comma'>,</span> <span class='id identifier rubyid_j'>j</span><span class='op'>|</span> <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each_index'>each_index</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_j'>j</span><span class='op'>|</span> <span class='id identifier rubyid_seq'>seq</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</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_gap'>gap</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_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='id identifier rubyid_j'>j</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_gap'>gap</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_gap'>gap</span><span class='op'>+</span><span class='int'>1</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'>black</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='op'>+</span>
1370
- <span class='id identifier rubyid_ma'>ma</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</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_seq'>seq</span><span class='comma'>,</span> <span class='id identifier rubyid_j'>j</span><span class='op'>|</span> <span class='id identifier rubyid_consensus_idxs'>consensus_idxs</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_con'>con</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_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='id identifier rubyid_j'>j</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_con'>con</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_con'>con</span><span class='op'>+</span><span class='int'>1</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'>yellow</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='op'>+</span>
1371
- <span class='comment'>#plot prediction
1372
- </span> <span class='lbracket'>[</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='int'>1</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_len'>len</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'>green</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rbracket'>]</span> <span class='op'>+</span>
1373
- <span class='id identifier rubyid_ma'>ma</span><span class='lbracket'>[</span><span class='id identifier rubyid_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each_index'>each_index</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_j'>j</span><span class='op'>|</span> <span class='id identifier rubyid_ma'>ma</span><span class='lbracket'>[</span><span class='id identifier rubyid_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</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_gap'>gap</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='int'>1</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_gap'>gap</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_gap'>gap</span><span class='op'>+</span><span class='int'>1</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'>black</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span> <span class='op'>+</span>
1374
- <span class='comment'>#plot statistical model
1375
- </span> <span class='lbracket'>[</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='int'>0</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_len'>len</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='rbracket'>]</span> <span class='op'>+</span>
1376
- <span class='id identifier rubyid_sm'>sm</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each_index'>each_index</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_j'>j</span><span class='op'>|</span> <span class='id identifier rubyid_isalpha'>isalpha</span><span class='lparen'>(</span><span class='id identifier rubyid_sm'>sm</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</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_con'>con</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='int'>0</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_con'>con</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_con'>con</span><span class='op'>+</span><span class='int'>1</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'>orange</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span> <span class='op'>+</span>
1377
- <span class='id identifier rubyid_sm'>sm</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each_index'>each_index</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_j'>j</span><span class='op'>|</span> <span class='id identifier rubyid_sm'>sm</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</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_gap'>gap</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='int'>0</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_gap'>gap</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_gap'>gap</span><span class='op'>+</span><span class='int'>1</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'>black</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rparen'>)</span>
1378
- <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
1379
-
1380
- <span class='id identifier rubyid_yAxisValues'>yAxisValues</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>sm, pred</span><span class='tstring_end'>&quot;</span></span>
1381
- <span class='lparen'>(</span><span class='int'>1</span><span class='op'>..</span><span class='id identifier rubyid_ma'>ma</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='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
1382
- <span class='id identifier rubyid_yAxisValues'>yAxisValues</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>, hit</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>-</span> <span class='id identifier rubyid_i'>i</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1383
- <span class='kw'>end</span>
1384
-
1385
- <span class='kw'>return</span> <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>
1386
- <span class='symbol'>:lines</span><span class='comma'>,</span>
1387
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Multiple alignment and Statistical model of blast hits</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
1388
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>gaps, black;consensus, yellow;mismatches, red;prediction, green;statistical model,orange</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
1389
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>alignment length</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
1390
- <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>
1391
- <span class='id identifier rubyid_ma'>ma</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>+</span><span class='int'>1</span><span class='comma'>,</span>
1392
- <span class='id identifier rubyid_yAxisValues'>yAxisValues</span><span class='rparen'>)</span>
1393
-
1394
- <span class='kw'>end</span></pre>
1395
- </td>
1396
- </tr>
1397
- </table>
1398
- </div>
1399
-
1400
- <div class="method_details ">
1401
- <h3 class="signature " id="remove_isolated_residues-instance_method">
1402
-
1403
- - (<tt>Object</tt>) <strong>remove_isolated_residues</strong>(seq, len = 2)
1404
-
1405
-
1406
-
1407
-
1408
-
1409
- </h3><div class="docstring">
1410
- <div class="discussion">
1411
-
1412
- <p>Remove isolated residues inside long gaps from a given sequence Params:
1413
- <tt>seq</tt>:<tt>String</tt>: sequence of residues
1414
- <tt>len</tt>:<tt>Fixnum</tt>: number of isolated residues to be removed
1415
- Output: <tt>String</tt>: the new sequence</p>
1416
-
1417
-
1418
- </div>
1419
- </div>
1420
- <div class="tags">
1421
-
1422
-
1423
- </div><table class="source_code">
1424
- <tr>
1425
- <td>
1426
- <pre class="lines">
1427
-
1428
-
1429
- 306
1430
- 307
1431
- 308
1432
- 309
1433
- 310
1434
- 311
1435
- 312
1436
- 313
1437
- 314
1438
- 315
1439
- 316
1440
- 317
1441
- 318
1442
- 319
1443
- 320
1444
- 321
1445
- 322
1446
- 323
1447
- 324
1448
- 325
1449
- 326
1450
- 327
1451
- 328</pre>
1452
- </td>
1453
- <td>
1454
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 306</span>
1455
-
1456
- <span class='kw'>def</span> <span class='id identifier rubyid_remove_isolated_residues'>remove_isolated_residues</span><span class='lparen'>(</span><span class='id identifier rubyid_seq'>seq</span><span class='comma'>,</span> <span class='id identifier rubyid_len'>len</span> <span class='op'>=</span> <span class='int'>2</span><span class='rparen'>)</span>
1457
- <span class='comment'>#puts seq
1458
- </span> <span class='id identifier rubyid_gap_starts'>gap_starts</span> <span class='op'>=</span> <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_to_enum'>to_enum</span><span class='lparen'>(</span><span class='symbol'>:scan</span><span class='comma'>,</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(-\w{1,</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_len'>len</span><span class='rbrace'>}</span><span class='tstring_content'>}-)</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_m'>m</span><span class='op'>|</span> <span class='backref'>$`</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>+</span> <span class='int'>1</span><span class='rbrace'>}</span>
1459
- <span class='comment'>#puts gap_starts.to_s
1460
- </span> <span class='comment'># remove isolated residues
1461
- </span> <span class='id identifier rubyid_gap_starts'>gap_starts</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
1462
- <span class='lparen'>(</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_len'>len</span><span class='op'>-</span><span class='int'>1</span><span class='rparen'>)</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_j'>j</span><span class='op'>|</span>
1463
- <span class='kw'>if</span> <span class='id identifier rubyid_isalpha'>isalpha</span><span class='lparen'>(</span><span class='id identifier rubyid_seq'>seq</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span><span class='rparen'>)</span>
1464
- <span class='id identifier rubyid_seq'>seq</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span>
1465
- <span class='kw'>end</span>
1466
- <span class='kw'>end</span>
1467
- <span class='kw'>end</span>
1468
- <span class='comment'>#remove isolated gaps
1469
- </span> <span class='id identifier rubyid_res_starts'>res_starts</span> <span class='op'>=</span> <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_to_enum'>to_enum</span><span class='lparen'>(</span><span class='symbol'>:scan</span><span class='comma'>,</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>([?\w]-{1,2}[?\w])</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_m'>m</span><span class='op'>|</span> <span class='backref'>$`</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>+</span> <span class='int'>1</span><span class='rbrace'>}</span>
1470
- <span class='id identifier rubyid_res_starts'>res_starts</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
1471
- <span class='lparen'>(</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_len'>len</span><span class='op'>-</span><span class='int'>1</span><span class='rparen'>)</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_j'>j</span><span class='op'>|</span>
1472
- <span class='kw'>if</span> <span class='id identifier rubyid_seq'>seq</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span>
1473
- <span class='id identifier rubyid_seq'>seq</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>?</span><span class='tstring_end'>'</span></span>
1474
- <span class='kw'>end</span>
1475
- <span class='kw'>end</span>
1476
- <span class='kw'>end</span>
1477
- <span class='id identifier rubyid_seq'>seq</span>
1478
- <span class='kw'>end</span></pre>
1479
- </td>
1480
- </tr>
1481
- </table>
1482
- </div>
1483
-
1484
- <div class="method_details ">
1485
- <h3 class="signature " id="run-instance_method">
1486
-
1487
- - (<tt>Object</tt>) <strong>run</strong>(n = 10)
1488
-
1489
-
1490
-
1491
-
1492
-
1493
- </h3><div class="docstring">
1494
- <div class="discussion">
1495
-
1496
- <p>Find gaps/extra regions based on the multiple alignment of the first n
1497
- hits Output: <tt>AlignmentValidationOutput</tt> object</p>
1498
-
1499
-
1500
- </div>
1501
- </div>
1502
- <div class="tags">
1503
-
1504
-
1505
- </div><table class="source_code">
1506
- <tr>
1507
- <td>
1508
- <pre class="lines">
1509
-
1510
-
1511
- 69
1512
- 70
1513
- 71
1514
- 72
1515
- 73
1516
- 74
1517
- 75
1518
- 76
1519
- 77
1520
- 78
1521
- 79
1522
- 80
1523
- 81
1524
- 82
1525
- 83
1526
- 84
1527
- 85
1528
- 86
1529
- 87
1530
- 88
1531
- 89
1532
- 90
1533
- 91
1534
- 92
1535
- 93
1536
- 94
1537
- 95
1538
- 96
1539
- 97
1540
- 98
1541
- 99
1542
- 100
1543
- 101
1544
- 102
1545
- 103
1546
- 104
1547
- 105
1548
- 106
1549
- 107
1550
- 108
1551
- 109
1552
- 110
1553
- 111
1554
- 112
1555
- 113
1556
- 114
1557
- 115
1558
- 116
1559
- 117
1560
- 118
1561
- 119
1562
- 120
1563
- 121
1564
- 122
1565
- 123
1566
- 124
1567
- 125
1568
- 126
1569
- 127
1570
- 128
1571
- 129
1572
- 130
1573
- 131
1574
- 132
1575
- 133
1576
- 134
1577
- 135
1578
- 136
1579
- 137
1580
- 138
1581
- 139
1582
- 140
1583
- 141
1584
- 142
1585
- 143
1586
- 144
1587
- 145
1588
- 146</pre>
1589
- </td>
1590
- <td>
1591
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_alignment.rb', line 69</span>
1592
-
1593
- <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_n'>n</span><span class='op'>=</span><span class='int'>10</span><span class='rparen'>)</span>
1594
- <span class='kw'>begin</span>
1595
- <span class='kw'>if</span> <span class='id identifier rubyid_n'>n</span> <span class='op'>&gt;</span> <span class='int'>50</span>
1596
- <span class='id identifier rubyid_n'>n</span> <span class='op'>=</span> <span class='int'>50</span>
1597
- <span class='kw'>end</span>
1598
-
1599
- <span class='kw'>if</span> <span class='id identifier rubyid_type'>type</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>protein</span><span class='tstring_end'>&quot;</span></span>
1600
- <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_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:unapplicable</span><span class='rparen'>)</span>
1601
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
1602
- <span class='kw'>end</span>
1603
-
1604
- <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='id identifier rubyid_n'>n</span>
1605
- <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> <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>
1606
- <span class='id identifier rubyid_start'>start</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
1607
- <span class='comment'># get the first n hits
1608
- </span> <span class='id identifier rubyid_less_hits'>less_hits</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='lbracket'>[</span><span class='id identifier rubyid_n'>n</span><span class='op'>-</span><span class='int'>1</span><span class='comma'>,</span><span class='ivar'>@hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='rbracket'>]</span>
1609
- <span class='id identifier rubyid_useless_hits'>useless_hits</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1610
- <span class='kw'>begin</span>
1611
- <span class='comment'># get raw sequences for less_hits
1612
- </span> <span class='id identifier rubyid_less_hits'>less_hits</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='op'>|</span>
1613
- <span class='kw'>if</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_raw_sequence'>raw_sequence</span> <span class='op'>==</span> <span class='kw'>nil</span>
1614
- <span class='comment'>#get gene by accession number
1615
- </span> <span class='kw'>if</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='symbol'>:protein</span>
1616
- <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_get_sequence_by_accession_no'>get_sequence_by_accession_no</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_accession_no'>accession_no</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>protein</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1617
- <span class='kw'>else</span>
1618
- <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_get_sequence_by_accession_no'>get_sequence_by_accession_no</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_accession_no'>accession_no</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>nucleotide</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1619
- <span class='kw'>end</span>
1620
- <span class='kw'>if</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_raw_sequence'>raw_sequence</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
1621
- <span class='id identifier rubyid_useless_hits'>useless_hits</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='rparen'>)</span>
1622
- <span class='kw'>end</span>
1623
- <span class='kw'>end</span>
1624
- <span class='kw'>end</span>
1625
- <span class='kw'>end</span>
1626
- <span class='id identifier rubyid_useless_hits'>useless_hits</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='op'>|</span> <span class='id identifier rubyid_less_hits'>less_hits</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='rparen'>)</span><span class='rbrace'>}</span>
1627
-
1628
- <span class='kw'>begin</span>
1629
- <span class='comment'># multiple align sequences from less_hits with the prediction
1630
- </span> <span class='id identifier rubyid_multiple_align_mafft'>multiple_align_mafft</span><span class='lparen'>(</span><span class='id identifier rubyid_prediction'>prediction</span><span class='comma'>,</span> <span class='id identifier rubyid_less_hits'>less_hits</span><span class='rparen'>)</span>
1631
- <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
1632
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoInternetError</span>
1633
- <span class='kw'>end</span>
1634
-
1635
- <span class='id identifier rubyid_sm'>sm</span> <span class='op'>=</span> <span class='id identifier rubyid_get_sm_pssm'>get_sm_pssm</span><span class='lparen'>(</span><span class='ivar'>@multiple_alignment</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='ivar'>@multiple_alignment</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</span><span class='rparen'>)</span>
1636
-
1637
- <span class='comment'># remove isolated residues from the predicted sequence
1638
- </span> <span class='id identifier rubyid_prediction_raw'>prediction_raw</span> <span class='op'>=</span> <span class='id identifier rubyid_remove_isolated_residues'>remove_isolated_residues</span><span class='lparen'>(</span><span class='ivar'>@multiple_alignment</span><span class='lbracket'>[</span><span class='ivar'>@multiple_alignment</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span>
1639
- <span class='comment'># remove isolated residues from the statistical model
1640
- </span> <span class='id identifier rubyid_sm'>sm</span> <span class='op'>=</span> <span class='id identifier rubyid_remove_isolated_residues'>remove_isolated_residues</span><span class='lparen'>(</span><span class='id identifier rubyid_sm'>sm</span><span class='rparen'>)</span>
1641
-
1642
- <span class='id identifier rubyid_plot1'>plot1</span> <span class='op'>=</span> <span class='id identifier rubyid_plot_alignment'>plot_alignment</span><span class='lparen'>(</span><span class='id identifier rubyid_sm'>sm</span><span class='rparen'>)</span>
1643
- <span class='id identifier rubyid_gaps'>gaps</span> <span class='op'>=</span> <span class='id identifier rubyid_gap_validation'>gap_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='comma'>,</span> <span class='id identifier rubyid_sm'>sm</span><span class='rparen'>)</span>
1644
- <span class='id identifier rubyid_extra_seq'>extra_seq</span> <span class='op'>=</span> <span class='id identifier rubyid_extra_sequence_validation'>extra_sequence_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='comma'>,</span> <span class='id identifier rubyid_sm'>sm</span><span class='rparen'>)</span>
1645
- <span class='id identifier rubyid_consensus'>consensus</span> <span class='op'>=</span> <span class='id identifier rubyid_consensus_validation'>consensus_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_prediction_raw'>prediction_raw</span><span class='comma'>,</span> <span class='id identifier rubyid_get_consensus'>get_consensus</span><span class='lparen'>(</span><span class='ivar'>@multiple_alignment</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='ivar'>@multiple_alignment</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
1646
-
1647
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>AlignmentValidationOutput</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_gaps'>gaps</span><span class='comma'>,</span> <span class='id identifier rubyid_extra_seq'>extra_seq</span><span class='comma'>,</span> <span class='id identifier rubyid_consensus'>consensus</span><span class='rparen'>)</span>
1648
- <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>
1649
- <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>
1650
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
1651
-
1652
- <span class='comment'># Exception is raised when blast founds no hits
1653
- </span> <span class='kw'>rescue</span> <span class='const'>NotEnoughHitsError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
1654
- <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>
1655
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
1656
- <span class='kw'>rescue</span> <span class='const'>NoMafftInstallationError</span>
1657
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>ValidationReport</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Mafft error</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:error</span><span class='rparen'>)</span>
1658
- <span class='ivar'>@validation_report</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='const'>NoMafftInstallationError</span>
1659
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
1660
- <span class='kw'>rescue</span> <span class='const'>NoInternetError</span>
1661
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>ValidationReport</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Internet error</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:error</span><span class='rparen'>)</span>
1662
- <span class='ivar'>@validation_report</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='const'>NoInternetError</span>
1663
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
1664
- <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
1665
- <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='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unexpected Error</span><span class='tstring_end'>&quot;</span></span>
1666
- <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>
1667
- <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>
1668
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
1669
- <span class='kw'>end</span>
1670
- <span class='kw'>end</span></pre>
1671
- </td>
1672
- </tr>
1673
- </table>
1674
- </div>
1675
-
1676
- </div>
1677
-
1678
- </div>
1679
-
1680
- <div id="footer">
1681
- Generated on Sat Sep 28 07:01:33 2013 by
1682
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1683
- 0.8.7.2 (ruby-1.9.3).
1684
- </div>
1685
-
1686
- </body>
1687
- </html>