+
Parameters:
+
+
+ -
+
+ the
+
+
+
+
+
+
+ —
+
+
InChIKey [String] of the entity
-
- format
+ The
- (String)
+
- (defaults to: "json")
-
—
-
the format of the query, 'text' (either JSON, CSV, or SDF)
+
format [String] the format of the query (Only JSON)
@@ -475,29 +587,29 @@ specified format.
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
- # File 'lib/classyfire_api.rb', line 62
+ # File 'lib/classyfire_api.rb', line 105
def ClassyFireAPI.get_entity_classification(inchikey,format="json")
inchikey_id = inchikey.to_s.gsub('InChIKey=','')
@@ -608,7 +720,6 @@ specified format.
-37
38
39
40
@@ -626,10 +737,11 @@ specified format.
52
53
54
-55
+55
+56
|
- # File 'lib/classyfire_api.rb', line 37
+ # File 'lib/classyfire_api.rb', line 38
def ClassyFireAPI.get_query(query_id,format="json")
begin
@@ -669,6 +781,8 @@ specified format.
Retrieves the classification results for a given sequence.
+Use JSON.parse to get a the json object.
+
@@ -678,17 +792,16 @@ specified format.
- the
+ fingerprint
-
+ (String)
—
- fingerprint [String] the fingerprint (generated from the sequence using
-Digest::MD5).
+ the fingerprint (generated from the sequence using Digest::MD5).
@@ -725,7 +838,7 @@ Digest::MD5).
—
- A text file displaying the classification results for the entity in the
+ A text displaying the classification results for the entity in the
specified format.
@@ -739,6 +852,10 @@ specified format.
+84
+85
+86
+87
88
89
90
@@ -749,14 +866,10 @@ specified format.
95
96
97
-98
-99
-100
-101
-102
+98
|
- # File 'lib/classyfire_api.rb', line 88
+ # File 'lib/classyfire_api.rb', line 84
def ClassyFireAPI.get_sequence_classification(fingerprint,format="json")
begin
@@ -842,17 +955,17 @@ specified format.
-129
130
131
132
133
134
135
-136
+136
+137
|
- # File 'lib/classyfire_api.rb', line 129
+ # File 'lib/classyfire_api.rb', line 130
def ClassyFireAPI.query_status(query_id)
begin
@@ -932,72 +1045,71 @@ retrieve the strutcure's classification from ClassyFire.
+256
+257
+258
+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
+303
+304
+305
+306
+307
+308
+309
+310
311
312
313
314
315
316
-317
-318
-319
-320
-321
-322
-323
-324
-325
-326
-327
-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
-372
-373
+317
|
- # File 'lib/classyfire_api.rb', line 311
+ # File 'lib/classyfire_api.rb', line 256
def ClassyFireAPI.retrieve_classification(input,output)
absolute_path = File.expand_path(input)
@@ -1058,7 +1170,6 @@ retrieve the strutcure's classification from ClassyFire.
e.message
end
end
-
res += "]}"
f_output.print res
end
@@ -1133,63 +1244,63 @@ format.
-380
-381
-382
-383
-384
-385
-386
-387
-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
-432
-433
+324
+325
+326
+327
+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
+372
+373
+374
+375
+376
+377
|
- # File 'lib/classyfire_api.rb', line 380
+ # File 'lib/classyfire_api.rb', line 324
def ClassyFireAPI.retrieve_entities_json(input,output)
absolute_path = File.expand_path(input)
@@ -1216,7 +1327,7 @@ format.
puts i
begin
- inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip
+ inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0]
qr = JSON.parse(ClassyFireAPI.get_entity_classification(inchikey,format="json"))
qr['identifier'] = key
@@ -1231,7 +1342,7 @@ format.
key = h.keys[-1]
begin
- inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip
+ inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0]
qr = JSON.parse(ClassyFireAPI.get_entity_classification(inchikey,format="json"))
qr['identifier'] = key
@@ -1316,69 +1427,67 @@ format.
+386
+387
+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
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
442
-443
-444
-445
-446
-447
-448
-449
-450
-451
-452
-453
-454
-455
-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
-500
-501
+443
|
- # File 'lib/classyfire_api.rb', line 442
+ # File 'lib/classyfire_api.rb', line 386
def ClassyFireAPI.retrieve_entities_sdf(input,output)
absolute_path = File.expand_path(input)
@@ -1400,7 +1509,7 @@ format.
puts i
begin
- inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip
+ inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0]
qr = ClassyFireAPI.get_entity_classification(inchikey,format="sdf")
if qr.include?("The page you were looking for doesn't exist")
@@ -1419,9 +1528,8 @@ format.
i += 1
end
key = h.keys[-1]
- begin
- inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip
+ begin
+ inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0]
qr = ClassyFireAPI.get_entity_classification(inchikey,format="sdf")
if qr.include?("The page you were looking for doesn't exist")
@@ -1438,8 +1546,7 @@ format.
e.message
end
end
- end
+end
|
@@ -1509,19 +1616,19 @@ slice_length [Integer] The maximum number of entries for each query input
-229
-230
-231
-232
-233
-234
-235
-236
-237
-238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
- # File 'lib/classyfire_api.rb', line 229
+ # File 'lib/classyfire_api.rb', line 239
def ClassyFireAPI.submit_queries_from_directory(folder,slice_length,type="STRUCTURE")
if File.directory?(folder)
@@ -1552,7 +1659,7 @@ slice_length [Integer] The maximum number of entries for each query input
Submits a ClassyFire query in a JSON format.
-if there is an error.
+if there is an error. Use JSON.parse to get a the json object.
@@ -1638,7 +1745,6 @@ slice_length [Integer] The maximum number of entries for each query input
-14
15
16
17
@@ -1653,10 +1759,11 @@ slice_length [Integer] The maximum number of entries for each query input
26
27
28
-29
+29
+30
|
- # File 'lib/classyfire_api.rb', line 14
+ # File 'lib/classyfire_api.rb', line 15
def ClassyFireAPI.submit_query(label,input, type='STRUCTURE')
begin
@@ -1682,7 +1789,7 @@ slice_length [Integer] The maximum number of entries for each query input
|
- # File 'lib/classyfire_api.rb', line 151
+ # File 'lib/classyfire_api.rb', line 152
-def ClassyFireAPI.submit_query_input_in_chunks(input_file,slice_length, start, type='STRUCTURE')
+def ClassyFireAPI.submit_query_input_in_chunks(input_file,slice_length=1000, start=1, type='STRUCTURE')
@start_time = Time.now
absolute_path = File.expand_path(input_file)
f = File.open(absolute_path, 'r')
input = []
lines = File.readlines(absolute_path)
-
+ i = 0
lines.uniq.each do |line|
+ i += 1
sline = line.strip.split("\t")
if sline.length == 1
input <<"#{sline[0]}"
- elsif sline.length >= 2
- input <<"#{sline[0]}\t#{sline[1]}"
+ elsif sline.length == 2
+ input <<"#{sline[0]}\t#{sline[1]}"
end
+ input <<"#{sline[0]}"
end
query_ids = []
subdivised_groups = input.uniq.each_slice(slice_length).to_a
puts "nr of subdivised_groups: #{subdivised_groups.length}"
- puts subdivised_groups[0]
- sleeping_time = 120
- initial_nr_of_jobs = 60
+ sleeping_time = 240
+ initial_nr_of_jobs = 30
i = start
while i < initial_nr_of_jobs
- title = File.basename(absolute_path).split(".")[0] + "_yannick" + "_part_#{i}"
+
+ title = File.basename(absolute_path).split(".")[0] + "_yannick" + "_part_#{i}"
if i <= subdivised_groups.length
- begin
- puts "submitting #{title}"
+ puts "\n\n\n\n---------------------- -----------"
+ puts "submitting #{title}"
+ puts subdivised_groups[i-1].join("\n")
q = submit_query(title,subdivised_groups[i-1].join("\n"),type)
- query_ids << JSON.parse(q)['id']
- rescue Exception => e
- puts e.message
- puts e.backtrace.inspect
- end
- i = i + 1
+ query_ids << JSON.parse(q)['id']
+ i = i + 1
+ else
+ break
end
end
@@ -1853,9 +1978,9 @@ framgments from the index 'start'.
sleep(sleeping_time)
puts "Waking up at #{Time.now - @start_time}"
- while i < subdivised_groups.length
+ while i >= initial_nr_of_jobs && i < subdivised_groups.length
k = 0
- for k in (i..(i+80))
+ for k in (i..(i + initial_nr_of_jobs))
title = File.basename(absolute_path).split(".")[0] + "_yannick" + "_part_#{k}"
i = i + 1
begin
@@ -1875,210 +2000,6 @@ framgments from the index 'start'.
|
-