genevalidator 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.travis.yml +2 -0
- data/README.md +78 -30
- data/Rakefile +11 -8
- data/aux/app_template_footer.erb +1 -6
- data/aux/app_template_header.erb +12 -32
- data/aux/files/css/style.css +2 -8
- data/aux/files/js/plots.js +564 -576
- data/aux/files/js/script.js +10 -0
- data/aux/json_footer.erb +8 -0
- data/aux/json_header.erb +19 -0
- data/aux/json_query.erb +14 -0
- data/aux/template_footer.erb +9 -58
- data/aux/template_header.erb +18 -58
- data/aux/template_query.erb +8 -36
- data/bin/genevalidator +45 -32
- data/genevalidator.gemspec +11 -7
- data/lib/genevalidator.rb +75 -455
- data/lib/genevalidator/arg_validation.rb +78 -107
- data/lib/genevalidator/blast.rb +57 -60
- data/lib/genevalidator/clusterization.rb +15 -15
- data/lib/genevalidator/exceptions.rb +32 -5
- data/lib/genevalidator/get_raw_sequences.rb +70 -33
- data/lib/genevalidator/hsp.rb +1 -4
- data/lib/genevalidator/json_to_gv_results.rb +109 -0
- data/lib/genevalidator/output.rb +177 -185
- data/lib/genevalidator/pool.rb +2 -1
- data/lib/genevalidator/sequences.rb +3 -3
- data/lib/genevalidator/tabular_parser.rb +24 -18
- data/lib/genevalidator/validation.rb +279 -0
- data/lib/genevalidator/validation_alignment.rb +31 -47
- data/lib/genevalidator/validation_blast_reading_frame.rb +19 -18
- data/lib/genevalidator/validation_duplication.rb +23 -19
- data/lib/genevalidator/validation_gene_merge.rb +30 -65
- data/lib/genevalidator/validation_length_cluster.rb +14 -53
- data/lib/genevalidator/validation_length_rank.rb +10 -11
- data/lib/genevalidator/validation_open_reading_frame.rb +18 -19
- data/lib/genevalidator/validation_report.rb +2 -5
- data/lib/genevalidator/validation_test.rb +8 -4
- data/lib/genevalidator/version.rb +1 -1
- data/test/test_all_validations.rb +51 -66
- data/test/test_blast.rb +68 -51
- data/test/test_clusterization.rb +1 -1
- data/test/test_clusterization_2d.rb +19 -13
- data/test/test_extended_array_methods.rb +1 -1
- data/test/test_files/all_validations_mrna/mrna.blast_tab6 +1806 -0
- data/test/test_files/all_validations_mrna/mrna.blast_tab7 +1865 -0
- data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta.blast_xml → mrna.blast_xml} +18642 -1
- data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta.blast_xml.index → mrna.blast_xml.index} +300 -0
- data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta → mrna.fa} +0 -0
- data/test/test_files/all_validations_mrna/mrna.raw_seq +3970 -0
- data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta.blast_xml.raw_seq.idx → mrna.raw_seq.idx} +901 -1
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_tab → prot.blast_tab6} +416 -0
- data/test/test_files/all_validations_prot/prot.blast_tab7 +2400 -0
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml → prot.blast_xml} +18299 -6723
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml.index → prot.blast_xml.index} +408 -0
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta → prot.fa} +0 -0
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml.raw_seq → prot.raw_seq} +2735 -0
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml.raw_seq.idx → prot.raw_seq.idx} +3032 -1808
- data/test/test_sequences.rb +46 -41
- data/test/test_validation_open_reading_frame.rb +318 -202
- data/test/test_validations.rb +48 -32
- metadata +76 -102
- data/doc/AliasDuplicationError.html +0 -134
- data/doc/AlignmentValidation.html +0 -1687
- data/doc/AlignmentValidationOutput.html +0 -659
- data/doc/Blast.html +0 -1905
- data/doc/BlastRFValidationOutput.html +0 -545
- data/doc/BlastReadingFrameValidation.html +0 -370
- data/doc/BlastUtils.html +0 -875
- data/doc/ClasspathError.html +0 -134
- data/doc/Cluster.html +0 -1316
- data/doc/DuplciationValidationOutput.html +0 -564
- data/doc/DuplicationValidation.html +0 -920
- data/doc/DuplicationValidationOutput.html +0 -564
- data/doc/FileNotFoundException.html +0 -134
- data/doc/GeneMergeValidation.html +0 -935
- data/doc/GeneMergeValidationOutput.html +0 -652
- data/doc/HierarchicalClusterization.html +0 -994
- data/doc/Hsp.html +0 -1485
- data/doc/InconsistentTabularFormat.html +0 -135
- data/doc/LengthClusterValidation.html +0 -982
- data/doc/LengthClusterValidationOutput.html +0 -515
- data/doc/LengthRankValidation.html +0 -496
- data/doc/LengthRankValidationOutput.html +0 -517
- data/doc/NoInternetError.html +0 -135
- data/doc/NoMafftInstallationError.html +0 -134
- data/doc/NoPIdentError.html +0 -134
- data/doc/NoValidationError.html +0 -134
- data/doc/NotEnoughHitsError.html +0 -135
- data/doc/ORFValidationOutput.html +0 -593
- data/doc/OpenReadingFrameValidation.html +0 -1107
- data/doc/OtherError.html +0 -123
- data/doc/Output.html +0 -1540
- data/doc/Pair.html +0 -309
- data/doc/PairCluster.html +0 -767
- data/doc/Plot.html +0 -837
- data/doc/QueryError.html +0 -134
- data/doc/ReportClassError.html +0 -135
- data/doc/Sequence.html +0 -1299
- data/doc/SequenceTypeError.html +0 -135
- data/doc/TabularEntry.html +0 -837
- data/doc/TabularParser.html +0 -1104
- data/doc/Validation.html +0 -2147
- data/doc/ValidationClassError.html +0 -134
- data/doc/ValidationOutput.html +0 -460
- data/doc/ValidationReport.html +0 -940
- data/doc/ValidationTest.html +0 -939
- data/doc/_index.html +0 -449
- data/doc/class_list.html +0 -54
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -338
- data/doc/file.README.html +0 -151
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -26
- data/doc/index.html +0 -151
- data/doc/js/app.js +0 -214
- data/doc/js/full_list.js +0 -178
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1505
- data/doc/top-level-namespace.html +0 -112
- data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab +0 -967
- data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab.index +0 -967
- data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab.raw_seq +0 -4929
- data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab.raw_seq.idx +0 -1006
- data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_xml.raw_seq +0 -2075
- data/test/test_files/all_validations_prot/all_validations_prot.fasta.blast_tab.index +0 -1864
- data/test/test_files/all_validations_prot/all_validations_prot.fasta.blast_tab.raw_seq +0 -42411
- data/test/test_files/all_validations_prot/all_validations_prot.fasta.blast_tab.raw_seq.idx +0 -3751
data/doc/Blast.html
DELETED
@@ -1,1905 +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: Blast
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.7
|
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> »
|
35
|
-
|
36
|
-
|
37
|
-
<span class="title">Blast</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: Blast
|
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">Blast</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
|
-
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
107
|
-
<ul class="summary">
|
108
|
-
|
109
|
-
<li class="public ">
|
110
|
-
<span class="summary_signature">
|
111
|
-
|
112
|
-
<a href="#fasta_file-instance_method" title="#fasta_file (instance method)">- (Object) <strong>fasta_file</strong> </a>
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
</span>
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
<span class="note title readonly">readonly</span>
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
<span class="summary_desc"><div class='inline'>
|
132
|
-
<p>Returns the value of attribute fasta_file.</p>
|
133
|
-
</div></span>
|
134
|
-
|
135
|
-
</li>
|
136
|
-
|
137
|
-
|
138
|
-
<li class="public ">
|
139
|
-
<span class="summary_signature">
|
140
|
-
|
141
|
-
<a href="#idx-instance_method" title="#idx (instance method)">- (Object) <strong>idx</strong> </a>
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
</span>
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
<span class="note title readonly">readonly</span>
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
<span class="summary_desc"><div class='inline'>
|
161
|
-
<p>current number of the querry processed.</p>
|
162
|
-
</div></span>
|
163
|
-
|
164
|
-
</li>
|
165
|
-
|
166
|
-
|
167
|
-
<li class="public ">
|
168
|
-
<span class="summary_signature">
|
169
|
-
|
170
|
-
<a href="#outfmt-instance_method" title="#outfmt (instance method)">- (Object) <strong>outfmt</strong> </a>
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
</span>
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
<span class="note title readonly">readonly</span>
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
<span class="summary_desc"><div class='inline'>
|
190
|
-
<p>Returns the value of attribute outfmt.</p>
|
191
|
-
</div></span>
|
192
|
-
|
193
|
-
</li>
|
194
|
-
|
195
|
-
|
196
|
-
<li class="public ">
|
197
|
-
<span class="summary_signature">
|
198
|
-
|
199
|
-
<a href="#query_offset_lst-instance_method" title="#query_offset_lst (instance method)">- (Object) <strong>query_offset_lst</strong> </a>
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
</span>
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
<span class="note title readonly">readonly</span>
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
<span class="summary_desc"><div class='inline'>
|
219
|
-
<p>array of indexes for the start offsets of each query in the fasta file.</p>
|
220
|
-
</div></span>
|
221
|
-
|
222
|
-
</li>
|
223
|
-
|
224
|
-
|
225
|
-
<li class="public ">
|
226
|
-
<span class="summary_signature">
|
227
|
-
|
228
|
-
<a href="#start_idx-instance_method" title="#start_idx (instance method)">- (Object) <strong>start_idx</strong> </a>
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
</span>
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
<span class="note title readonly">readonly</span>
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
<span class="summary_desc"><div class='inline'>
|
248
|
-
<p>Returns the value of attribute start_idx.</p>
|
249
|
-
</div></span>
|
250
|
-
|
251
|
-
</li>
|
252
|
-
|
253
|
-
|
254
|
-
<li class="public ">
|
255
|
-
<span class="summary_signature">
|
256
|
-
|
257
|
-
<a href="#type-instance_method" title="#type (instance method)">- (Object) <strong>type</strong> </a>
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
</span>
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
<span class="note title readonly">readonly</span>
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
<span class="summary_desc"><div class='inline'>
|
277
|
-
<p>Returns the value of attribute type.</p>
|
278
|
-
</div></span>
|
279
|
-
|
280
|
-
</li>
|
281
|
-
|
282
|
-
|
283
|
-
</ul>
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
<h2>
|
290
|
-
Instance Method Summary
|
291
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
292
|
-
</h2>
|
293
|
-
|
294
|
-
<ul class="summary">
|
295
|
-
|
296
|
-
<li class="public ">
|
297
|
-
<span class="summary_signature">
|
298
|
-
|
299
|
-
<a href="#blast-instance_method" title="#blast (instance method)">- (Object) <strong>blast</strong> </a>
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
</span>
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
<span class="summary_desc"><div class='inline'>
|
314
|
-
<p>Calls blast according to the type of the sequence.</p>
|
315
|
-
</div></span>
|
316
|
-
|
317
|
-
</li>
|
318
|
-
|
319
|
-
|
320
|
-
<li class="public ">
|
321
|
-
<span class="summary_signature">
|
322
|
-
|
323
|
-
<a href="#call_blast_from_file-instance_method" title="#call_blast_from_file (instance method)">- (Object) <strong>call_blast_from_file</strong>(command, filename, gapopen, gapextend) </a>
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
</span>
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
<span class="summary_desc"><div class='inline'>
|
338
|
-
<p>Calls blast from file with specific parameters Param: <tt>command</tt>:
|
339
|
-
blast command in String format (e.g 'blastx' or 'blastp')
|
340
|
-
<tt>filename</tt>: name of the FAST file <tt>query</tt>: <tt>String</tt>
|
341
|
-
containing the the query in fasta format <tt>gapopen</tt>: gapopen blast
|
342
|
-
parameter <tt>gapextend</tt>: gapextend blast parameter Output: String with
|
343
|
-
the blast xml output.</p>
|
344
|
-
</div></span>
|
345
|
-
|
346
|
-
</li>
|
347
|
-
|
348
|
-
|
349
|
-
<li class="public ">
|
350
|
-
<span class="summary_signature">
|
351
|
-
|
352
|
-
<a href="#call_blast_from_stdin-instance_method" title="#call_blast_from_stdin (instance method)">- (Object) <strong>call_blast_from_stdin</strong>(command, query, gapopen, gapextend) </a>
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
</span>
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
<span class="summary_desc"><div class='inline'>
|
367
|
-
<p>Calls blast from standard input with specific parameters Params:
|
368
|
-
<tt>command</tt>: blast command in String format (e.g 'blastx' or 'blastp')
|
369
|
-
<tt>query</tt>: String containing the the query in fasta format
|
370
|
-
<tt>gapopen</tt>: gapopen blast parameter <tt>gapextend</tt>: gapextend
|
371
|
-
blast parameter Output: String with the blast xml output.</p>
|
372
|
-
</div></span>
|
373
|
-
|
374
|
-
</li>
|
375
|
-
|
376
|
-
|
377
|
-
<li class="public ">
|
378
|
-
<span class="summary_signature">
|
379
|
-
|
380
|
-
<a href="#composition-instance_method" title="#composition (instance method)">- (Object) <strong>composition</strong>(sequence_string) </a>
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
</span>
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
<span class="summary_desc"><div class='inline'>
|
395
|
-
<p>Method copied from sequenceserver/sequencehelpers.rb Params:
|
396
|
-
sequence_string: String of which we mfind the composition Output: a Hash.</p>
|
397
|
-
</div></span>
|
398
|
-
|
399
|
-
</li>
|
400
|
-
|
401
|
-
|
402
|
-
<li class="public ">
|
403
|
-
<span class="summary_signature">
|
404
|
-
|
405
|
-
<a href="#get_sequence_by_accession_no-instance_method" title="#get_sequence_by_accession_no (instance method)">- (Object) <strong>get_sequence_by_accession_no</strong>(accno, db) </a>
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
</span>
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
<span class="summary_desc"><div class='inline'>
|
420
|
-
<p>Gets gene by accession number from a givem database Params: <tt>accno</tt>:
|
421
|
-
accession number as String <tt>db</tt>: database as String Output: String
|
422
|
-
with the nucleotide sequence corresponding to the accno.</p>
|
423
|
-
</div></span>
|
424
|
-
|
425
|
-
</li>
|
426
|
-
|
427
|
-
|
428
|
-
<li class="public ">
|
429
|
-
<span class="summary_signature">
|
430
|
-
|
431
|
-
<a href="#guess_sequence_type-instance_method" title="#guess_sequence_type (instance method)">- (Object) <strong>guess_sequence_type</strong>(sequence_string) </a>
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
</span>
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
<span class="summary_desc"><div class='inline'>
|
446
|
-
<p>Method copied from sequenceserver/sequencehelpers.rb Strips all non-letter
|
447
|
-
characters.</p>
|
448
|
-
</div></span>
|
449
|
-
|
450
|
-
</li>
|
451
|
-
|
452
|
-
|
453
|
-
<li class="public ">
|
454
|
-
<span class="summary_signature">
|
455
|
-
|
456
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Blast) <strong>initialize</strong>(fasta_file, type, xml_file = nil, outfmt = nil, start_idx = 1) </a>
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
</span>
|
461
|
-
|
462
|
-
|
463
|
-
<span class="note title constructor">constructor</span>
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
<span class="summary_desc"><div class='inline'>
|
473
|
-
<p>Initilizes the object Params: <tt>fasta_file</tt>: query sequence fasta
|
474
|
-
file with query sequences <tt>type</tt>: query sequence type; can be
|
475
|
-
:nucleotide or :protein <tt>xml_file</tt>: name of the precalculated blast
|
476
|
-
xml output (used in 'skip blast' case) <tt>outfmt</tt>: output format
|
477
|
-
<tt>start_idx</tt>: number of the sequence from the file to start with.</p>
|
478
|
-
</div></span>
|
479
|
-
|
480
|
-
</li>
|
481
|
-
|
482
|
-
|
483
|
-
<li class="public ">
|
484
|
-
<span class="summary_signature">
|
485
|
-
|
486
|
-
<a href="#parse_next_query-instance_method" title="#parse_next_query (instance method)">- (Object) <strong>parse_next_query</strong>(iterator) </a>
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
</span>
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
<span class="summary_desc"><div class='inline'>
|
501
|
-
<p>Parses the next query from the blast xml output query Params:
|
502
|
-
<tt>iterator</tt>: blast xml iterator for hits Outputs: output1: an array
|
503
|
-
of <tt>Sequence</tt> ojbects for hits output2: <tt>Sequence</tt> object for
|
504
|
-
the predicted sequence.</p>
|
505
|
-
</div></span>
|
506
|
-
|
507
|
-
</li>
|
508
|
-
|
509
|
-
|
510
|
-
<li class="public ">
|
511
|
-
<span class="summary_signature">
|
512
|
-
|
513
|
-
<a href="#parse_xml_output-instance_method" title="#parse_xml_output (instance method)">- (Object) <strong>parse_xml_output</strong>(output) </a>
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
</span>
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
<span class="summary_desc"><div class='inline'>
|
528
|
-
<p>Parses the xml blast output Param: <tt>output</tt>: <tt>String</tt> with
|
529
|
-
the blast output in xml format.</p>
|
530
|
-
</div></span>
|
531
|
-
|
532
|
-
</li>
|
533
|
-
|
534
|
-
|
535
|
-
<li class="public ">
|
536
|
-
<span class="summary_signature">
|
537
|
-
|
538
|
-
<a href="#type_of_sequences-instance_method" title="#type_of_sequences (instance method)">- (Object) <strong>type_of_sequences</strong>(fasta_format_string) </a>
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
</span>
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
<span class="summary_desc"><div class='inline'>
|
553
|
-
<p>Method copied from sequenceserver/sequencehelpers.rb Splits input at
|
554
|
-
putative fasta definition lines (like ">adsfadsf"), guesses sequence
|
555
|
-
type for each sequence.</p>
|
556
|
-
</div></span>
|
557
|
-
|
558
|
-
</li>
|
559
|
-
|
560
|
-
|
561
|
-
</ul>
|
562
|
-
|
563
|
-
|
564
|
-
<div id="constructor_details" class="method_details_list">
|
565
|
-
<h2>Constructor Details</h2>
|
566
|
-
|
567
|
-
<div class="method_details first">
|
568
|
-
<h3 class="signature first" id="initialize-instance_method">
|
569
|
-
|
570
|
-
- (<tt><span class='object_link'><a href="" title="Blast (class)">Blast</a></span></tt>) <strong>initialize</strong>(fasta_file, type, xml_file = nil, outfmt = nil, start_idx = 1)
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
</h3><div class="docstring">
|
577
|
-
<div class="discussion">
|
578
|
-
|
579
|
-
<p>Initilizes the object Params: <tt>fasta_file</tt>: query sequence fasta
|
580
|
-
file with query sequences <tt>type</tt>: query sequence type; can be
|
581
|
-
:nucleotide or :protein <tt>xml_file</tt>: name of the precalculated blast
|
582
|
-
xml output (used in 'skip blast' case) <tt>outfmt</tt>: output format
|
583
|
-
<tt>start_idx</tt>: number of the sequence from the file to start with</p>
|
584
|
-
|
585
|
-
|
586
|
-
</div>
|
587
|
-
</div>
|
588
|
-
<div class="tags">
|
589
|
-
|
590
|
-
|
591
|
-
</div><table class="source_code">
|
592
|
-
<tr>
|
593
|
-
<td>
|
594
|
-
<pre class="lines">
|
595
|
-
|
596
|
-
|
597
|
-
35
|
598
|
-
36
|
599
|
-
37
|
600
|
-
38
|
601
|
-
39
|
602
|
-
40
|
603
|
-
41
|
604
|
-
42
|
605
|
-
43
|
606
|
-
44
|
607
|
-
45
|
608
|
-
46
|
609
|
-
47
|
610
|
-
48
|
611
|
-
49
|
612
|
-
50
|
613
|
-
51
|
614
|
-
52
|
615
|
-
53
|
616
|
-
54
|
617
|
-
55
|
618
|
-
56
|
619
|
-
57
|
620
|
-
58
|
621
|
-
59
|
622
|
-
60
|
623
|
-
61
|
624
|
-
62
|
625
|
-
63
|
626
|
-
64
|
627
|
-
65
|
628
|
-
66
|
629
|
-
67
|
630
|
-
68
|
631
|
-
69
|
632
|
-
70
|
633
|
-
71
|
634
|
-
72
|
635
|
-
73
|
636
|
-
74
|
637
|
-
75</pre>
|
638
|
-
</td>
|
639
|
-
<td>
|
640
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 35</span>
|
641
|
-
|
642
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_fasta_file'>fasta_file</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_xml_file'>xml_file</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_outfmt'>outfmt</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_start_idx'>start_idx</span> <span class='op'>=</span> <span class='int'>1</span><span class='rparen'>)</span>
|
643
|
-
<span class='kw'>begin</span>
|
644
|
-
|
645
|
-
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\nDepending on your input and your computational resources, this may take a while. Please wait...\n\n</span><span class='tstring_end'>"</span></span>
|
646
|
-
|
647
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>protein</span><span class='tstring_end'>"</span></span>
|
648
|
-
<span class='ivar'>@type</span> <span class='op'>=</span> <span class='symbol'>:protein</span>
|
649
|
-
<span class='kw'>else</span>
|
650
|
-
<span class='ivar'>@type</span> <span class='op'>=</span> <span class='symbol'>:nucleotide</span>
|
651
|
-
<span class='kw'>end</span>
|
652
|
-
|
653
|
-
<span class='ivar'>@fasta_file</span> <span class='op'>=</span> <span class='id identifier rubyid_fasta_file'>fasta_file</span>
|
654
|
-
<span class='ivar'>@xml_file</span> <span class='op'>=</span> <span class='id identifier rubyid_xml_file'>xml_file</span>
|
655
|
-
<span class='ivar'>@idx</span> <span class='op'>=</span> <span class='int'>0</span>
|
656
|
-
<span class='ivar'>@start_idx</span> <span class='op'>=</span> <span class='id identifier rubyid_start_idx'>start_idx</span>
|
657
|
-
<span class='ivar'>@outfmt</span> <span class='op'>=</span> <span class='id identifier rubyid_outfmt'>outfmt</span>
|
658
|
-
|
659
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>FileNotFoundException</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='ivar'>@fasta_file</span><span class='rparen'>)</span>
|
660
|
-
<span class='id identifier rubyid_fasta_content'>fasta_content</span> <span class='op'>=</span> <span class='const'>IO</span><span class='period'>.</span><span class='id identifier rubyid_binread'>binread</span><span class='lparen'>(</span><span class='ivar'>@fasta_file</span><span class='rparen'>)</span><span class='semicolon'>;</span>
|
661
|
-
|
662
|
-
<span class='comment'># type validation: the type of the sequence in the FASTA correspond to the one declared by the user
|
663
|
-
</span> <span class='kw'>if</span> <span class='ivar'>@type</span> <span class='op'>!=</span> <span class='id identifier rubyid_type_of_sequences'>type_of_sequences</span><span class='lparen'>(</span><span class='id identifier rubyid_fasta_content'>fasta_content</span><span class='rparen'>)</span>
|
664
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>SequenceTypeError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
665
|
-
<span class='kw'>end</span>
|
666
|
-
|
667
|
-
<span class='comment'># create a list of index of the queries in the FASTA
|
668
|
-
</span> <span class='ivar'>@query_offset_lst</span> <span class='op'>=</span> <span class='id identifier rubyid_fasta_content'>fasta_content</span><span class='period'>.</span><span class='id identifier rubyid_enum_for'>enum_for</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'>(>[^>]+)</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='const'>Regexp</span><span class='period'>.</span><span class='id identifier rubyid_last_match'>last_match</span><span class='period'>.</span><span class='id identifier rubyid_begin'>begin</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
669
|
-
<span class='ivar'>@query_offset_lst</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_fasta_content'>fasta_content</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span>
|
670
|
-
<span class='id identifier rubyid_fasta_content'>fasta_content</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='comment'># free memory for variable fasta_content
|
671
|
-
</span>
|
672
|
-
<span class='comment'># redirect the cosole messages of R
|
673
|
-
</span> <span class='const'>R</span><span class='period'>.</span><span class='id identifier rubyid_echo'>echo</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>enable = nil, stderr = nil, warn = nil</span><span class='tstring_end'>"</span></span>
|
674
|
-
|
675
|
-
<span class='kw'>rescue</span> <span class='const'>SequenceTypeError</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
676
|
-
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</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'>. Possible cause: input file is not FASTA or the --type parameter is incorrect.\n</span><span class='tstring_end'>"</span></span>
|
677
|
-
<span class='id identifier rubyid_exit'>exit</span>
|
678
|
-
<span class='kw'>rescue</span> <span class='const'>FileNotFoundException</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
679
|
-
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>File not found 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'>. Possible cause: input file does not exist.\n</span><span class='tstring_end'>"</span></span>
|
680
|
-
<span class='id identifier rubyid_exit'>exit</span>
|
681
|
-
<span class='kw'>end</span>
|
682
|
-
<span class='kw'>end</span></pre>
|
683
|
-
</td>
|
684
|
-
</tr>
|
685
|
-
</table>
|
686
|
-
</div>
|
687
|
-
|
688
|
-
</div>
|
689
|
-
|
690
|
-
<div id="instance_attr_details" class="attr_details">
|
691
|
-
<h2>Instance Attribute Details</h2>
|
692
|
-
|
693
|
-
|
694
|
-
<span id=""></span>
|
695
|
-
<div class="method_details first">
|
696
|
-
<h3 class="signature first" id="fasta_file-instance_method">
|
697
|
-
|
698
|
-
- (<tt>Object</tt>) <strong>fasta_file</strong> <span class="extras">(readonly)</span>
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
</h3><div class="docstring">
|
705
|
-
<div class="discussion">
|
706
|
-
|
707
|
-
<p>Returns the value of attribute fasta_file</p>
|
708
|
-
|
709
|
-
|
710
|
-
</div>
|
711
|
-
</div>
|
712
|
-
<div class="tags">
|
713
|
-
|
714
|
-
|
715
|
-
</div><table class="source_code">
|
716
|
-
<tr>
|
717
|
-
<td>
|
718
|
-
<pre class="lines">
|
719
|
-
|
720
|
-
|
721
|
-
19
|
722
|
-
20
|
723
|
-
21</pre>
|
724
|
-
</td>
|
725
|
-
<td>
|
726
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 19</span>
|
727
|
-
|
728
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_fasta_file'>fasta_file</span>
|
729
|
-
<span class='ivar'>@fasta_file</span>
|
730
|
-
<span class='kw'>end</span></pre>
|
731
|
-
</td>
|
732
|
-
</tr>
|
733
|
-
</table>
|
734
|
-
</div>
|
735
|
-
|
736
|
-
|
737
|
-
<span id=""></span>
|
738
|
-
<div class="method_details ">
|
739
|
-
<h3 class="signature " id="idx-instance_method">
|
740
|
-
|
741
|
-
- (<tt>Object</tt>) <strong>idx</strong> <span class="extras">(readonly)</span>
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
</h3><div class="docstring">
|
748
|
-
<div class="discussion">
|
749
|
-
|
750
|
-
<p>current number of the querry processed</p>
|
751
|
-
|
752
|
-
|
753
|
-
</div>
|
754
|
-
</div>
|
755
|
-
<div class="tags">
|
756
|
-
|
757
|
-
|
758
|
-
</div><table class="source_code">
|
759
|
-
<tr>
|
760
|
-
<td>
|
761
|
-
<pre class="lines">
|
762
|
-
|
763
|
-
|
764
|
-
21
|
765
|
-
22
|
766
|
-
23</pre>
|
767
|
-
</td>
|
768
|
-
<td>
|
769
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 21</span>
|
770
|
-
|
771
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_idx'>idx</span>
|
772
|
-
<span class='ivar'>@idx</span>
|
773
|
-
<span class='kw'>end</span></pre>
|
774
|
-
</td>
|
775
|
-
</tr>
|
776
|
-
</table>
|
777
|
-
</div>
|
778
|
-
|
779
|
-
|
780
|
-
<span id=""></span>
|
781
|
-
<div class="method_details ">
|
782
|
-
<h3 class="signature " id="outfmt-instance_method">
|
783
|
-
|
784
|
-
- (<tt>Object</tt>) <strong>outfmt</strong> <span class="extras">(readonly)</span>
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
</h3><div class="docstring">
|
791
|
-
<div class="discussion">
|
792
|
-
|
793
|
-
<p>Returns the value of attribute outfmt</p>
|
794
|
-
|
795
|
-
|
796
|
-
</div>
|
797
|
-
</div>
|
798
|
-
<div class="tags">
|
799
|
-
|
800
|
-
|
801
|
-
</div><table class="source_code">
|
802
|
-
<tr>
|
803
|
-
<td>
|
804
|
-
<pre class="lines">
|
805
|
-
|
806
|
-
|
807
|
-
23
|
808
|
-
24
|
809
|
-
25</pre>
|
810
|
-
</td>
|
811
|
-
<td>
|
812
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 23</span>
|
813
|
-
|
814
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_outfmt'>outfmt</span>
|
815
|
-
<span class='ivar'>@outfmt</span>
|
816
|
-
<span class='kw'>end</span></pre>
|
817
|
-
</td>
|
818
|
-
</tr>
|
819
|
-
</table>
|
820
|
-
</div>
|
821
|
-
|
822
|
-
|
823
|
-
<span id=""></span>
|
824
|
-
<div class="method_details ">
|
825
|
-
<h3 class="signature " id="query_offset_lst-instance_method">
|
826
|
-
|
827
|
-
- (<tt>Object</tt>) <strong>query_offset_lst</strong> <span class="extras">(readonly)</span>
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
</h3><div class="docstring">
|
834
|
-
<div class="discussion">
|
835
|
-
|
836
|
-
<p>array of indexes for the start offsets of each query in the fasta file</p>
|
837
|
-
|
838
|
-
|
839
|
-
</div>
|
840
|
-
</div>
|
841
|
-
<div class="tags">
|
842
|
-
|
843
|
-
|
844
|
-
</div><table class="source_code">
|
845
|
-
<tr>
|
846
|
-
<td>
|
847
|
-
<pre class="lines">
|
848
|
-
|
849
|
-
|
850
|
-
25
|
851
|
-
26
|
852
|
-
27</pre>
|
853
|
-
</td>
|
854
|
-
<td>
|
855
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 25</span>
|
856
|
-
|
857
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_query_offset_lst'>query_offset_lst</span>
|
858
|
-
<span class='ivar'>@query_offset_lst</span>
|
859
|
-
<span class='kw'>end</span></pre>
|
860
|
-
</td>
|
861
|
-
</tr>
|
862
|
-
</table>
|
863
|
-
</div>
|
864
|
-
|
865
|
-
|
866
|
-
<span id=""></span>
|
867
|
-
<div class="method_details ">
|
868
|
-
<h3 class="signature " id="start_idx-instance_method">
|
869
|
-
|
870
|
-
- (<tt>Object</tt>) <strong>start_idx</strong> <span class="extras">(readonly)</span>
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
</h3><div class="docstring">
|
877
|
-
<div class="discussion">
|
878
|
-
|
879
|
-
<p>Returns the value of attribute start_idx</p>
|
880
|
-
|
881
|
-
|
882
|
-
</div>
|
883
|
-
</div>
|
884
|
-
<div class="tags">
|
885
|
-
|
886
|
-
|
887
|
-
</div><table class="source_code">
|
888
|
-
<tr>
|
889
|
-
<td>
|
890
|
-
<pre class="lines">
|
891
|
-
|
892
|
-
|
893
|
-
22
|
894
|
-
23
|
895
|
-
24</pre>
|
896
|
-
</td>
|
897
|
-
<td>
|
898
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 22</span>
|
899
|
-
|
900
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_start_idx'>start_idx</span>
|
901
|
-
<span class='ivar'>@start_idx</span>
|
902
|
-
<span class='kw'>end</span></pre>
|
903
|
-
</td>
|
904
|
-
</tr>
|
905
|
-
</table>
|
906
|
-
</div>
|
907
|
-
|
908
|
-
|
909
|
-
<span id=""></span>
|
910
|
-
<div class="method_details ">
|
911
|
-
<h3 class="signature " id="type-instance_method">
|
912
|
-
|
913
|
-
- (<tt>Object</tt>) <strong>type</strong> <span class="extras">(readonly)</span>
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
</h3><div class="docstring">
|
920
|
-
<div class="discussion">
|
921
|
-
|
922
|
-
<p>Returns the value of attribute type</p>
|
923
|
-
|
924
|
-
|
925
|
-
</div>
|
926
|
-
</div>
|
927
|
-
<div class="tags">
|
928
|
-
|
929
|
-
|
930
|
-
</div><table class="source_code">
|
931
|
-
<tr>
|
932
|
-
<td>
|
933
|
-
<pre class="lines">
|
934
|
-
|
935
|
-
|
936
|
-
18
|
937
|
-
19
|
938
|
-
20</pre>
|
939
|
-
</td>
|
940
|
-
<td>
|
941
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 18</span>
|
942
|
-
|
943
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
|
944
|
-
<span class='ivar'>@type</span>
|
945
|
-
<span class='kw'>end</span></pre>
|
946
|
-
</td>
|
947
|
-
</tr>
|
948
|
-
</table>
|
949
|
-
</div>
|
950
|
-
|
951
|
-
</div>
|
952
|
-
|
953
|
-
|
954
|
-
<div id="instance_method_details" class="method_details_list">
|
955
|
-
<h2>Instance Method Details</h2>
|
956
|
-
|
957
|
-
|
958
|
-
<div class="method_details first">
|
959
|
-
<h3 class="signature first" id="blast-instance_method">
|
960
|
-
|
961
|
-
- (<tt>Object</tt>) <strong>blast</strong>
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
</h3><div class="docstring">
|
968
|
-
<div class="discussion">
|
969
|
-
|
970
|
-
<p>Calls blast according to the type of the sequence</p>
|
971
|
-
|
972
|
-
|
973
|
-
</div>
|
974
|
-
</div>
|
975
|
-
<div class="tags">
|
976
|
-
|
977
|
-
|
978
|
-
</div><table class="source_code">
|
979
|
-
<tr>
|
980
|
-
<td>
|
981
|
-
<pre class="lines">
|
982
|
-
|
983
|
-
|
984
|
-
79
|
985
|
-
80
|
986
|
-
81
|
987
|
-
82
|
988
|
-
83
|
989
|
-
84
|
990
|
-
85
|
991
|
-
86
|
992
|
-
87
|
993
|
-
88
|
994
|
-
89
|
995
|
-
90
|
996
|
-
91
|
997
|
-
92
|
998
|
-
93
|
999
|
-
94
|
1000
|
-
95
|
1001
|
-
96
|
1002
|
-
97
|
1003
|
-
98
|
1004
|
-
99
|
1005
|
-
100
|
1006
|
-
101
|
1007
|
-
102
|
1008
|
-
103
|
1009
|
-
104
|
1010
|
-
105
|
1011
|
-
106
|
1012
|
-
107
|
1013
|
-
108
|
1014
|
-
109
|
1015
|
-
110
|
1016
|
-
111
|
1017
|
-
112
|
1018
|
-
113
|
1019
|
-
114
|
1020
|
-
115
|
1021
|
-
116</pre>
|
1022
|
-
</td>
|
1023
|
-
<td>
|
1024
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 79</span>
|
1025
|
-
|
1026
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_blast'>blast</span>
|
1027
|
-
<span class='kw'>begin</span>
|
1028
|
-
|
1029
|
-
<span class='kw'>if</span> <span class='ivar'>@xml_file</span> <span class='op'>==</span> <span class='kw'>nil</span>
|
1030
|
-
|
1031
|
-
<span class='comment'>#file seek for each query
|
1032
|
-
</span> <span class='ivar'>@query_offset_lst</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='ivar'>@query_offset_lst</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='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_pos'>pos</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
1033
|
-
|
1034
|
-
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span><span class='op'>+</span><span class='int'>1</span><span class='rparen'>)</span> <span class='op'>>=</span> <span class='ivar'>@start_idx</span>
|
1035
|
-
<span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'>IO</span><span class='period'>.</span><span class='id identifier rubyid_binread'>binread</span><span class='lparen'>(</span><span class='ivar'>@fasta_file</span><span class='comma'>,</span> <span class='ivar'>@query_offset_lst</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='op'>+</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='ivar'>@query_offset_lst</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@query_offset_lst</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='semicolon'>;</span>
|
1036
|
-
|
1037
|
-
<span class='comment'>#call blast with the default parameters
|
1038
|
-
</span> <span class='kw'>if</span> <span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='symbol'>:protein</span>
|
1039
|
-
<span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='id identifier rubyid_call_blast_from_stdin'>call_blast_from_stdin</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>blastp</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_query'>query</span><span class='comma'>,</span> <span class='int'>11</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span>
|
1040
|
-
<span class='kw'>else</span>
|
1041
|
-
<span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='id identifier rubyid_call_blast_from_stdin'>call_blast_from_stdin</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>blastx</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_query'>query</span><span class='comma'>,</span> <span class='int'>11</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span>
|
1042
|
-
<span class='kw'>end</span>
|
1043
|
-
|
1044
|
-
<span class='comment'>#save output in a file
|
1045
|
-
</span> <span class='id identifier rubyid_xml_file'>xml_file</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@fasta_file</span><span class='rbrace'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_i'>i</span><span class='op'>+</span><span class='int'>1</span><span class='rbrace'>}</span><span class='tstring_content'>.xml</span><span class='tstring_end'>"</span></span>
|
1046
|
-
<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_xml_file'>xml_file</span> <span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>w</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <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_output'>output</span><span class='rparen'>)</span> <span class='kw'>end</span>
|
1047
|
-
|
1048
|
-
<span class='comment'>#parse output
|
1049
|
-
</span> <span class='id identifier rubyid_parse_xml_output'>parse_xml_output</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span>
|
1050
|
-
<span class='kw'>else</span>
|
1051
|
-
<span class='ivar'>@idx</span> <span class='op'>=</span> <span class='ivar'>@idx</span> <span class='op'>+</span> <span class='int'>1</span>
|
1052
|
-
<span class='kw'>end</span>
|
1053
|
-
<span class='kw'>end</span>
|
1054
|
-
<span class='kw'>else</span>
|
1055
|
-
<span class='id identifier rubyid_file'>file</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='ivar'>@xml_file</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rb</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span>
|
1056
|
-
<span class='id identifier rubyid_parse_xml_output'>parse_xml_output</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
|
1057
|
-
<span class='kw'>end</span>
|
1058
|
-
|
1059
|
-
<span class='kw'>rescue</span> <span class='const'>SystemCallError</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
1060
|
-
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Load 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'>. Possible cause: input file is not valid\n</span><span class='tstring_end'>"</span></span>
|
1061
|
-
<span class='id identifier rubyid_exit'>exit</span>
|
1062
|
-
<span class='kw'>end</span>
|
1063
|
-
<span class='kw'>end</span></pre>
|
1064
|
-
</td>
|
1065
|
-
</tr>
|
1066
|
-
</table>
|
1067
|
-
</div>
|
1068
|
-
|
1069
|
-
<div class="method_details ">
|
1070
|
-
<h3 class="signature " id="call_blast_from_file-instance_method">
|
1071
|
-
|
1072
|
-
- (<tt>Object</tt>) <strong>call_blast_from_file</strong>(command, filename, gapopen, gapextend)
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
</h3><div class="docstring">
|
1079
|
-
<div class="discussion">
|
1080
|
-
|
1081
|
-
<p>Calls blast from file with specific parameters Param: <tt>command</tt>:
|
1082
|
-
blast command in String format (e.g 'blastx' or 'blastp')
|
1083
|
-
<tt>filename</tt>: name of the FAST file <tt>query</tt>: <tt>String</tt>
|
1084
|
-
containing the the query in fasta format <tt>gapopen</tt>: gapopen blast
|
1085
|
-
parameter <tt>gapextend</tt>: gapextend blast parameter Output: String with
|
1086
|
-
the blast xml output</p>
|
1087
|
-
|
1088
|
-
|
1089
|
-
</div>
|
1090
|
-
</div>
|
1091
|
-
<div class="tags">
|
1092
|
-
|
1093
|
-
|
1094
|
-
</div><table class="source_code">
|
1095
|
-
<tr>
|
1096
|
-
<td>
|
1097
|
-
<pre class="lines">
|
1098
|
-
|
1099
|
-
|
1100
|
-
164
|
1101
|
-
165
|
1102
|
-
166
|
1103
|
-
167
|
1104
|
-
168
|
1105
|
-
169
|
1106
|
-
170
|
1107
|
-
171
|
1108
|
-
172
|
1109
|
-
173
|
1110
|
-
174
|
1111
|
-
175
|
1112
|
-
176
|
1113
|
-
177
|
1114
|
-
178
|
1115
|
-
179
|
1116
|
-
180
|
1117
|
-
181
|
1118
|
-
182
|
1119
|
-
183
|
1120
|
-
184
|
1121
|
-
185
|
1122
|
-
186
|
1123
|
-
187
|
1124
|
-
188
|
1125
|
-
189
|
1126
|
-
190
|
1127
|
-
191
|
1128
|
-
192</pre>
|
1129
|
-
</td>
|
1130
|
-
<td>
|
1131
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 164</span>
|
1132
|
-
|
1133
|
-
<span class='kw'>def</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='rparen'>)</span>
|
1134
|
-
<span class='kw'>begin</span>
|
1135
|
-
<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>
|
1136
|
-
|
1137
|
-
<span class='id identifier rubyid_evalue'>evalue</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1e-5</span><span class='tstring_end'>"</span></span>
|
1138
|
-
|
1139
|
-
<span class='comment'>#output = 5 (XML Blast output)
|
1140
|
-
</span> <span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</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 nr -remote -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'>"</span></span>
|
1141
|
-
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Executing \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd'>cmd</span><span class='rbrace'>}</span><span class='tstring_content'>\"...</span><span class='tstring_end'>"</span></span>
|
1142
|
-
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>This may take a while...</span><span class='tstring_end'>"</span></span>
|
1143
|
-
<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
|
1144
|
-
file = File.open(xml_file, "rb").read
|
1145
|
-
b.parse_xml_output(file)
|
1146
|
-
end 2>/dev/null</span><span class='tstring_end'>]</span></span>
|
1147
|
-
|
1148
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_output'>output</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
1149
|
-
<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>
|
1150
|
-
<span class='kw'>end</span>
|
1151
|
-
|
1152
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_output'>output</span>
|
1153
|
-
|
1154
|
-
<span class='kw'>rescue</span> <span class='const'>TypeError</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
1155
|
-
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</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'>. Possible cause: one of the arguments of 'call_blast_from_file' method has not the proper type\n</span><span class='tstring_end'>"</span></span>
|
1156
|
-
<span class='id identifier rubyid_exit'>exit</span>
|
1157
|
-
<span class='kw'>rescue</span> <span class='const'>ClasspathError</span> <span class='op'>=></span><span class='id identifier rubyid_error'>error</span>
|
1158
|
-
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</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'>. Did you add BLAST path to CLASSPATH?\n</span><span class='tstring_end'>"</span></span>
|
1159
|
-
<span class='id identifier rubyid_exit'>exit</span>
|
1160
|
-
<span class='kw'>end</span>
|
1161
|
-
<span class='kw'>end</span></pre>
|
1162
|
-
</td>
|
1163
|
-
</tr>
|
1164
|
-
</table>
|
1165
|
-
</div>
|
1166
|
-
|
1167
|
-
<div class="method_details ">
|
1168
|
-
<h3 class="signature " id="call_blast_from_stdin-instance_method">
|
1169
|
-
|
1170
|
-
- (<tt>Object</tt>) <strong>call_blast_from_stdin</strong>(command, query, gapopen, gapextend)
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
</h3><div class="docstring">
|
1177
|
-
<div class="discussion">
|
1178
|
-
|
1179
|
-
<p>Calls blast from standard input with specific parameters Params:
|
1180
|
-
<tt>command</tt>: blast command in String format (e.g 'blastx' or 'blastp')
|
1181
|
-
<tt>query</tt>: String containing the the query in fasta format
|
1182
|
-
<tt>gapopen</tt>: gapopen blast parameter <tt>gapextend</tt>: gapextend
|
1183
|
-
blast parameter Output: String with the blast xml output</p>
|
1184
|
-
|
1185
|
-
|
1186
|
-
</div>
|
1187
|
-
</div>
|
1188
|
-
<div class="tags">
|
1189
|
-
|
1190
|
-
|
1191
|
-
</div><table class="source_code">
|
1192
|
-
<tr>
|
1193
|
-
<td>
|
1194
|
-
<pre class="lines">
|
1195
|
-
|
1196
|
-
|
1197
|
-
127
|
1198
|
-
128
|
1199
|
-
129
|
1200
|
-
130
|
1201
|
-
131
|
1202
|
-
132
|
1203
|
-
133
|
1204
|
-
134
|
1205
|
-
135
|
1206
|
-
136
|
1207
|
-
137
|
1208
|
-
138
|
1209
|
-
139
|
1210
|
-
140
|
1211
|
-
141
|
1212
|
-
142
|
1213
|
-
143
|
1214
|
-
144
|
1215
|
-
145
|
1216
|
-
146
|
1217
|
-
147
|
1218
|
-
148
|
1219
|
-
149
|
1220
|
-
150
|
1221
|
-
151
|
1222
|
-
152</pre>
|
1223
|
-
</td>
|
1224
|
-
<td>
|
1225
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 127</span>
|
1226
|
-
|
1227
|
-
<span class='kw'>def</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='rparen'>)</span>
|
1228
|
-
<span class='kw'>begin</span>
|
1229
|
-
<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>
|
1230
|
-
|
1231
|
-
<span class='id identifier rubyid_evalue'>evalue</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1e-5</span><span class='tstring_end'>"</span></span>
|
1232
|
-
|
1233
|
-
<span class='comment'>#output format = 5 (XML Blast output)
|
1234
|
-
</span> <span class='id identifier rubyid_blast_cmd'>blast_cmd</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_command'>command</span><span class='rbrace'>}</span><span class='tstring_content'> -db nr -remote -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'>"</span></span>
|
1235
|
-
<span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>echo \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_query'>query</span><span class='rbrace'>}</span><span class='tstring_content'>\" | </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_blast_cmd'>blast_cmd</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
1236
|
-
<span class='comment'>#puts "Executing \"#{blast_cmd}\"... This may take a while..."
|
1237
|
-
</span> <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>/dev/null</span><span class='tstring_end'>]</span></span>
|
1238
|
-
|
1239
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_output'>output</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
1240
|
-
<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>
|
1241
|
-
<span class='kw'>end</span>
|
1242
|
-
|
1243
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_output'>output</span>
|
1244
|
-
|
1245
|
-
<span class='kw'>rescue</span> <span class='const'>TypeError</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
1246
|
-
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</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'>. Possible cause: one of the arguments of 'call_blast_from_file' method has not the proper type\n</span><span class='tstring_end'>"</span></span>
|
1247
|
-
<span class='id identifier rubyid_exit'>exit</span>
|
1248
|
-
<span class='kw'>rescue</span> <span class='const'>ClasspathError</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
1249
|
-
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</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'>. Possible cause: Did you add BLAST path to CLASSPATH?\n</span><span class='tstring_end'>"</span></span>
|
1250
|
-
<span class='id identifier rubyid_exit'>exit</span>
|
1251
|
-
<span class='kw'>end</span>
|
1252
|
-
<span class='kw'>end</span></pre>
|
1253
|
-
</td>
|
1254
|
-
</tr>
|
1255
|
-
</table>
|
1256
|
-
</div>
|
1257
|
-
|
1258
|
-
<div class="method_details ">
|
1259
|
-
<h3 class="signature " id="composition-instance_method">
|
1260
|
-
|
1261
|
-
- (<tt>Object</tt>) <strong>composition</strong>(sequence_string)
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
</h3><div class="docstring">
|
1268
|
-
<div class="discussion">
|
1269
|
-
|
1270
|
-
<p>Method copied from sequenceserver/sequencehelpers.rb Params:
|
1271
|
-
sequence_string: String of which we mfind the composition Output: a Hash</p>
|
1272
|
-
|
1273
|
-
|
1274
|
-
</div>
|
1275
|
-
</div>
|
1276
|
-
<div class="tags">
|
1277
|
-
|
1278
|
-
|
1279
|
-
</div><table class="source_code">
|
1280
|
-
<tr>
|
1281
|
-
<td>
|
1282
|
-
<pre class="lines">
|
1283
|
-
|
1284
|
-
|
1285
|
-
386
|
1286
|
-
387
|
1287
|
-
388
|
1288
|
-
389
|
1289
|
-
390
|
1290
|
-
391
|
1291
|
-
392</pre>
|
1292
|
-
</td>
|
1293
|
-
<td>
|
1294
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 386</span>
|
1295
|
-
|
1296
|
-
<span class='kw'>def</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>
|
1297
|
-
<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>
|
1298
|
-
<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>
|
1299
|
-
<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>
|
1300
|
-
<span class='kw'>end</span>
|
1301
|
-
<span class='id identifier rubyid_count'>count</span>
|
1302
|
-
<span class='kw'>end</span></pre>
|
1303
|
-
</td>
|
1304
|
-
</tr>
|
1305
|
-
</table>
|
1306
|
-
</div>
|
1307
|
-
|
1308
|
-
<div class="method_details ">
|
1309
|
-
<h3 class="signature " id="get_sequence_by_accession_no-instance_method">
|
1310
|
-
|
1311
|
-
- (<tt>Object</tt>) <strong>get_sequence_by_accession_no</strong>(accno, db)
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
</h3><div class="docstring">
|
1318
|
-
<div class="discussion">
|
1319
|
-
|
1320
|
-
<p>Gets gene by accession number from a givem database Params: <tt>accno</tt>:
|
1321
|
-
accession number as String <tt>db</tt>: database as String Output: String
|
1322
|
-
with the nucleotide sequence corresponding to the accno</p>
|
1323
|
-
|
1324
|
-
|
1325
|
-
</div>
|
1326
|
-
</div>
|
1327
|
-
<div class="tags">
|
1328
|
-
|
1329
|
-
|
1330
|
-
</div><table class="source_code">
|
1331
|
-
<tr>
|
1332
|
-
<td>
|
1333
|
-
<pre class="lines">
|
1334
|
-
|
1335
|
-
|
1336
|
-
358
|
1337
|
-
359
|
1338
|
-
360
|
1339
|
-
361
|
1340
|
-
362
|
1341
|
-
363
|
1342
|
-
364
|
1343
|
-
365
|
1344
|
-
366
|
1345
|
-
367
|
1346
|
-
368
|
1347
|
-
369
|
1348
|
-
370
|
1349
|
-
371
|
1350
|
-
372
|
1351
|
-
373
|
1352
|
-
374
|
1353
|
-
375
|
1354
|
-
376
|
1355
|
-
377
|
1356
|
-
378</pre>
|
1357
|
-
</td>
|
1358
|
-
<td>
|
1359
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 358</span>
|
1360
|
-
|
1361
|
-
<span class='kw'>def</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_accno'>accno</span><span class='comma'>,</span><span class='id identifier rubyid_db'>db</span><span class='rparen'>)</span>
|
1362
|
-
|
1363
|
-
<span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>http://www.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db'>db</span><span class='rbrace'>}</span><span class='tstring_content'>&retmax=1&usehistory=y&term=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_accno'>accno</span><span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='tstring_end'>"</span></span>
|
1364
|
-
<span class='comment'>#puts uri
|
1365
|
-
</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1366
|
-
|
1367
|
-
<span class='id identifier rubyid_result2'>result2</span> <span class='op'>=</span> <span class='id identifier rubyid_result'>result</span>
|
1368
|
-
<span class='id identifier rubyid_queryKey'>queryKey</span> <span class='op'>=</span> <span class='id identifier rubyid_result2'>result2</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'><\bQueryKey\b>([\w\W\d]+)<\/\bQueryKey\b></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>
|
1369
|
-
<span class='id identifier rubyid_webEnv'>webEnv</span> <span class='op'>=</span> <span class='id identifier rubyid_result'>result</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'><\bWebEnv\b>([\w\W\d]+)<\/\bWebEnv\b></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>
|
1370
|
-
|
1371
|
-
<span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>http://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?rettype=fasta&retmode=text&retstart=0&retmax=1&db=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db'>db</span><span class='rbrace'>}</span><span class='tstring_content'>&query_key=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queryKey'>queryKey</span><span class='rbrace'>}</span><span class='tstring_content'>&WebEnv=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_webEnv'>webEnv</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
1372
|
-
|
1373
|
-
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1374
|
-
|
1375
|
-
<span class='comment'>#parse FASTA output
|
1376
|
-
</span> <span class='id identifier rubyid_rec'>rec</span><span class='op'>=</span><span class='id identifier rubyid_result'>result</span>
|
1377
|
-
<span class='id identifier rubyid_nl'>nl</span> <span class='op'>=</span> <span class='id identifier rubyid_rec'>rec</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1378
|
-
<span class='id identifier rubyid_header'>header</span> <span class='op'>=</span> <span class='id identifier rubyid_rec'>rec</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_nl'>nl</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span>
|
1379
|
-
<span class='id identifier rubyid_seq'>seq</span> <span class='op'>=</span> <span class='id identifier rubyid_rec'>rec</span><span class='lbracket'>[</span><span class='id identifier rubyid_nl'>nl</span><span class='op'>+</span><span class='int'>1</span><span class='op'>..</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span>
|
1380
|
-
<span class='id identifier rubyid_seq'>seq</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'>\n</span><span class='regexp_end'>/</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1381
|
-
<span class='kw'>end</span></pre>
|
1382
|
-
</td>
|
1383
|
-
</tr>
|
1384
|
-
</table>
|
1385
|
-
</div>
|
1386
|
-
|
1387
|
-
<div class="method_details ">
|
1388
|
-
<h3 class="signature " id="guess_sequence_type-instance_method">
|
1389
|
-
|
1390
|
-
- (<tt>Object</tt>) <strong>guess_sequence_type</strong>(sequence_string)
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
</h3><div class="docstring">
|
1397
|
-
<div class="discussion">
|
1398
|
-
|
1399
|
-
<p>Method copied from sequenceserver/sequencehelpers.rb Strips all non-letter
|
1400
|
-
characters. guestimates sequence based on that. If less than 10 useable
|
1401
|
-
characters... returns nil If more than 90% ACGTU returns :nucleotide. else
|
1402
|
-
returns :protein Params: <tt>sequence_string</tt>: String to validate
|
1403
|
-
Output: nil, :nucleotide or :protein</p>
|
1404
|
-
|
1405
|
-
|
1406
|
-
</div>
|
1407
|
-
</div>
|
1408
|
-
<div class="tags">
|
1409
|
-
|
1410
|
-
|
1411
|
-
</div><table class="source_code">
|
1412
|
-
<tr>
|
1413
|
-
<td>
|
1414
|
-
<pre class="lines">
|
1415
|
-
|
1416
|
-
|
1417
|
-
403
|
1418
|
-
404
|
1419
|
-
405
|
1420
|
-
406
|
1421
|
-
407
|
1422
|
-
408
|
1423
|
-
409
|
1424
|
-
410
|
1425
|
-
411
|
1426
|
-
412
|
1427
|
-
413
|
1428
|
-
414
|
1429
|
-
415
|
1430
|
-
416
|
1431
|
-
417
|
1432
|
-
418
|
1433
|
-
419
|
1434
|
-
420</pre>
|
1435
|
-
</td>
|
1436
|
-
<td>
|
1437
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 403</span>
|
1438
|
-
|
1439
|
-
<span class='kw'>def</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>
|
1440
|
-
<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
|
1441
|
-
</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
|
1442
|
-
</span>
|
1443
|
-
<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'><</span> <span class='int'>10</span> <span class='comment'># conservative
|
1444
|
-
</span>
|
1445
|
-
<span class='id identifier rubyid_composition'>composition</span> <span class='op'>=</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>
|
1446
|
-
<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
|
1447
|
-
</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
|
1448
|
-
</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
|
1449
|
-
</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>
|
1450
|
-
|
1451
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_putative_NA_sum'>putative_NA_sum</span> <span class='op'>></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>
|
1452
|
-
<span class='kw'>return</span> <span class='symbol'>:nucleotide</span>
|
1453
|
-
<span class='kw'>else</span>
|
1454
|
-
<span class='kw'>return</span> <span class='symbol'>:protein</span>
|
1455
|
-
<span class='kw'>end</span>
|
1456
|
-
<span class='kw'>end</span></pre>
|
1457
|
-
</td>
|
1458
|
-
</tr>
|
1459
|
-
</table>
|
1460
|
-
</div>
|
1461
|
-
|
1462
|
-
<div class="method_details ">
|
1463
|
-
<h3 class="signature " id="parse_next_query-instance_method">
|
1464
|
-
|
1465
|
-
- (<tt>Object</tt>) <strong>parse_next_query</strong>(iterator)
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
</h3><div class="docstring">
|
1472
|
-
<div class="discussion">
|
1473
|
-
|
1474
|
-
<p>Parses the next query from the blast xml output query Params:
|
1475
|
-
<tt>iterator</tt>: blast xml iterator for hits Outputs: output1: an array
|
1476
|
-
of <tt>Sequence</tt> ojbects for hits output2: <tt>Sequence</tt> object for
|
1477
|
-
the predicted sequence</p>
|
1478
|
-
|
1479
|
-
|
1480
|
-
</div>
|
1481
|
-
</div>
|
1482
|
-
<div class="tags">
|
1483
|
-
|
1484
|
-
|
1485
|
-
</div><table class="source_code">
|
1486
|
-
<tr>
|
1487
|
-
<td>
|
1488
|
-
<pre class="lines">
|
1489
|
-
|
1490
|
-
|
1491
|
-
257
|
1492
|
-
258
|
1493
|
-
259
|
1494
|
-
260
|
1495
|
-
261
|
1496
|
-
262
|
1497
|
-
263
|
1498
|
-
264
|
1499
|
-
265
|
1500
|
-
266
|
1501
|
-
267
|
1502
|
-
268
|
1503
|
-
269
|
1504
|
-
270
|
1505
|
-
271
|
1506
|
-
272
|
1507
|
-
273
|
1508
|
-
274
|
1509
|
-
275
|
1510
|
-
276
|
1511
|
-
277
|
1512
|
-
278
|
1513
|
-
279
|
1514
|
-
280
|
1515
|
-
281
|
1516
|
-
282
|
1517
|
-
283
|
1518
|
-
284
|
1519
|
-
285
|
1520
|
-
286
|
1521
|
-
287
|
1522
|
-
288
|
1523
|
-
289
|
1524
|
-
290
|
1525
|
-
291
|
1526
|
-
292
|
1527
|
-
293
|
1528
|
-
294
|
1529
|
-
295
|
1530
|
-
296
|
1531
|
-
297
|
1532
|
-
298
|
1533
|
-
299
|
1534
|
-
300
|
1535
|
-
301
|
1536
|
-
302
|
1537
|
-
303
|
1538
|
-
304
|
1539
|
-
305
|
1540
|
-
306
|
1541
|
-
307
|
1542
|
-
308
|
1543
|
-
309
|
1544
|
-
310
|
1545
|
-
311
|
1546
|
-
312
|
1547
|
-
313
|
1548
|
-
314
|
1549
|
-
315
|
1550
|
-
316
|
1551
|
-
317
|
1552
|
-
318
|
1553
|
-
319
|
1554
|
-
320
|
1555
|
-
321
|
1556
|
-
322
|
1557
|
-
323
|
1558
|
-
324
|
1559
|
-
325
|
1560
|
-
326
|
1561
|
-
327
|
1562
|
-
328
|
1563
|
-
329
|
1564
|
-
330
|
1565
|
-
331
|
1566
|
-
332
|
1567
|
-
333
|
1568
|
-
334
|
1569
|
-
335
|
1570
|
-
336
|
1571
|
-
337
|
1572
|
-
338
|
1573
|
-
339
|
1574
|
-
340
|
1575
|
-
341
|
1576
|
-
342
|
1577
|
-
343
|
1578
|
-
344
|
1579
|
-
345
|
1580
|
-
346
|
1581
|
-
347
|
1582
|
-
348
|
1583
|
-
349</pre>
|
1584
|
-
</td>
|
1585
|
-
<td>
|
1586
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 257</span>
|
1587
|
-
|
1588
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse_next_query'>parse_next_query</span><span class='lparen'>(</span><span class='id identifier rubyid_iterator'>iterator</span><span class='rparen'>)</span>
|
1589
|
-
<span class='kw'>begin</span>
|
1590
|
-
<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>
|
1591
|
-
|
1592
|
-
<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>
|
1593
|
-
<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>
|
1594
|
-
<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>
|
1595
|
-
|
1596
|
-
<span class='comment'>#puts "#################################################"
|
1597
|
-
</span> <span class='comment'>#puts "Parsing query #{iter.field('Iteration_iter-num')}"
|
1598
|
-
</span>
|
1599
|
-
<span class='comment'># get info about the query
|
1600
|
-
</span> <span class='id identifier rubyid_predicted_seq'>predicted_seq</span><span class='period'>.</span><span class='id identifier rubyid_xml_length'>xml_length</span> <span class='op'>=</span> <span class='id identifier rubyid_iter'>iter</span><span class='period'>.</span><span class='id identifier rubyid_field'>field</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Iteration_query-len</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
1601
|
-
<span class='kw'>if</span> <span class='ivar'>@type</span> <span class='op'>==</span> <span class='symbol'>:nucleotide</span>
|
1602
|
-
<span class='id identifier rubyid_predicted_seq'>predicted_seq</span><span class='period'>.</span><span class='id identifier rubyid_xml_length'>xml_length</span> <span class='op'>/=</span> <span class='int'>3</span>
|
1603
|
-
<span class='kw'>end</span>
|
1604
|
-
<span class='id identifier rubyid_predicted_seq'>predicted_seq</span><span class='period'>.</span><span class='id identifier rubyid_definition'>definition</span> <span class='op'>=</span> <span class='id identifier rubyid_iter'>iter</span><span class='period'>.</span><span class='id identifier rubyid_field'>field</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Iteration_query-def</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1605
|
-
|
1606
|
-
<span class='comment'># parse blast the xml output and get the hits
|
1607
|
-
</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>
|
1608
|
-
|
1609
|
-
<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>
|
1610
|
-
|
1611
|
-
<span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_xml_length'>xml_length</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>
|
1612
|
-
<span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_seq_type'>seq_type</span> <span class='op'>=</span> <span class='ivar'>@type</span>
|
1613
|
-
<span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_database'>database</span> <span class='op'>=</span> <span class='id identifier rubyid_iter'>iter</span><span class='period'>.</span><span class='id identifier rubyid_field'>field</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>BlastOutput_db</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1614
|
-
<span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</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>
|
1615
|
-
<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>
|
1616
|
-
<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>
|
1617
|
-
|
1618
|
-
<span class='id identifier rubyid_species_regex'>species_regex</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><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>
|
1619
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_species_regex'>species_regex</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='kw'>nil</span>
|
1620
|
-
<span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_species'>species</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unknown</span><span class='tstring_end'>"</span></span>
|
1621
|
-
<span class='kw'>else</span>
|
1622
|
-
<span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_species'>species</span> <span class='op'>=</span> <span class='id identifier rubyid_species_regex'>species_regex</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>
|
1623
|
-
<span class='kw'>end</span>
|
1624
|
-
|
1625
|
-
<span class='comment'>#get gene by accession number
|
1626
|
-
</span> <span class='kw'>if</span> <span class='ivar'>@type</span> <span class='op'>==</span> <span class='symbol'>:protein</span>
|
1627
|
-
<span class='id identifier rubyid_seq'>seq</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'>"</span><span class='tstring_end'>"</span></span><span class='comment'>#get_sequence_by_accession_no(seq.accession_no, "protein")
|
1628
|
-
</span> <span class='kw'>else</span>
|
1629
|
-
<span class='id identifier rubyid_seq'>seq</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'>"</span><span class='tstring_end'>"</span></span><span class='comment'>#get_sequence_by_accession_no(seq.accession_no, "nucleotide")
|
1630
|
-
</span> <span class='kw'>end</span>
|
1631
|
-
|
1632
|
-
<span class='comment'># get all high-scoring segment pairs (hsp)
|
1633
|
-
</span> <span class='id identifier rubyid_hsps'>hsps</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1634
|
-
<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>
|
1635
|
-
<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>
|
1636
|
-
<span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_bit_score'>bit_score</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_bit_score'>bit_score</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
1637
|
-
<span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_hsp_score'>hsp_score</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_score'>score</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
1638
|
-
<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>
|
1639
|
-
|
1640
|
-
<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>
|
1641
|
-
<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>
|
1642
|
-
<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>
|
1643
|
-
<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>
|
1644
|
-
|
1645
|
-
<span class='kw'>if</span> <span class='ivar'>@type</span> <span class='op'>==</span> <span class='symbol'>:nucleotide</span>
|
1646
|
-
<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>
|
1647
|
-
<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>
|
1648
|
-
<span class='kw'>end</span>
|
1649
|
-
|
1650
|
-
|
1651
|
-
<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>
|
1652
|
-
|
1653
|
-
<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>
|
1654
|
-
<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>
|
1655
|
-
<span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_middles'>middles</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_midline'>midline</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
1656
|
-
|
1657
|
-
<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>
|
1658
|
-
<span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_positive'>positive</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_positive'>positive</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
1659
|
-
<span class='id identifier rubyid_current_hsp'>current_hsp</span><span class='period'>.</span><span class='id identifier rubyid_gaps'>gaps</span> <span class='op'>=</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_gaps'>gaps</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
1660
|
-
<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>
|
1661
|
-
|
1662
|
-
<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>
|
1663
|
-
<span class='comment'>#regex = current_hsp.hseq.gsub(/[+ -]/, '+' => '.', ' ' => '.', '-' => '')
|
1664
|
-
</span> <span class='comment'>#seq.alignment_start_offset = seq.raw_sequence.index(/#{regex}/)
|
1665
|
-
</span> <span class='kw'>end</span>
|
1666
|
-
|
1667
|
-
<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>
|
1668
|
-
<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>
|
1669
|
-
<span class='comment'>#puts "getting sequence #{seq.accession_no}..."
|
1670
|
-
</span> <span class='kw'>end</span>
|
1671
|
-
|
1672
|
-
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='id identifier rubyid_hits'>hits</span><span class='comma'>,</span> <span class='id identifier rubyid_predicted_seq'>predicted_seq</span><span class='rbracket'>]</span>
|
1673
|
-
|
1674
|
-
<span class='kw'>rescue</span> <span class='const'>TypeError</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
1675
|
-
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</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'>. Possible cause: you didn't call parse method first!\n</span><span class='tstring_end'>"</span></span>
|
1676
|
-
<span class='id identifier rubyid_exit'>exit</span>
|
1677
|
-
<span class='kw'>rescue</span> <span class='const'>StopIteration</span>
|
1678
|
-
<span class='kw'>nil</span>
|
1679
|
-
<span class='kw'>end</span>
|
1680
|
-
<span class='kw'>end</span></pre>
|
1681
|
-
</td>
|
1682
|
-
</tr>
|
1683
|
-
</table>
|
1684
|
-
</div>
|
1685
|
-
|
1686
|
-
<div class="method_details ">
|
1687
|
-
<h3 class="signature " id="parse_xml_output-instance_method">
|
1688
|
-
|
1689
|
-
- (<tt>Object</tt>) <strong>parse_xml_output</strong>(output)
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
</h3><div class="docstring">
|
1696
|
-
<div class="discussion">
|
1697
|
-
|
1698
|
-
<p>Parses the xml blast output Param: <tt>output</tt>: <tt>String</tt> with
|
1699
|
-
the blast output in xml format</p>
|
1700
|
-
|
1701
|
-
|
1702
|
-
</div>
|
1703
|
-
</div>
|
1704
|
-
<div class="tags">
|
1705
|
-
|
1706
|
-
|
1707
|
-
</div><table class="source_code">
|
1708
|
-
<tr>
|
1709
|
-
<td>
|
1710
|
-
<pre class="lines">
|
1711
|
-
|
1712
|
-
|
1713
|
-
198
|
1714
|
-
199
|
1715
|
-
200
|
1716
|
-
201
|
1717
|
-
202
|
1718
|
-
203
|
1719
|
-
204
|
1720
|
-
205
|
1721
|
-
206
|
1722
|
-
207
|
1723
|
-
208
|
1724
|
-
209
|
1725
|
-
210
|
1726
|
-
211
|
1727
|
-
212
|
1728
|
-
213
|
1729
|
-
214
|
1730
|
-
215
|
1731
|
-
216
|
1732
|
-
217
|
1733
|
-
218
|
1734
|
-
219
|
1735
|
-
220
|
1736
|
-
221
|
1737
|
-
222
|
1738
|
-
223
|
1739
|
-
224
|
1740
|
-
225
|
1741
|
-
226
|
1742
|
-
227
|
1743
|
-
228
|
1744
|
-
229
|
1745
|
-
230
|
1746
|
-
231
|
1747
|
-
232
|
1748
|
-
233
|
1749
|
-
234
|
1750
|
-
235
|
1751
|
-
236
|
1752
|
-
237
|
1753
|
-
238
|
1754
|
-
239
|
1755
|
-
240
|
1756
|
-
241
|
1757
|
-
242
|
1758
|
-
243
|
1759
|
-
244
|
1760
|
-
245
|
1761
|
-
246
|
1762
|
-
247
|
1763
|
-
248</pre>
|
1764
|
-
</td>
|
1765
|
-
<td>
|
1766
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 198</span>
|
1767
|
-
|
1768
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse_xml_output'>parse_xml_output</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span>
|
1769
|
-
|
1770
|
-
<span class='id identifier rubyid_iterator'>iterator</span> <span class='op'>=</span> <span class='const'>Bio</span><span class='op'>::</span><span class='const'>BlastXMLParser</span><span class='op'>::</span><span class='const'>NokogiriBlastXml</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='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_enum'>to_enum</span>
|
1771
|
-
|
1772
|
-
<span class='kw'>begin</span>
|
1773
|
-
<span class='ivar'>@idx</span> <span class='op'>=</span> <span class='ivar'>@idx</span> <span class='op'>+</span> <span class='int'>1</span>
|
1774
|
-
<span class='kw'>if</span> <span class='ivar'>@idx</span> <span class='op'><</span> <span class='ivar'>@start_idx</span>
|
1775
|
-
<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>
|
1776
|
-
<span class='kw'>else</span>
|
1777
|
-
<span class='id identifier rubyid_sequences'>sequences</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_next_query'>parse_next_query</span><span class='lparen'>(</span><span class='id identifier rubyid_iterator'>iterator</span><span class='rparen'>)</span> <span class='comment'>#returns [hits, predicted_seq]
|
1778
|
-
</span> <span class='kw'>if</span> <span class='id identifier rubyid_sequences'>sequences</span> <span class='op'>==</span> <span class='kw'>nil</span>
|
1779
|
-
<span class='ivar'>@idx</span> <span class='op'>=</span> <span class='ivar'>@idx</span> <span class='op'>-</span><span class='int'>1</span>
|
1780
|
-
<span class='kw'>break</span>
|
1781
|
-
<span class='kw'>end</span>
|
1782
|
-
|
1783
|
-
<span class='id identifier rubyid_hits'>hits</span> <span class='op'>=</span> <span class='id identifier rubyid_sequences'>sequences</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
1784
|
-
<span class='id identifier rubyid_prediction'>prediction</span> <span class='op'>=</span> <span class='id identifier rubyid_sequences'>sequences</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
1785
|
-
<span class='comment'># get the @idx-th sequence from the fasta file
|
1786
|
-
</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='ivar'>@idx</span><span class='op'>-</span><span class='int'>1</span>
|
1787
|
-
|
1788
|
-
<span class='comment'>### add exception
|
1789
|
-
</span> <span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'>IO</span><span class='period'>.</span><span class='id identifier rubyid_binread'>binread</span><span class='lparen'>(</span><span class='ivar'>@fasta_file</span><span class='comma'>,</span> <span class='ivar'>@query_offset_lst</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='op'>+</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='ivar'>@query_offset_lst</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@query_offset_lst</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1790
|
-
<span class='id identifier rubyid_prediction'>prediction</span><span class='period'>.</span><span class='id identifier rubyid_raw_sequence'>raw_sequence</span> <span class='op'>=</span> <span class='id identifier rubyid_query'>query</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'>[^\n]*\n([ATGCatgc\n]*)</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='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1791
|
-
<span class='comment'>#file seek for each query
|
1792
|
-
</span>
|
1793
|
-
<span class='comment'># do validations
|
1794
|
-
</span>
|
1795
|
-
<span class='id identifier rubyid_v'>v</span> <span class='op'>=</span> <span class='const'>Validation</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_hits'>hits</span><span class='comma'>,</span> <span class='id identifier rubyid_prediction'>prediction</span><span class='comma'>,</span> <span class='ivar'>@type</span><span class='comma'>,</span> <span class='ivar'>@fasta_file</span><span class='comma'>,</span> <span class='ivar'>@idx</span><span class='comma'>,</span> <span class='ivar'>@start_idx</span><span class='rparen'>)</span>
|
1796
|
-
|
1797
|
-
<span class='kw'>if</span> <span class='ivar'>@outfmt</span> <span class='op'>==</span> <span class='symbol'>:html</span>
|
1798
|
-
<span class='id identifier rubyid_query_output'>query_output</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_validate_all'>validate_all</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</span>
|
1799
|
-
<span class='id identifier rubyid_query_output'>query_output</span><span class='period'>.</span><span class='id identifier rubyid_generate_html'>generate_html</span>
|
1800
|
-
<span class='kw'>else</span>
|
1801
|
-
<span class='id identifier rubyid_query_output'>query_output</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_validate_all'>validate_all</span>
|
1802
|
-
<span class='kw'>end</span>
|
1803
|
-
|
1804
|
-
<span class='id identifier rubyid_query_output'>query_output</span><span class='period'>.</span><span class='id identifier rubyid_print_output_console'>print_output_console</span>
|
1805
|
-
|
1806
|
-
<span class='comment'>#if @outfmt == :yaml
|
1807
|
-
</span> <span class='id identifier rubyid_query_output'>query_output</span><span class='period'>.</span><span class='id identifier rubyid_print_output_file_yaml'>print_output_file_yaml</span>
|
1808
|
-
<span class='comment'>#end
|
1809
|
-
</span> <span class='kw'>end</span>
|
1810
|
-
|
1811
|
-
<span class='kw'>rescue</span> <span class='const'>NoMethodError</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
1812
|
-
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>NoMethod 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'>. Possible cause: input file is not in blast xml format.\n</span><span class='tstring_end'>"</span></span>
|
1813
|
-
<span class='id identifier rubyid_exit'>exit</span>
|
1814
|
-
<span class='kw'>rescue</span> <span class='const'>StopIteration</span>
|
1815
|
-
<span class='kw'>return</span>
|
1816
|
-
<span class='kw'>end</span> <span class='kw'>while</span> <span class='int'>1</span>
|
1817
|
-
|
1818
|
-
<span class='kw'>end</span></pre>
|
1819
|
-
</td>
|
1820
|
-
</tr>
|
1821
|
-
</table>
|
1822
|
-
</div>
|
1823
|
-
|
1824
|
-
<div class="method_details ">
|
1825
|
-
<h3 class="signature " id="type_of_sequences-instance_method">
|
1826
|
-
|
1827
|
-
- (<tt>Object</tt>) <strong>type_of_sequences</strong>(fasta_format_string)
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
</h3><div class="docstring">
|
1834
|
-
<div class="discussion">
|
1835
|
-
|
1836
|
-
<p>Method copied from sequenceserver/sequencehelpers.rb Splits input at
|
1837
|
-
putative fasta definition lines (like ">adsfadsf"), guesses sequence
|
1838
|
-
type for each sequence. If not enough sequence to determine, returns nil.
|
1839
|
-
If 2 kinds of sequence mixed together, raises ArgumentError Otherwise,
|
1840
|
-
returns :nucleotide or :protein Params: <tt>sequence_string</tt>: String to
|
1841
|
-
validate Output: nil, :nucleotide or :protein</p>
|
1842
|
-
|
1843
|
-
|
1844
|
-
</div>
|
1845
|
-
</div>
|
1846
|
-
<div class="tags">
|
1847
|
-
|
1848
|
-
|
1849
|
-
</div><table class="source_code">
|
1850
|
-
<tr>
|
1851
|
-
<td>
|
1852
|
-
<pre class="lines">
|
1853
|
-
|
1854
|
-
|
1855
|
-
432
|
1856
|
-
433
|
1857
|
-
434
|
1858
|
-
435
|
1859
|
-
436
|
1860
|
-
437
|
1861
|
-
438
|
1862
|
-
439
|
1863
|
-
440
|
1864
|
-
441
|
1865
|
-
442
|
1866
|
-
443
|
1867
|
-
444
|
1868
|
-
445
|
1869
|
-
446</pre>
|
1870
|
-
</td>
|
1871
|
-
<td>
|
1872
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/blast.rb', line 432</span>
|
1873
|
-
|
1874
|
-
<span class='kw'>def</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>
|
1875
|
-
<span class='comment'># the first sequence does not need to have a fasta definition line
|
1876
|
-
</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'>^>.*$</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>
|
1877
|
-
|
1878
|
-
<span class='comment'># get all sequence types
|
1879
|
-
</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='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>
|
1880
|
-
|
1881
|
-
<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>
|
1882
|
-
|
1883
|
-
<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>
|
1884
|
-
<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)
|
1885
|
-
</span> <span class='kw'>else</span>
|
1886
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Insufficient info to determine sequence type. Cleaned queries are: </span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_sequences'>sequences</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
1887
|
-
<span class='kw'>end</span>
|
1888
|
-
<span class='kw'>end</span></pre>
|
1889
|
-
</td>
|
1890
|
-
</tr>
|
1891
|
-
</table>
|
1892
|
-
</div>
|
1893
|
-
|
1894
|
-
</div>
|
1895
|
-
|
1896
|
-
</div>
|
1897
|
-
|
1898
|
-
<div id="footer">
|
1899
|
-
Generated on Wed Aug 7 01:58:44 2013 by
|
1900
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1901
|
-
0.8.7 (ruby-1.9.3).
|
1902
|
-
</div>
|
1903
|
-
|
1904
|
-
</body>
|
1905
|
-
</html>
|