- added sequence resource and corresponding doc

This commit is contained in:
djoumbou 2016-03-09 19:50:36 -07:00
parent c8ff722e79
commit 0fa92f1800
16 changed files with 694 additions and 287 deletions

View File

@ -1,3 +1,4 @@
lib/classyfire_api.rb ed7783c1c688d4ee2a91044082a5ac80c3cd3c3e lib/classyfire_api.rb 4e5cc4102771d77c67759b9298ae685f0cb612cd
lib/query_resource.rb 645cfb1688a5c44e67e5227fc0e9a77589731f24 lib/query_resource.rb 645cfb1688a5c44e67e5227fc0e9a77589731f24
lib/entity_resource.rb 6c50b4be6a5eb13b44d7080b19c7033b7a37c7cf lib/entity_resource.rb 6c50b4be6a5eb13b44d7080b19c7033b7a37c7cf
lib/sequence_resource.rb d8c5007781d50d0bc13cbe360b617e2937a19428

Binary file not shown.

Binary file not shown.

View File

@ -41,13 +41,31 @@
> > > > > >
> > >The output format is "json" (JSON). > > >The output format is "json" (JSON).
> ##2. Sequence##
>
> >Sequences are represented by the Sequence model, through which one can access the compound's structure-based classification.
> >
> >###GET###
> >
> >**/sequence/{fingerprint}**
> >
> >A (FASTA) sequence's classification can be retrieved in the JSON. In this example, the sequence has the fingerprint = "8bf70c23ac100cd2c3955081d8613325"
> > >
> > >ClassyFireAPI.get_sequence_classification("8bf70c23ac100cd2c3955081d8613325","json")
> >
> > Where:
> >
> > >The sequence's fingerprint is "8bf70c23ac100cd2c3955081d8613325",
> > > > The fingerprint is generate by Digest::MD5 from the peptide sequence "APDVQDCPECTLQENPFFSQPGAPILQCMGCCFSRAYPTPLRSKKTMLVQKNVTSESTCCVAKSYNRVTVMGGFKVENHTACHCSTCYYHKS"
> > >The output format is "json" (JSON).
> ##2. Query##
> ##3. Query##
> >
> >The Query model represents the chemical structure to be classified. Its attributes are the query label and the query input. > >The Query model represents the chemical structure to be classified. Its attributes are the query label and the query input.
> > >The query label is an identifier > > >The query label is an identifier
> > > > > >
> > >The query input contains the compound's identifier (optional) and its structural representation, separated by a comma. The chemical structure is represented either in the [Daylight SMILES](http://www.daylight.com/dayhtml/doc/theory/theory.smiles.html) or the [InChI](http://www.iupac.org/home/publications/e-resources/inchi.html) format. > > >The query input contains the compound's identifier (optional) and its structural representation, separated by a tab. The chemical structure is represented either in the [Daylight SMILES](http://www.daylight.com/dayhtml/doc/theory/theory.smiles.html) format, the [InChI](http://www.iupac.org/home/publications/e-resources/inchi.html) format. Moreover, the compound can be represented with its [IUPAC name](http://www.chem.qmul.ac.uk/iupac/).
> > > >
> >###POST### > >###POST###
> >A query can be submitted using the POST method as demonstrated in the following example. > >A query can be submitted using the POST method as demonstrated in the following example.

View File

@ -156,6 +156,30 @@
<p>Retrieves the classification results for a given query.</p> <p>Retrieves the classification results for a given query.</p>
</div></span> </div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#get_sequence_classification-class_method" title="get_sequence_classification (class method)">+ (Text) <strong>get_sequence_classification</strong>(fingerprint, format = &quot;json&quot;) </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Retrieves the classification results for a given sequence.</p>
</div></span>
</li> </li>
@ -400,7 +424,7 @@ of a given size.</p>
&mdash; &mdash;
<div class='inline'> <div class='inline'>
<p>the ID of the query.</p> <p>the InChIKey of the entity.</p>
</div> </div>
</li> </li>
@ -629,6 +653,129 @@ specified format.</p>
</td> </td>
</tr> </tr>
</table> </table>
</div>
<div class="method_details ">
<h3 class="signature " id="get_sequence_classification-class_method">
+ (<tt>Text</tt>) <strong>get_sequence_classification</strong>(fingerprint, format = &quot;json&quot;)
</h3><div class="docstring">
<div class="discussion">
<p>Retrieves the classification results for a given sequence.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>the</span>
<span class='type'></span>
&mdash;
<div class='inline'>
<p>fingerprint [String] the fingerprint (generated from the sequence using
Digest::MD5).</p>
</div>
</li>
<li>
<span class='name'>format</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>&quot;json&quot;</tt>)</em>
&mdash;
<div class='inline'>
<p>the format of the query (Only JSON)</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Text</tt>)</span>
&mdash;
<div class='inline'>
<p>A text file displaying the classification results for the entity in the
specified format.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 87</span>
<span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_get_sequence_classification'>get_sequence_classification</span><span class='lparen'>(</span><span class='id identifier rubyid_fingerprint'>fingerprint</span><span class='comma'>,</span><span class='id identifier rubyid_format'>format</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>json</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>begin</span>
<span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>json</span><span class='tstring_end'>&quot;</span></span>
<span class='const'>RestClient</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>URL</span><span class='embexpr_end'>}</span><span class='tstring_content'>/entities/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_fingerprint'>fingerprint</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:accept</span> <span class='op'>=&gt;</span> <span class='symbol'>:json</span>
<span class='kw'>end</span>
<span class='kw'>rescue</span> <span class='const'>RestClient</span><span class='op'>::</span><span class='const'>ResourceNotFound</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
<span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_response'>response</span>
<span class='kw'>rescue</span> <span class='const'>RestClient</span><span class='op'>::</span><span class='const'>InternalServerError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
<span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_response'>response</span>
<span class='kw'>rescue</span> <span class='const'>RestClient</span><span class='op'>::</span><span class='const'>GatewayTimeout</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
<span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_response'>response</span>
<span class='kw'>rescue</span> <span class='const'>RestClient</span><span class='op'>::</span><span class='const'>RequestTimeout</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
<span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_response'>response</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div> </div>
<div class="method_details "> <div class="method_details ">
@ -695,17 +842,17 @@ specified format.</p>
<pre class="lines"> <pre class="lines">
85 128
86 129
87 130
88 131
89 132
90 133
91 134
92</pre> 135</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 85</span> <pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 128</span>
<span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_query_status'>query_status</span><span class='lparen'>(</span><span class='id identifier rubyid_query_id'>query_id</span><span class='rparen'>)</span> <span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_query_status'>query_status</span><span class='lparen'>(</span><span class='id identifier rubyid_query_id'>query_id</span><span class='rparen'>)</span>
<span class='kw'>begin</span> <span class='kw'>begin</span>
@ -785,49 +932,6 @@ retrieve the strutcure&#39;s classification from ClassyFire.</p>
<pre class="lines"> <pre class="lines">
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309 309
310 310
311 311
@ -847,10 +951,53 @@ retrieve the strutcure&#39;s classification from ClassyFire.</p>
325 325
326 326
327 327
328</pre> 328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 266</span> <pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 309</span>
<span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_retrieve_classification'>retrieve_classification</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='comma'>,</span><span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span> <span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_retrieve_classification'>retrieve_classification</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='comma'>,</span><span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span>
<span class='id identifier rubyid_absolute_path'>absolute_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span> <span class='id identifier rubyid_absolute_path'>absolute_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span>
@ -986,49 +1133,6 @@ format.</p>
<pre class="lines"> <pre class="lines">
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378 378
379 379
380 380
@ -1039,10 +1143,53 @@ format.</p>
385 385
386 386
387 387
388</pre> 388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 335</span> <pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 378</span>
<span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_retrieve_entities_json'>retrieve_entities_json</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='comma'>,</span><span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span> <span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_retrieve_entities_json'>retrieve_entities_json</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='comma'>,</span><span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span>
<span class='id identifier rubyid_absolute_path'>absolute_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span> <span class='id identifier rubyid_absolute_path'>absolute_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span>
@ -1169,49 +1316,6 @@ format.</p>
<pre class="lines"> <pre class="lines">
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440 440
441 441
442 442
@ -1228,10 +1332,53 @@ format.</p>
453 453
454 454
455 455
456</pre> 456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 397</span> <pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 440</span>
<span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_retrieve_entities_sdf'>retrieve_entities_sdf</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='comma'>,</span><span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span> <span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_retrieve_entities_sdf'>retrieve_entities_sdf</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='comma'>,</span><span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span>
<span class='id identifier rubyid_absolute_path'>absolute_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span> <span class='id identifier rubyid_absolute_path'>absolute_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span>
@ -1362,19 +1509,19 @@ slice_length [Integer] The maximum number of entries for each query input
<pre class="lines"> <pre class="lines">
184 227
185 228
186 229
187 230
188 231
189 232
190 233
191 234
192 235
193</pre> 236</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 184</span> <pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 227</span>
<span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_submit_queries_from_directory'>submit_queries_from_directory</span><span class='lparen'>(</span><span class='id identifier rubyid_folder'>folder</span><span class='comma'>,</span><span class='id identifier rubyid_slice_length'>slice_length</span><span class='comma'>,</span><span class='id identifier rubyid_type'>type</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>STRUCTURE</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_submit_queries_from_directory'>submit_queries_from_directory</span><span class='lparen'>(</span><span class='id identifier rubyid_folder'>folder</span><span class='comma'>,</span><span class='id identifier rubyid_slice_length'>slice_length</span><span class='comma'>,</span><span class='id identifier rubyid_type'>type</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>STRUCTURE</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_directory?'>directory?</span><span class='lparen'>(</span><span class='id identifier rubyid_folder'>folder</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_directory?'>directory?</span><span class='lparen'>(</span><span class='id identifier rubyid_folder'>folder</span><span class='rparen'>)</span>
@ -1575,49 +1722,6 @@ framgments from the index &#39;start&#39;.</p>
<pre class="lines"> <pre class="lines">
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150 150
151 151
152 152
@ -1637,10 +1741,53 @@ framgments from the index &#39;start&#39;.</p>
166 166
167 167
168 168
169</pre> 169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 107</span> <pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 150</span>
<span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_submit_query_input_in_chunks'>submit_query_input_in_chunks</span><span class='lparen'>(</span><span class='id identifier rubyid_input_file'>input_file</span><span class='comma'>,</span><span class='id identifier rubyid_slice_length'>slice_length</span><span class='comma'>,</span> <span class='id identifier rubyid_start'>start</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>STRUCTURE</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_submit_query_input_in_chunks'>submit_query_input_in_chunks</span><span class='lparen'>(</span><span class='id identifier rubyid_input_file'>input_file</span><span class='comma'>,</span><span class='id identifier rubyid_slice_length'>slice_length</span><span class='comma'>,</span> <span class='id identifier rubyid_start'>start</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>STRUCTURE</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='ivar'>@start_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='ivar'>@start_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
@ -1803,49 +1950,6 @@ text. is fragmented into n part of #slice_length entries each).</p>
<pre class="lines"> <pre class="lines">
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252 252
253 253
254 254
@ -1853,10 +1957,53 @@ text. is fragmented into n part of #slice_length entries each).</p>
256 256
257 257
258 258
259</pre> 259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 209</span> <pre class="code"><span class="info file"># File 'lib/classyfire_api.rb', line 252</span>
<span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_submit_random_subset_of_query_input_in_chunks'>submit_random_subset_of_query_input_in_chunks</span><span class='lparen'>(</span><span class='id identifier rubyid_tab_separated_input_file'>tab_separated_input_file</span><span class='comma'>,</span><span class='id identifier rubyid_size'>size</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>STRUCTURE</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>def</span> <span class='const'>ClassyFireAPI</span><span class='period'>.</span><span class='id identifier rubyid_submit_random_subset_of_query_input_in_chunks'>submit_random_subset_of_query_input_in_chunks</span><span class='lparen'>(</span><span class='id identifier rubyid_tab_separated_input_file'>tab_separated_input_file</span><span class='comma'>,</span><span class='id identifier rubyid_size'>size</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>STRUCTURE</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='ivar'>@start_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='ivar'>@start_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
@ -1919,7 +2066,7 @@ text. is fragmented into n part of #slice_length entries each).</p>
</div> </div>
<div id="footer"> <div id="footer">
Generated on Wed Mar 9 19:25:39 2016 by Generated on Wed Mar 9 19:48:06 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.7.6 (ruby-2.3.0). 0.8.7.6 (ruby-2.3.0).
</div> </div>

View File

@ -114,7 +114,7 @@
</div> </div>
<div id="footer"> <div id="footer">
Generated on Wed Mar 9 19:25:39 2016 by Generated on Wed Mar 9 19:48:06 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.7.6 (ruby-2.3.0). 0.8.7.6 (ruby-2.3.0).
</div> </div>

View File

@ -183,7 +183,7 @@
</div> </div>
<div id="footer"> <div id="footer">
Generated on Wed Mar 9 19:25:39 2016 by Generated on Wed Mar 9 19:48:06 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.7.6 (ruby-2.3.0). 0.8.7.6 (ruby-2.3.0).
</div> </div>

123
doc/SequenceResource.html Normal file
View File

@ -0,0 +1,123 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Class: SequenceResource
&mdash; Documentation by YARD 0.8.7.6
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
hasFrames = window.top.frames.main ? true : false;
relpath = '';
framesUrl = "frames.html#!SequenceResource.html";
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div id="header">
<div id="menu">
<a href="_index.html">Index (S)</a> &raquo;
<span class="title">SequenceResource</span>
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="class_list.html">
Class List
</a>
<a class="full_list_link" id="method_list_link"
href="method_list.html">
Method List
</a>
<a class="full_list_link" id="file_list_link"
href="file_list.html">
File List
</a>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Class: SequenceResource
</h1>
<dl class="box">
<dt class="r1">Inherits:</dt>
<dd class="r1">
<span class="inheritName">ActiveResource::Base</span>
<ul class="fullTree">
<li>Object</li>
<li class="next">ActiveResource::Base</li>
<li class="next">SequenceResource</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">lib/sequence_resource.rb</dd>
</dl>
<div class="clear"></div>
</div>
<div id="footer">
Generated on Wed Mar 9 19:48:06 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.7.6 (ruby-2.3.0).
</div>
</body>
</html>

View File

@ -118,6 +118,19 @@
</ul> </ul>
</ul> </ul>
<ul id="alpha_S" class="alpha">
<li class="letter">S</li>
<ul>
<li>
<span class='object_link'><a href="SequenceResource.html" title="SequenceResource (class)">SequenceResource</a></span>
</li>
</ul>
</ul>
</td> </td>
</tr> </tr>
</table> </table>
@ -127,7 +140,7 @@
</div> </div>
<div id="footer"> <div id="footer">
Generated on Wed Mar 9 19:25:38 2016 by Generated on Wed Mar 9 19:48:06 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.7.6 (ruby-2.3.0). 0.8.7.6 (ruby-2.3.0).
</div> </div>

View File

@ -50,7 +50,7 @@
<ul id="full_list" class="class"> <ul id="full_list" class="class">
<li><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></li> <li><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></li>
<li><span class='object_link'><a href="ClassyFireAPI.html" title="ClassyFireAPI (module)">ClassyFireAPI</a></span><small class='search_info'>Top Level Namespace</small></li><li><span class='object_link'><a href="EntityResource.html" title="EntityResource (class)">EntityResource</a></span> &lt; Base<small class='search_info'>Top Level Namespace</small></li><li><span class='object_link'><a href="QueryResource.html" title="QueryResource (class)">QueryResource</a></span> &lt; Base<small class='search_info'>Top Level Namespace</small></li> <li><span class='object_link'><a href="ClassyFireAPI.html" title="ClassyFireAPI (module)">ClassyFireAPI</a></span><small class='search_info'>Top Level Namespace</small></li><li><span class='object_link'><a href="EntityResource.html" title="EntityResource (class)">EntityResource</a></span> &lt; Base<small class='search_info'>Top Level Namespace</small></li><li><span class='object_link'><a href="QueryResource.html" title="QueryResource (class)">QueryResource</a></span> &lt; Base<small class='search_info'>Top Level Namespace</small></li><li><span class='object_link'><a href="SequenceResource.html" title="SequenceResource (class)">SequenceResource</a></span> &lt; Base<small class='search_info'>Top Level Namespace</small></li>
</ul> </ul>
</div> </div>

View File

@ -131,7 +131,34 @@ InChIKey=LABTWGUMFABVFG-ONEGZZNKSA-N.</p>
</blockquote> </blockquote>
</blockquote> </blockquote>
<h2 id="label-2.+Query">2. Query</h2> <h2 id="label-2.+Sequence">2. Sequence</h2>
<blockquote>
<p>Sequences are represented by the Sequence model, through which one can
access the compound&#39;s structure-based classification.</p>
<h3 id="label-GET">GET</h3>
<p><strong>/sequence/fingerprint</strong></p>
<p>A (FASTA) sequence&#39;s classification can be retrieved in the JSON. In
this example, the sequence has the fingerprint =
“8bf70c23ac100cd2c3955081d8613325”</p>
<blockquote>
<p>ClassyFireAPI.get_sequence_classification(“8bf70c23ac100cd2c3955081d8613325”,“json”)</p>
</blockquote>
<p>Where:</p>
<blockquote>
<p>The sequence&#39;s fingerprint is “8bf70c23ac100cd2c3955081d8613325”,</p>
<p>The output format is “json” (JSON).</p>
</blockquote>
</blockquote>
<h2 id="label-3.+Query">3. Query</h2>
<blockquote> <blockquote>
<p>The Query model represents the chemical structure to be classified. Its <p>The Query model represents the chemical structure to be classified. Its
@ -141,12 +168,13 @@ attributes are the query label and the query input.</p>
<p>The query label is an identifier</p> <p>The query label is an identifier</p>
<p>The query input contains the compound&#39;s identifier (optional) and its <p>The query input contains the compound&#39;s identifier (optional) and its
structural representation, separated by a comma. The chemical structure is structural representation, separated by a tab. The chemical structure is
represented either in the <a represented either in the <a
href="http://www.daylight.com/dayhtml/doc/theory/theory.smiles.html">Daylight href="http://www.daylight.com/dayhtml/doc/theory/theory.smiles.html">Daylight
SMILES</a> or the <a SMILES</a> format, the <a
href="http://www.iupac.org/home/publications/e-resources/inchi.html">InChI</a> href="http://www.iupac.org/home/publications/e-resources/inchi.html">InChI</a>
format.</p> format. Moreover, the compound can be represented with its <a
href="http://www.chem.qmul.ac.uk/iupac/">IUPAC name</a>.</p>
</blockquote> </blockquote>
<h3 id="label-POST">POST</h3> <h3 id="label-POST">POST</h3>
@ -155,12 +183,9 @@ format.</p>
following example.</p> following example.</p>
<blockquote> <blockquote>
<p>ClassyFireAPI.submit_query(“curl_test”,“MOL1tCCCOCCnMOL2tCOCC=CCCC”,“STRUCTURE”)</p> <p>ClassyFireAPI.submit_query(“curl_test”,“MOL1tCCCOCCnMOL2tCOCC=CCCC”,“STRUCTURE”)
</blockquote> where the parameters are:</p>
<p>where the parameters are:</p>
<blockquote>
<p>The query label: curl_test,</p> <p>The query label: curl_test,</p>
<p>The entity identifiers: MOL1,MOL2</p> <p>The entity identifiers: MOL1,MOL2</p>
@ -197,14 +222,14 @@ XML format.</p>
<h1 id="label-Who+do+I+talk+to-3F"><strong>Who do I talk to?</strong></h1> <h1 id="label-Who+do+I+talk+to-3F"><strong>Who do I talk to?</strong></h1>
<ul><li> <ul><li>
<p>Repo owner or admin</p> <p>Yannick Djoumbou Feunang: djoumbou@ualberta.ca</p>
</li><li> </li><li>
<p>Other community or team contact</p> <p>Other community or team contact</p>
</li></ul> </li></ul>
</div></div> </div></div>
<div id="footer"> <div id="footer">
Generated on Wed Mar 9 19:25:39 2016 by Generated on Wed Mar 9 19:48:06 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.7.6 (ruby-2.3.0). 0.8.7.6 (ruby-2.3.0).
</div> </div>

View File

@ -131,7 +131,34 @@ InChIKey=LABTWGUMFABVFG-ONEGZZNKSA-N.</p>
</blockquote> </blockquote>
</blockquote> </blockquote>
<h2 id="label-2.+Query">2. Query</h2> <h2 id="label-2.+Sequence">2. Sequence</h2>
<blockquote>
<p>Sequences are represented by the Sequence model, through which one can
access the compound&#39;s structure-based classification.</p>
<h3 id="label-GET">GET</h3>
<p><strong>/sequence/fingerprint</strong></p>
<p>A (FASTA) sequence&#39;s classification can be retrieved in the JSON. In
this example, the sequence has the fingerprint =
“8bf70c23ac100cd2c3955081d8613325”</p>
<blockquote>
<p>ClassyFireAPI.get_sequence_classification(“8bf70c23ac100cd2c3955081d8613325”,“json”)</p>
</blockquote>
<p>Where:</p>
<blockquote>
<p>The sequence&#39;s fingerprint is “8bf70c23ac100cd2c3955081d8613325”,</p>
<p>The output format is “json” (JSON).</p>
</blockquote>
</blockquote>
<h2 id="label-3.+Query">3. Query</h2>
<blockquote> <blockquote>
<p>The Query model represents the chemical structure to be classified. Its <p>The Query model represents the chemical structure to be classified. Its
@ -141,12 +168,13 @@ attributes are the query label and the query input.</p>
<p>The query label is an identifier</p> <p>The query label is an identifier</p>
<p>The query input contains the compound&#39;s identifier (optional) and its <p>The query input contains the compound&#39;s identifier (optional) and its
structural representation, separated by a comma. The chemical structure is structural representation, separated by a tab. The chemical structure is
represented either in the <a represented either in the <a
href="http://www.daylight.com/dayhtml/doc/theory/theory.smiles.html">Daylight href="http://www.daylight.com/dayhtml/doc/theory/theory.smiles.html">Daylight
SMILES</a> or the <a SMILES</a> format, the <a
href="http://www.iupac.org/home/publications/e-resources/inchi.html">InChI</a> href="http://www.iupac.org/home/publications/e-resources/inchi.html">InChI</a>
format.</p> format. Moreover, the compound can be represented with its <a
href="http://www.chem.qmul.ac.uk/iupac/">IUPAC name</a>.</p>
</blockquote> </blockquote>
<h3 id="label-POST">POST</h3> <h3 id="label-POST">POST</h3>
@ -155,12 +183,9 @@ format.</p>
following example.</p> following example.</p>
<blockquote> <blockquote>
<p>ClassyFireAPI.submit_query(“curl_test”,“MOL1tCCCOCCnMOL2tCOCC=CCCC”,“STRUCTURE”)</p> <p>ClassyFireAPI.submit_query(“curl_test”,“MOL1tCCCOCCnMOL2tCOCC=CCCC”,“STRUCTURE”)
</blockquote> where the parameters are:</p>
<p>where the parameters are:</p>
<blockquote>
<p>The query label: curl_test,</p> <p>The query label: curl_test,</p>
<p>The entity identifiers: MOL1,MOL2</p> <p>The entity identifiers: MOL1,MOL2</p>
@ -197,14 +222,14 @@ XML format.</p>
<h1 id="label-Who+do+I+talk+to-3F"><strong>Who do I talk to?</strong></h1> <h1 id="label-Who+do+I+talk+to-3F"><strong>Who do I talk to?</strong></h1>
<ul><li> <ul><li>
<p>Repo owner or admin</p> <p>Yannick Djoumbou Feunang: djoumbou@ualberta.ca</p>
</li><li> </li><li>
<p>Other community or team contact</p> <p>Other community or team contact</p>
</li></ul> </li></ul>
</div></div> </div></div>
<div id="footer"> <div id="footer">
Generated on Wed Mar 9 19:25:38 2016 by Generated on Wed Mar 9 19:48:06 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.7.6 (ruby-2.3.0). 0.8.7.6 (ruby-2.3.0).
</div> </div>

View File

@ -64,54 +64,60 @@
<li class="r1 "> <li class="r1 ">
<span class='object_link'><a href="ClassyFireAPI.html#get_sequence_classification-class_method" title="ClassyFireAPI.get_sequence_classification (method)">get_sequence_classification</a></span>
<small>ClassyFireAPI</small>
</li>
<li class="r2 ">
<span class='object_link'><a href="ClassyFireAPI.html#query_status-class_method" title="ClassyFireAPI.query_status (method)">query_status</a></span> <span class='object_link'><a href="ClassyFireAPI.html#query_status-class_method" title="ClassyFireAPI.query_status (method)">query_status</a></span>
<small>ClassyFireAPI</small> <small>ClassyFireAPI</small>
</li> </li>
<li class="r2 "> <li class="r1 ">
<span class='object_link'><a href="ClassyFireAPI.html#retrieve_classification-class_method" title="ClassyFireAPI.retrieve_classification (method)">retrieve_classification</a></span> <span class='object_link'><a href="ClassyFireAPI.html#retrieve_classification-class_method" title="ClassyFireAPI.retrieve_classification (method)">retrieve_classification</a></span>
<small>ClassyFireAPI</small> <small>ClassyFireAPI</small>
</li> </li>
<li class="r1 "> <li class="r2 ">
<span class='object_link'><a href="ClassyFireAPI.html#retrieve_entities_json-class_method" title="ClassyFireAPI.retrieve_entities_json (method)">retrieve_entities_json</a></span> <span class='object_link'><a href="ClassyFireAPI.html#retrieve_entities_json-class_method" title="ClassyFireAPI.retrieve_entities_json (method)">retrieve_entities_json</a></span>
<small>ClassyFireAPI</small> <small>ClassyFireAPI</small>
</li> </li>
<li class="r2 "> <li class="r1 ">
<span class='object_link'><a href="ClassyFireAPI.html#retrieve_entities_sdf-class_method" title="ClassyFireAPI.retrieve_entities_sdf (method)">retrieve_entities_sdf</a></span> <span class='object_link'><a href="ClassyFireAPI.html#retrieve_entities_sdf-class_method" title="ClassyFireAPI.retrieve_entities_sdf (method)">retrieve_entities_sdf</a></span>
<small>ClassyFireAPI</small> <small>ClassyFireAPI</small>
</li> </li>
<li class="r1 "> <li class="r2 ">
<span class='object_link'><a href="ClassyFireAPI.html#submit_queries_from_directory-class_method" title="ClassyFireAPI.submit_queries_from_directory (method)">submit_queries_from_directory</a></span> <span class='object_link'><a href="ClassyFireAPI.html#submit_queries_from_directory-class_method" title="ClassyFireAPI.submit_queries_from_directory (method)">submit_queries_from_directory</a></span>
<small>ClassyFireAPI</small> <small>ClassyFireAPI</small>
</li> </li>
<li class="r2 "> <li class="r1 ">
<span class='object_link'><a href="ClassyFireAPI.html#submit_query-class_method" title="ClassyFireAPI.submit_query (method)">submit_query</a></span> <span class='object_link'><a href="ClassyFireAPI.html#submit_query-class_method" title="ClassyFireAPI.submit_query (method)">submit_query</a></span>
<small>ClassyFireAPI</small> <small>ClassyFireAPI</small>
</li> </li>
<li class="r1 "> <li class="r2 ">
<span class='object_link'><a href="ClassyFireAPI.html#submit_query_input_in_chunks-class_method" title="ClassyFireAPI.submit_query_input_in_chunks (method)">submit_query_input_in_chunks</a></span> <span class='object_link'><a href="ClassyFireAPI.html#submit_query_input_in_chunks-class_method" title="ClassyFireAPI.submit_query_input_in_chunks (method)">submit_query_input_in_chunks</a></span>
<small>ClassyFireAPI</small> <small>ClassyFireAPI</small>
</li> </li>
<li class="r2 "> <li class="r1 ">
<span class='object_link'><a href="ClassyFireAPI.html#submit_random_subset_of_query_input_in_chunks-class_method" title="ClassyFireAPI.submit_random_subset_of_query_input_in_chunks (method)">submit_random_subset_of_query_input_in_chunks</a></span> <span class='object_link'><a href="ClassyFireAPI.html#submit_random_subset_of_query_input_in_chunks-class_method" title="ClassyFireAPI.submit_random_subset_of_query_input_in_chunks (method)">submit_random_subset_of_query_input_in_chunks</a></span>
<small>ClassyFireAPI</small> <small>ClassyFireAPI</small>
</li> </li>
<li class="r1 "> <li class="r2 ">
<span class='object_link'><a href="QueryResource.html#to_param-instance_method" title="QueryResource#to_param (method)">#to_param</a></span> <span class='object_link'><a href="QueryResource.html#to_param-instance_method" title="QueryResource#to_param (method)">#to_param</a></span>
<small>QueryResource</small> <small>QueryResource</small>
</li> </li>

View File

@ -89,7 +89,7 @@
<strong class="classes">Classes:</strong> <span class='object_link'><a href="EntityResource.html" title="EntityResource (class)">EntityResource</a></span>, <span class='object_link'><a href="QueryResource.html" title="QueryResource (class)">QueryResource</a></span> <strong class="classes">Classes:</strong> <span class='object_link'><a href="EntityResource.html" title="EntityResource (class)">EntityResource</a></span>, <span class='object_link'><a href="QueryResource.html" title="QueryResource (class)">QueryResource</a></span>, <span class='object_link'><a href="SequenceResource.html" title="SequenceResource (class)">SequenceResource</a></span>
</p> </p>
@ -105,7 +105,7 @@
</div> </div>
<div id="footer"> <div id="footer">
Generated on Wed Mar 9 19:25:39 2016 by Generated on Wed Mar 9 19:48:06 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.7.6 (ruby-2.3.0). 0.8.7.6 (ruby-2.3.0).
</div> </div>

View File

@ -55,7 +55,7 @@ module ClassyFireAPI
# Retrieves the classification results for a given entity. # Retrieves the classification results for a given entity.
# #
# @param inchikey [String] the ID of the query. # @param inchikey [String] the InChIKey of the entity.
# @param format [String] the format of the query, 'text' (either JSON, CSV, or SDF) # @param format [String] the format of the query, 'text' (either JSON, CSV, or SDF)
# @return [Text] A text file displaying the classification results for the entity in the specified format. # @return [Text] A text file displaying the classification results for the entity in the specified format.
def ClassyFireAPI.get_entity_classification(inchikey,format="json") def ClassyFireAPI.get_entity_classification(inchikey,format="json")
@ -79,6 +79,49 @@ module ClassyFireAPI
end end
end end
# Retrieves the classification results for a given sequence.
#
# @param the fingerprint [String] the fingerprint (generated from the sequence using Digest::MD5).
# @param format [String] the format of the query (Only JSON)
# @return [Text] A text file displaying the classification results for the entity in the specified format.
def ClassyFireAPI.get_sequence_classification(fingerprint,format="json")
begin
if format == "json"
RestClient.get "#{URL}/entities/#{fingerprint}.#{format}", :accept => :json
end
rescue RestClient::ResourceNotFound => e
e.response
rescue RestClient::InternalServerError => e
e.response
rescue RestClient::GatewayTimeout => e
e.response
rescue RestClient::RequestTimeout => e
e.response
end
end
def ClassyFireAPI.get_entity_classification(inchikey,format="json")
inchikey_id = inchikey.to_s.gsub('InChIKey=','')
begin
if format == "json"
RestClient.get "#{URL}/entities/#{inchikey_id}.#{format}", :accept => :json
elsif format == "sdf"
RestClient.get "#{URL}/entities/#{inchikey_id}.#{format}", :accept => :sdf
elsif format == "csv"
RestClient.get "#{URL}/entities/#{inchikey_id}.#{format}", :accept => :csv
end
rescue RestClient::ResourceNotFound => e
e.response
rescue RestClient::InternalServerError => e
e.response
rescue RestClient::GatewayTimeout => e
e.response
rescue RestClient::RequestTimeout => e
e.response
end
end
# Retrieves the status of a query # Retrieves the status of a query
# @param query_id [Integer] the ID of the query # @param query_id [Integer] the ID of the query
# @return [String] the query status, 'Done' or 'In progress', 'string' # @return [String] the query status, 'Done' or 'In progress', 'string'

6
lib/sequence_resource.rb Normal file
View File

@ -0,0 +1,6 @@
require 'active_resource'
class SequenceResource < ActiveResource::Base
self.site ='http://classyfire.wishartlab.com'
self.element_name = "sequence"
end