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,370 +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: BlastReadingFrameValidation
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 (B)</a> &raquo;
35
-
36
-
37
- <span class="title">BlastReadingFrameValidation</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: BlastReadingFrameValidation
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">BlastReadingFrameValidation</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_blast_reading_frame.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 reading frame validation
108
- based on BLAST output</p>
109
-
110
-
111
- </div>
112
- </div>
113
- <div class="tags">
114
-
115
-
116
- </div>
117
-
118
-
119
-
120
-
121
-
122
- <h2>Instance Attribute Summary</h2>
123
-
124
- <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="ValidationTest.html" title="ValidationTest (class)">ValidationTest</a></span></h3>
125
- <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>
126
-
127
-
128
-
129
- <h2>
130
- Instance Method Summary
131
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
132
- </h2>
133
-
134
- <ul class="summary">
135
-
136
- <li class="public ">
137
- <span class="summary_signature">
138
-
139
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (BlastReadingFrameValidation) <strong>initialize</strong>(type, prediction, hits = nil) </a>
140
-
141
-
142
-
143
- </span>
144
-
145
-
146
- <span class="note title constructor">constructor</span>
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
- <span class="summary_desc"><div class='inline'>
156
- <p>A new instance of BlastReadingFrameValidation.</p>
157
- </div></span>
158
-
159
- </li>
160
-
161
-
162
- <li class="public ">
163
- <span class="summary_signature">
164
-
165
- <a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong>(lst = @hits) </a>
166
-
167
-
168
-
169
- </span>
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
- <span class="summary_desc"><div class='inline'>
180
- <p>Check reading frame inconsistency Params: <tt>lst</tt>: vector of
181
- <tt>Sequence</tt> objects Output: <tt>BlastRFValidationOutput</tt> object.</p>
182
- </div></span>
183
-
184
- </li>
185
-
186
-
187
- </ul>
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
- <div id="constructor_details" class="method_details_list">
197
- <h2>Constructor Details</h2>
198
-
199
- <div class="method_details first">
200
- <h3 class="signature first" id="initialize-instance_method">
201
-
202
- - (<tt><span class='object_link'><a href="" title="BlastReadingFrameValidation (class)">BlastReadingFrameValidation</a></span></tt>) <strong>initialize</strong>(type, prediction, hits = nil)
203
-
204
-
205
-
206
-
207
-
208
- </h3><div class="docstring">
209
- <div class="discussion">
210
-
211
- <p>Returns a new instance of BlastReadingFrameValidation</p>
212
-
213
-
214
- </div>
215
- </div>
216
- <div class="tags">
217
-
218
-
219
- </div><table class="source_code">
220
- <tr>
221
- <td>
222
- <pre class="lines">
223
-
224
-
225
- 53
226
- 54
227
- 55
228
- 56
229
- 57
230
- 58
231
- 59
232
- 60
233
- 61</pre>
234
- </td>
235
- <td>
236
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_blast_reading_frame.rb', line 53</span>
237
-
238
- <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='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
239
- <span class='kw'>super</span>
240
- <span class='ivar'>@short_header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Frame</span><span class='tstring_end'>&quot;</span></span>
241
- <span class='ivar'>@header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Reading Frame</span><span class='tstring_end'>&quot;</span></span>
242
- <span class='ivar'>@description</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Check whether there is a single reading frame among BLAST</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
243
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> hits. Otherwise there might be a reading frame shift in the query sequence.</span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
244
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> Meaning of the output displayed: (reading frame: no hsps)</span><span class='tstring_end'>&quot;</span></span>
245
- <span class='ivar'>@cli_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>frame</span><span class='tstring_end'>&quot;</span></span>
246
- <span class='kw'>end</span></pre>
247
- </td>
248
- </tr>
249
- </table>
250
- </div>
251
-
252
- </div>
253
-
254
-
255
- <div id="instance_method_details" class="method_details_list">
256
- <h2>Instance Method Details</h2>
257
-
258
-
259
- <div class="method_details first">
260
- <h3 class="signature first" id="run-instance_method">
261
-
262
- - (<tt>Object</tt>) <strong>run</strong>(lst = @hits)
263
-
264
-
265
-
266
-
267
-
268
- </h3><div class="docstring">
269
- <div class="discussion">
270
-
271
- <p>Check reading frame inconsistency Params: <tt>lst</tt>: vector of
272
- <tt>Sequence</tt> objects Output: <tt>BlastRFValidationOutput</tt> object</p>
273
-
274
-
275
- </div>
276
- </div>
277
- <div class="tags">
278
-
279
-
280
- </div><table class="source_code">
281
- <tr>
282
- <td>
283
- <pre class="lines">
284
-
285
-
286
- 69
287
- 70
288
- 71
289
- 72
290
- 73
291
- 74
292
- 75
293
- 76
294
- 77
295
- 78
296
- 79
297
- 80
298
- 81
299
- 82
300
- 83
301
- 84
302
- 85
303
- 86
304
- 87
305
- 88
306
- 89
307
- 90
308
- 91
309
- 92
310
- 93
311
- 94
312
- 95
313
- 96
314
- 97
315
- 98
316
- 99
317
- 100</pre>
318
- </td>
319
- <td>
320
- <pre class="code"><span class="info file"># File 'lib/genevalidator/validation_blast_reading_frame.rb', line 69</span>
321
-
322
- <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_lst'>lst</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='rparen'>)</span>
323
- <span class='kw'>begin</span>
324
- <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'>nucleotide</span><span class='tstring_end'>&quot;</span></span>
325
- <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>
326
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
327
- <span class='kw'>end</span>
328
-
329
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotEnoughHitsError</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&gt;=</span> <span class='int'>5</span>
330
- <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>
331
-
332
- <span class='id identifier rubyid_start'>start</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
333
-
334
- <span class='id identifier rubyid_rfs'>rfs</span> <span class='op'>=</span> <span class='id identifier rubyid_lst'>lst</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_x'>x</span><span class='period'>.</span><span class='id identifier rubyid_hsp_list'>hsp_list</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_y'>y</span><span class='op'>|</span> <span class='id identifier rubyid_y'>y</span><span class='period'>.</span><span class='id identifier rubyid_query_reading_frame'>query_reading_frame</span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
335
- <span class='id identifier rubyid_frames_histo'>frames_histo</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_rfs'>rfs</span><span class='period'>.</span><span class='id identifier rubyid_group_by'>group_by</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_x'>x</span> <span class='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_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_vs'>vs</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_vs'>vs</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='rbracket'>]</span>
336
-
337
- <span class='comment'># get the main reading frame
338
- </span> <span class='id identifier rubyid_main_rf'>main_rf</span> <span class='op'>=</span> <span class='id identifier rubyid_frames_histo'>frames_histo</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_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span>
339
- <span class='ivar'>@prediction</span><span class='period'>.</span><span class='id identifier rubyid_nucleotide_rf'>nucleotide_rf</span> <span class='op'>=</span> <span class='id identifier rubyid_frames_histo'>frames_histo</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_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='op'>==</span><span class='id identifier rubyid_main_rf'>main_rf</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
340
-
341
- <span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>BlastRFValidationOutput</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_frames_histo'>frames_histo</span><span class='rparen'>)</span>
342
- <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>
343
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
344
-
345
- <span class='comment'># Exception is raised when blast founds no hits
346
- </span> <span class='kw'>rescue</span> <span class='const'>NotEnoughHitsError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
347
- <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>
348
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
349
- <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
350
- <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>
351
- <span class='kw'>return</span> <span class='ivar'>@validation_report</span>
352
- <span class='kw'>end</span>
353
- <span class='kw'>end</span></pre>
354
- </td>
355
- </tr>
356
- </table>
357
- </div>
358
-
359
- </div>
360
-
361
- </div>
362
-
363
- <div id="footer">
364
- Generated on Sat Sep 28 07:01:33 2013 by
365
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
366
- 0.8.7.2 (ruby-1.9.3).
367
- </div>
368
-
369
- </body>
370
- </html>
@@ -1,875 +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: BlastUtils
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 (B)</a> &raquo;
35
-
36
-
37
- <span class="title">BlastUtils</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: BlastUtils
67
-
68
-
69
-
70
- </h1>
71
-
72
- <dl class="box">
73
-
74
- <dt class="r1">Inherits:</dt>
75
- <dd class="r1">
76
- <span class="inheritName">Object</span>
77
-
78
- <ul class="fullTree">
79
- <li>Object</li>
80
-
81
- <li class="next">BlastUtils</li>
82
-
83
- </ul>
84
- <a href="#" class="inheritanceTree">show all</a>
85
-
86
- </dd>
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
- <dt class="r2 last">Defined in:</dt>
97
- <dd class="r2 last">lib/genevalidator/blast.rb</dd>
98
-
99
- </dl>
100
- <div class="clear"></div>
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
- <h2>
111
- Class Method Summary
112
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
113
- </h2>
114
-
115
- <ul class="summary">
116
-
117
- <li class="public ">
118
- <span class="summary_signature">
119
-
120
- <a href="#call_blast_from_file-class_method" title="call_blast_from_file (class method)">+ (Object) <strong>call_blast_from_file</strong>(command, filename, gapopen, gapextend, db = &quot;nr -remote&quot;) </a>
121
-
122
-
123
-
124
- </span>
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
- <span class="summary_desc"><div class='inline'>
135
- <p>Calls blast from file with specific parameters Param: <tt>command</tt>:
136
- blast command in String format (e.g 'blastx' or 'blastp')
137
- <tt>filename</tt>: name of the FAST file <tt>query</tt>: <tt>String</tt>
138
- containing the the query in fasta format <tt>gapopen</tt>: gapopen blast
139
- parameter <tt>gapextend</tt>: gapextend blast parameter <tt>db</tt>:
140
- database Output: String with the blast xml output.</p>
141
- </div></span>
142
-
143
- </li>
144
-
145
-
146
- <li class="public ">
147
- <span class="summary_signature">
148
-
149
- <a href="#call_blast_from_stdin-class_method" title="call_blast_from_stdin (class method)">+ (Object) <strong>call_blast_from_stdin</strong>(command, query, gapopen, gapextend, db = &quot;nr -remote&quot;) </a>
150
-
151
-
152
-
153
- </span>
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
- <span class="summary_desc"><div class='inline'>
164
- <p>Calls blast from standard input with specific parameters Params:
165
- <tt>command</tt>: blast command in String format (e.g 'blastx' or 'blastp')
166
- <tt>query</tt>: String containing the the query in fasta format
167
- <tt>gapopen</tt>: gapopen blast parameter <tt>gapextend</tt>: gapextend
168
- blast parameter <tt>db</tt>: database Output: String with the blast xml
169
- output.</p>
170
- </div></span>
171
-
172
- </li>
173
-
174
-
175
- <li class="public ">
176
- <span class="summary_signature">
177
-
178
- <a href="#composition-class_method" title="composition (class method)">+ (Object) <strong>composition</strong>(sequence_string) </a>
179
-
180
-
181
-
182
- </span>
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
- <span class="summary_desc"><div class='inline'>
193
- <p>Method copied from sequenceserver/sequencehelpers.rb Params:
194
- sequence_string: String of which we mfind the composition Output: a Hash.</p>
195
- </div></span>
196
-
197
- </li>
198
-
199
-
200
- <li class="public ">
201
- <span class="summary_signature">
202
-
203
- <a href="#guess_sequence_type-class_method" title="guess_sequence_type (class method)">+ (Object) <strong>guess_sequence_type</strong>(sequence_string) </a>
204
-
205
-
206
-
207
- </span>
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
- <span class="summary_desc"><div class='inline'>
218
- <p>Method copied from sequenceserver/sequencehelpers.rb Strips all non-letter
219
- characters.</p>
220
- </div></span>
221
-
222
- </li>
223
-
224
-
225
- <li class="public ">
226
- <span class="summary_signature">
227
-
228
- <a href="#parse_next_query_xml-class_method" title="parse_next_query_xml (class method)">+ (Object) <strong>parse_next_query_xml</strong>(iterator, type) </a>
229
-
230
-
231
-
232
- </span>
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
- <span class="summary_desc"><div class='inline'>
243
- <p>Parses the next query from the blast xml output query Params:
244
- <tt>iterator</tt>: blast xml iterator for hits <tt>type</tt>: the type of
245
- the sequence: :nucleotide or :protein Outputs: Array of <tt>Sequence</tt>
246
- ojbects for hits.</p>
247
- </div></span>
248
-
249
- </li>
250
-
251
-
252
- <li class="public ">
253
- <span class="summary_signature">
254
-
255
- <a href="#type_of_sequences-class_method" title="type_of_sequences (class method)">+ (Object) <strong>type_of_sequences</strong>(fasta_format_string) </a>
256
-
257
-
258
-
259
- </span>
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
- <span class="summary_desc"><div class='inline'>
270
- <p>Method copied from sequenceserver/sequencehelpers.rb Splits input at
271
- putative fasta definition lines (like "&gt;adsfadsf"), guesses sequence
272
- type for each sequence.</p>
273
- </div></span>
274
-
275
- </li>
276
-
277
-
278
- </ul>
279
-
280
-
281
-
282
-
283
- <div id="class_method_details" class="method_details_list">
284
- <h2>Class Method Details</h2>
285
-
286
-
287
- <div class="method_details first">
288
- <h3 class="signature first" id="call_blast_from_file-class_method">
289
-
290
- + (<tt>Object</tt>) <strong>call_blast_from_file</strong>(command, filename, gapopen, gapextend, db = &quot;nr -remote&quot;)
291
-
292
-
293
-
294
-
295
-
296
- </h3><div class="docstring">
297
- <div class="discussion">
298
-
299
- <p>Calls blast from file with specific parameters Param: <tt>command</tt>:
300
- blast command in String format (e.g 'blastx' or 'blastp')
301
- <tt>filename</tt>: name of the FAST file <tt>query</tt>: <tt>String</tt>
302
- containing the the query in fasta format <tt>gapopen</tt>: gapopen blast
303
- parameter <tt>gapextend</tt>: gapextend blast parameter <tt>db</tt>:
304
- database Output: String with the blast xml output</p>
305
-
306
-
307
- </div>
308
- </div>
309
- <div class="tags">
310
-
311
-
312
- </div><table class="source_code">
313
- <tr>
314
- <td>
315
- <pre class="lines">
316
-
317
-
318
- 66
319
- 67
320
- 68
321
- 69
322
- 70
323
- 71
324
- 72
325
- 73
326
- 74
327
- 75
328
- 76
329
- 77
330
- 78
331
- 79
332
- 80
333
- 81
334
- 82
335
- 83
336
- 84
337
- 85
338
- 86
339
- 87
340
- 88
341
- 89
342
- 90
343
- 91
344
- 92
345
- 93
346
- 94
347
- 95
348
- 96</pre>
349
- </td>
350
- <td>
351
- <pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 66</span>
352
-
353
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_call_blast_from_file'>call_blast_from_file</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_gapopen'>gapopen</span><span class='comma'>,</span> <span class='id identifier rubyid_gapextend'>gapextend</span><span class='comma'>,</span> <span class='id identifier rubyid_db'>db</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>nr -remote</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
354
- <span class='kw'>begin</span>
355
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>TypeError</span> <span class='kw'>unless</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>String</span> <span class='kw'>and</span> <span class='id identifier rubyid_filename'>filename</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>String</span>
356
-
357
- <span class='id identifier rubyid_evalue'>evalue</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>1e-5</span><span class='tstring_end'>&quot;</span></span>
358
-
359
- <span class='comment'>#output = 5 (XML Blast output)
360
- </span> <span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_command'>command</span><span class='rbrace'>}</span><span class='tstring_content'> -query </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_filename'>filename</span><span class='rbrace'>}</span><span class='tstring_content'> -db </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db'>db</span><span class='rbrace'>}</span><span class='tstring_content'> -evalue </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_evalue'>evalue</span><span class='rbrace'>}</span><span class='tstring_content'> -outfmt 5 -gapopen </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_gapopen'>gapopen</span><span class='rbrace'>}</span><span class='tstring_content'> -gapextend </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_gapextend'>gapextend</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='tstring_end'>&quot;</span></span>
361
- <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Executing \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd'>cmd</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot;...</span><span class='tstring_end'>&quot;</span></span>
362
- <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>This may take a while...</span><span class='tstring_end'>&quot;</span></span>
363
- <span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='backtick'>%x[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd'>cmd</span><span class='rbrace'>}</span><span class='tstring_content'> if xml_file == nil
364
- file = File.open(xml_file, &quot;rb&quot;).read
365
- b.parse_xml_output(file)
366
- end 2&gt;/dev/null</span><span class='tstring_end'>]</span></span>
367
-
368
- <span class='kw'>if</span> <span class='id identifier rubyid_output'>output</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
369
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ClasspathError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
370
- <span class='kw'>end</span>
371
-
372
- <span class='kw'>return</span> <span class='id identifier rubyid_output'>output</span>
373
-
374
- <span class='kw'>rescue</span> <span class='const'>TypeError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
375
- <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Type error at </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\/([^\/]+:\d+):.*</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
376
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Possible cause: one of the arguments of 'call_blast_from_file' method has not the proper type\n</span><span class='tstring_end'>&quot;</span></span>
377
- <span class='id identifier rubyid_exit'>exit</span>
378
- <span class='kw'>rescue</span> <span class='const'>ClasspathError</span> <span class='op'>=&gt;</span><span class='id identifier rubyid_error'>error</span>
379
- <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>BLAST error at </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\/([^\/]+:\d+):.*</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
380
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Did you add BLAST path to LOADPATH?\n</span><span class='tstring_end'>&quot;</span></span>
381
- <span class='id identifier rubyid_exit'>exit</span>
382
- <span class='kw'>end</span>
383
- <span class='kw'>end</span></pre>
384
- </td>
385
- </tr>
386
- </table>
387
- </div>
388
-
389
- <div class="method_details ">
390
- <h3 class="signature " id="call_blast_from_stdin-class_method">
391
-
392
- + (<tt>Object</tt>) <strong>call_blast_from_stdin</strong>(command, query, gapopen, gapextend, db = &quot;nr -remote&quot;)
393
-
394
-
395
-
396
-
397
-
398
- </h3><div class="docstring">
399
- <div class="discussion">
400
-
401
- <p>Calls blast from standard input with specific parameters Params:
402
- <tt>command</tt>: blast command in String format (e.g 'blastx' or 'blastp')
403
- <tt>query</tt>: String containing the the query in fasta format
404
- <tt>gapopen</tt>: gapopen blast parameter <tt>gapextend</tt>: gapextend
405
- blast parameter <tt>db</tt>: database Output: String with the blast xml
406
- output</p>
407
-
408
-
409
- </div>
410
- </div>
411
- <div class="tags">
412
-
413
-
414
- </div><table class="source_code">
415
- <tr>
416
- <td>
417
- <pre class="lines">
418
-
419
-
420
- 26
421
- 27
422
- 28
423
- 29
424
- 30
425
- 31
426
- 32
427
- 33
428
- 34
429
- 35
430
- 36
431
- 37
432
- 38
433
- 39
434
- 40
435
- 41
436
- 42
437
- 43
438
- 44
439
- 45
440
- 46
441
- 47
442
- 48
443
- 49
444
- 50
445
- 51
446
- 52
447
- 53</pre>
448
- </td>
449
- <td>
450
- <pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 26</span>
451
-
452
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_call_blast_from_stdin'>call_blast_from_stdin</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid_query'>query</span><span class='comma'>,</span> <span class='id identifier rubyid_gapopen'>gapopen</span><span class='comma'>,</span> <span class='id identifier rubyid_gapextend'>gapextend</span><span class='comma'>,</span> <span class='id identifier rubyid_db'>db</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>nr -remote</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
453
- <span class='kw'>begin</span>
454
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>TypeError</span> <span class='kw'>unless</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>String</span> <span class='kw'>and</span> <span class='id identifier rubyid_query'>query</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>String</span>
455
-
456
- <span class='id identifier rubyid_evalue'>evalue</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>1e-5</span><span class='tstring_end'>&quot;</span></span>
457
-
458
- <span class='comment'>#output format = 5 (XML Blast output)
459
- </span> <span class='id identifier rubyid_blast_cmd'>blast_cmd</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_command'>command</span><span class='rbrace'>}</span><span class='tstring_content'> -db </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db'>db</span><span class='rbrace'>}</span><span class='tstring_content'> -evalue </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_evalue'>evalue</span><span class='rbrace'>}</span><span class='tstring_content'> -outfmt 5 -gapopen </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_gapopen'>gapopen</span><span class='rbrace'>}</span><span class='tstring_content'> -gapextend </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_gapextend'>gapextend</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
460
- <span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>echo \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_query'>query</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot; | </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_blast_cmd'>blast_cmd</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
461
- <span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='backtick'>%x[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd'>cmd</span><span class='rbrace'>}</span><span class='tstring_content'> 2&gt;/dev/null</span><span class='tstring_end'>]</span></span>
462
-
463
- <span class='kw'>if</span> <span class='id identifier rubyid_output'>output</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
464
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ClasspathError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
465
- <span class='kw'>end</span>
466
-
467
- <span class='kw'>return</span> <span class='id identifier rubyid_output'>output</span>
468
-
469
- <span class='kw'>rescue</span> <span class='const'>TypeError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
470
- <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Type error at </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\/([^\/]+:\d+):.*</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
471
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Possible cause: one of the arguments of 'call_blast_from_file' method has not the proper type\n</span><span class='tstring_end'>&quot;</span></span>
472
- <span class='id identifier rubyid_exit'>exit</span>
473
- <span class='kw'>rescue</span> <span class='const'>ClasspathError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
474
- <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>BLAST error at </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\/([^\/]+:\d+):.*</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
475
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Possible cause: BLAST installation path is not in the LOAD PATH.\n</span><span class='tstring_end'>&quot;</span></span>
476
-
477
- <span class='id identifier rubyid_exit'>exit</span>
478
- <span class='kw'>end</span>
479
- <span class='kw'>end</span></pre>
480
- </td>
481
- </tr>
482
- </table>
483
- </div>
484
-
485
- <div class="method_details ">
486
- <h3 class="signature " id="composition-class_method">
487
-
488
- + (<tt>Object</tt>) <strong>composition</strong>(sequence_string)
489
-
490
-
491
-
492
-
493
-
494
- </h3><div class="docstring">
495
- <div class="discussion">
496
-
497
- <p>Method copied from sequenceserver/sequencehelpers.rb Params:
498
- sequence_string: String of which we mfind the composition Output: a Hash</p>
499
-
500
-
501
- </div>
502
- </div>
503
- <div class="tags">
504
-
505
-
506
- </div><table class="source_code">
507
- <tr>
508
- <td>
509
- <pre class="lines">
510
-
511
-
512
- 185
513
- 186
514
- 187
515
- 188
516
- 189
517
- 190
518
- 191</pre>
519
- </td>
520
- <td>
521
- <pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 185</span>
522
-
523
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_composition'>composition</span><span class='lparen'>(</span><span class='id identifier rubyid_sequence_string'>sequence_string</span><span class='rparen'>)</span>
524
- <span class='id identifier rubyid_count'>count</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>
525
- <span class='id identifier rubyid_sequence_string'>sequence_string</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='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span>
526
- <span class='id identifier rubyid_count'>count</span><span class='lbracket'>[</span><span class='id identifier rubyid_x'>x</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='int'>1</span>
527
- <span class='kw'>end</span>
528
- <span class='id identifier rubyid_count'>count</span>
529
- <span class='kw'>end</span></pre>
530
- </td>
531
- </tr>
532
- </table>
533
- </div>
534
-
535
- <div class="method_details ">
536
- <h3 class="signature " id="guess_sequence_type-class_method">
537
-
538
- + (<tt>Object</tt>) <strong>guess_sequence_type</strong>(sequence_string)
539
-
540
-
541
-
542
-
543
-
544
- </h3><div class="docstring">
545
- <div class="discussion">
546
-
547
- <p>Method copied from sequenceserver/sequencehelpers.rb Strips all non-letter
548
- characters. guestimates sequence based on that. If less than 10 useable
549
- characters... returns nil If more than 90% ACGTU returns :nucleotide. else
550
- returns :protein Params: <tt>sequence_string</tt>: String to validate
551
- Output: nil, :nucleotide or :protein</p>
552
-
553
-
554
- </div>
555
- </div>
556
- <div class="tags">
557
-
558
-
559
- </div><table class="source_code">
560
- <tr>
561
- <td>
562
- <pre class="lines">
563
-
564
-
565
- 202
566
- 203
567
- 204
568
- 205
569
- 206
570
- 207
571
- 208
572
- 209
573
- 210
574
- 211
575
- 212
576
- 213
577
- 214
578
- 215
579
- 216
580
- 217
581
- 218
582
- 219</pre>
583
- </td>
584
- <td>
585
- <pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 202</span>
586
-
587
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_guess_sequence_type'>guess_sequence_type</span><span class='lparen'>(</span><span class='id identifier rubyid_sequence_string'>sequence_string</span><span class='rparen'>)</span>
588
- <span class='id identifier rubyid_cleaned_sequence'>cleaned_sequence</span> <span class='op'>=</span> <span class='id identifier rubyid_sequence_string'>sequence_string</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[^A-Z]</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='comment'># removing non-letter characters
589
- </span> <span class='id identifier rubyid_cleaned_sequence'>cleaned_sequence</span><span class='period'>.</span><span class='id identifier rubyid_gsub!'>gsub!</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[NX]</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='comment'># removing ambiguous characters
590
- </span>
591
- <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_cleaned_sequence'>cleaned_sequence</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&lt;</span> <span class='int'>10</span> <span class='comment'># conservative
592
- </span>
593
- <span class='id identifier rubyid_composition'>composition</span> <span class='op'>=</span> <span class='const'>BlastUtils</span><span class='period'>.</span><span class='id identifier rubyid_composition'>composition</span><span class='lparen'>(</span><span class='id identifier rubyid_cleaned_sequence'>cleaned_sequence</span><span class='rparen'>)</span>
594
- <span class='id identifier rubyid_composition_NAs'>composition_NAs</span> <span class='op'>=</span> <span class='id identifier rubyid_composition'>composition</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_character'>character</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span><span class='op'>|</span><span class='id identifier rubyid_character'>character</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'>[ACGTU]</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='comment'># only putative NAs
595
- </span> <span class='id identifier rubyid_putative_NA_counts'>putative_NA_counts</span> <span class='op'>=</span> <span class='id identifier rubyid_composition_NAs'>composition_NAs</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key_value_array'>key_value_array</span><span class='op'>|</span> <span class='id identifier rubyid_key_value_array'>key_value_array</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='rbrace'>}</span> <span class='comment'># only count, not char
596
- </span> <span class='id identifier rubyid_putative_NA_sum'>putative_NA_sum</span> <span class='op'>=</span> <span class='id identifier rubyid_putative_NA_counts'>putative_NA_counts</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_sum'>sum</span><span class='comma'>,</span> <span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='id identifier rubyid_sum'>sum</span> <span class='op'>+</span> <span class='id identifier rubyid_n'>n</span> <span class='rbrace'>}</span> <span class='comment'># count of all putative NA
597
- </span> <span class='id identifier rubyid_putative_NA_sum'>putative_NA_sum</span> <span class='op'>=</span> <span class='int'>0</span> <span class='kw'>if</span> <span class='id identifier rubyid_putative_NA_sum'>putative_NA_sum</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
598
-
599
- <span class='kw'>if</span> <span class='id identifier rubyid_putative_NA_sum'>putative_NA_sum</span> <span class='op'>&gt;</span> <span class='lparen'>(</span><span class='float'>0.9</span> <span class='op'>*</span> <span class='id identifier rubyid_cleaned_sequence'>cleaned_sequence</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span>
600
- <span class='kw'>return</span> <span class='symbol'>:nucleotide</span>
601
- <span class='kw'>else</span>
602
- <span class='kw'>return</span> <span class='symbol'>:protein</span>
603
- <span class='kw'>end</span>
604
- <span class='kw'>end</span></pre>
605
- </td>
606
- </tr>
607
- </table>
608
- </div>
609
-
610
- <div class="method_details ">
611
- <h3 class="signature " id="parse_next_query_xml-class_method">
612
-
613
- + (<tt>Object</tt>) <strong>parse_next_query_xml</strong>(iterator, type)
614
-
615
-
616
-
617
-
618
-
619
- </h3><div class="docstring">
620
- <div class="discussion">
621
-
622
- <p>Parses the next query from the blast xml output query Params:
623
- <tt>iterator</tt>: blast xml iterator for hits <tt>type</tt>: the type of
624
- the sequence: :nucleotide or :protein Outputs: Array of <tt>Sequence</tt>
625
- ojbects for hits</p>
626
-
627
-
628
- </div>
629
- </div>
630
- <div class="tags">
631
-
632
-
633
- </div><table class="source_code">
634
- <tr>
635
- <td>
636
- <pre class="lines">
637
-
638
-
639
- 105
640
- 106
641
- 107
642
- 108
643
- 109
644
- 110
645
- 111
646
- 112
647
- 113
648
- 114
649
- 115
650
- 116
651
- 117
652
- 118
653
- 119
654
- 120
655
- 121
656
- 122
657
- 123
658
- 124
659
- 125
660
- 126
661
- 127
662
- 128
663
- 129
664
- 130
665
- 131
666
- 132
667
- 133
668
- 134
669
- 135
670
- 136
671
- 137
672
- 138
673
- 139
674
- 140
675
- 141
676
- 142
677
- 143
678
- 144
679
- 145
680
- 146
681
- 147
682
- 148
683
- 149
684
- 150
685
- 151
686
- 152
687
- 153
688
- 154
689
- 155
690
- 156
691
- 157
692
- 158
693
- 159
694
- 160
695
- 161
696
- 162
697
- 163
698
- 164
699
- 165
700
- 166
701
- 167
702
- 168
703
- 169
704
- 170
705
- 171
706
- 172
707
- 173
708
- 174
709
- 175
710
- 176
711
- 177</pre>
712
- </td>
713
- <td>
714
- <pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 105</span>
715
-
716
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_parse_next_query_xml'>parse_next_query_xml</span><span class='lparen'>(</span><span class='id identifier rubyid_iterator'>iterator</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
717
- <span class='kw'>begin</span>
718
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>TypeError</span> <span class='kw'>unless</span> <span class='id identifier rubyid_iterator'>iterator</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Enumerator</span>
719
-
720
- <span class='id identifier rubyid_hits'>hits</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
721
- <span class='id identifier rubyid_predicted_seq'>predicted_seq</span> <span class='op'>=</span> <span class='const'>Sequence</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
722
- <span class='id identifier rubyid_iter'>iter</span> <span class='op'>=</span> <span class='id identifier rubyid_iterator'>iterator</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span>
723
-
724
- <span class='comment'># parse blast the xml output and get the hits
725
- </span> <span class='comment'># hits obtained are proteins! (we use only blastp and blastx)
726
- </span> <span class='id identifier rubyid_iter'>iter</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span> <span class='id identifier rubyid_hit'>hit</span> <span class='op'>|</span>
727
-
728
- <span class='id identifier rubyid_seq'>seq</span> <span class='op'>=</span> <span class='const'>Sequence</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
729
-
730
- <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_length_protein'>length_protein</span> <span class='op'>=</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_len'>len</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
731
- <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='symbol'>:protein</span>
732
- <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_identifier'>identifier</span> <span class='op'>=</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_hit_id'>hit_id</span>
733
- <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_definition'>definition</span> <span class='op'>=</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_hit_def'>hit_def</span>
734
- <span class='comment'>#puts seq.identifier
735
- </span> <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_accession_no'>accession_no</span> <span class='op'>=</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_accession'>accession</span>
736
-
737
- <span class='comment'># get all high-scoring segment pairs (hsp)
738
- </span> <span class='id identifier rubyid_hsps'>hsps</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
739
- <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_hsps'>hsps</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hsp'>hsp</span><span class='op'>|</span>
740
- <span class='id identifier rubyid_current_hsp'>current_hsp</span> <span class='op'>=</span> <span class='const'>Hsp</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
741
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_hsp_evalue'>hsp_evalue</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_evalue'>evalue</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
742
-
743
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_from'>hit_from</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_from'>hit_from</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
744
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_to'>hit_to</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_to'>hit_to</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
745
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_from'>match_query_from</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_query_from'>query_from</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
746
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_to'>match_query_to</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_query_to'>query_to</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
747
-
748
- <span class='kw'>if</span> <span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='symbol'>:nucleotide</span>
749
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_from'>match_query_from</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_from'>match_query_from</span> <span class='op'>/</span> <span class='int'>3</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='int'>1</span>
750
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_to'>match_query_to</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_to'>match_query_to</span> <span class='op'>/</span> <span class='int'>3</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='int'>1</span>
751
- <span class='kw'>end</span>
752
-
753
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_query_reading_frame'>query_reading_frame</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_query_frame'>query_frame</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
754
-
755
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_alignment'>hit_alignment</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_hseq'>hseq</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
756
- <span class='kw'>if</span> <span class='const'>BlastUtils</span><span class='period'>.</span><span class='id identifier rubyid_guess_sequence_type'>guess_sequence_type</span><span class='lparen'>(</span><span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_hit_alignment'>hit_alignment</span><span class='rparen'>)</span> <span class='op'>!=</span> <span class='symbol'>:protein</span>
757
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>SequenceTypeError</span>
758
- <span class='kw'>end</span>
759
-
760
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_query_alignment'>query_alignment</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_qseq'>qseq</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
761
- <span class='kw'>if</span> <span class='const'>BlastUtils</span><span class='period'>.</span><span class='id identifier rubyid_guess_sequence_type'>guess_sequence_type</span><span class='lparen'>(</span><span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_query_alignment'>query_alignment</span><span class='rparen'>)</span> <span class='op'>!=</span> <span class='symbol'>:protein</span>
762
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>SequenceTypeError</span>
763
- <span class='kw'>end</span>
764
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_align_len'>align_len</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_align_len'>align_len</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
765
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_identity'>identity</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_identity'>identity</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
766
- <span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_pidentity'>pidentity</span> <span class='op'>=</span> <span class='int'>100</span> <span class='op'>*</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_identity'>identity</span> <span class='op'>/</span> <span class='lparen'>(</span><span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_align_len'>align_len</span> <span class='op'>+</span> <span class='float'>0.0</span><span class='rparen'>)</span>
767
-
768
- <span class='id identifier rubyid_hsps'>hsps</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='rparen'>)</span>
769
- <span class='kw'>end</span>
770
-
771
- <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_hsp_list'>hsp_list</span> <span class='op'>=</span> <span class='id identifier rubyid_hsps'>hsps</span>
772
- <span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_seq'>seq</span><span class='rparen'>)</span>
773
- <span class='kw'>end</span>
774
-
775
- <span class='kw'>return</span> <span class='id identifier rubyid_hits'>hits</span>
776
-
777
- <span class='kw'>rescue</span> <span class='const'>TypeError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
778
- <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Type error at </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\/([^\/]+:\d+):.*</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
779
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Possible cause: you didn't call parse method first!\n</span><span class='tstring_end'>&quot;</span></span>
780
- <span class='id identifier rubyid_exit!'>exit!</span>
781
- <span class='kw'>rescue</span> <span class='const'>SequenceTypeError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
782
- <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Sequence Type error at </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\/([^\/]+:\d+):.*</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>&quot;</span></span><span class='op'>&lt;&lt;</span>
783
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Possible cause: the blast output was not obtained against a protein database.\n</span><span class='tstring_end'>&quot;</span></span>
784
- <span class='id identifier rubyid_exit!'>exit!</span>
785
- <span class='kw'>rescue</span> <span class='const'>StopIteration</span>
786
- <span class='kw'>nil</span>
787
- <span class='kw'>end</span>
788
- <span class='kw'>end</span></pre>
789
- </td>
790
- </tr>
791
- </table>
792
- </div>
793
-
794
- <div class="method_details ">
795
- <h3 class="signature " id="type_of_sequences-class_method">
796
-
797
- + (<tt>Object</tt>) <strong>type_of_sequences</strong>(fasta_format_string)
798
-
799
-
800
-
801
-
802
-
803
- </h3><div class="docstring">
804
- <div class="discussion">
805
-
806
- <p>Method copied from sequenceserver/sequencehelpers.rb Splits input at
807
- putative fasta definition lines (like "&gt;adsfadsf"), guesses sequence
808
- type for each sequence. If not enough sequence to determine, returns nil.
809
- If 2 kinds of sequence mixed together, raises ArgumentError Otherwise,
810
- returns :nucleotide or :protein Params: <tt>sequence_string</tt>: String to
811
- validate Output: nil, :nucleotide or :protein</p>
812
-
813
-
814
- </div>
815
- </div>
816
- <div class="tags">
817
-
818
-
819
- </div><table class="source_code">
820
- <tr>
821
- <td>
822
- <pre class="lines">
823
-
824
-
825
- 231
826
- 232
827
- 233
828
- 234
829
- 235
830
- 236
831
- 237
832
- 238
833
- 239
834
- 240
835
- 241
836
- 242
837
- 243
838
- 244
839
- 245</pre>
840
- </td>
841
- <td>
842
- <pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 231</span>
843
-
844
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_type_of_sequences'>type_of_sequences</span><span class='lparen'>(</span><span class='id identifier rubyid_fasta_format_string'>fasta_format_string</span><span class='rparen'>)</span>
845
- <span class='comment'># the first sequence does not need to have a fasta definition line
846
- </span> <span class='id identifier rubyid_sequences'>sequences</span> <span class='op'>=</span> <span class='id identifier rubyid_fasta_format_string'>fasta_format_string</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='tstring_content'>^&gt;.*$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete_if'>delete_if</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='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='rbrace'>}</span>
847
-
848
- <span class='comment'># get all sequence types
849
- </span> <span class='id identifier rubyid_sequence_types'>sequence_types</span> <span class='op'>=</span> <span class='id identifier rubyid_sequences'>sequences</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_seq'>seq</span><span class='op'>|</span> <span class='const'>BlastUtils</span><span class='period'>.</span><span class='id identifier rubyid_guess_sequence_type'>guess_sequence_type</span><span class='lparen'>(</span><span class='id identifier rubyid_seq'>seq</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
850
-
851
- <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_sequence_types'>sequence_types</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
852
-
853
- <span class='kw'>if</span> <span class='id identifier rubyid_sequence_types'>sequence_types</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span>
854
- <span class='kw'>return</span> <span class='id identifier rubyid_sequence_types'>sequence_types</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='comment'># there is only one (but yes its an array)
855
- </span> <span class='kw'>else</span>
856
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>SequenceTypeError</span>
857
- <span class='kw'>end</span>
858
- <span class='kw'>end</span></pre>
859
- </td>
860
- </tr>
861
- </table>
862
- </div>
863
-
864
- </div>
865
-
866
- </div>
867
-
868
- <div id="footer">
869
- Generated on Sat Sep 28 07:01:32 2013 by
870
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
871
- 0.8.7.2 (ruby-1.9.3).
872
- </div>
873
-
874
- </body>
875
- </html>