From 7b532839d99c66fb3968d9ae25c30cffafc63d82 Mon Sep 17 00:00:00 2001 From: djoumbou Date: Tue, 28 Jun 2016 15:52:27 -0600 Subject: [PATCH] - updated the documentation - added onpenbabel gem (but still issues with need. (so users still need to download and install obabel) --- .yardoc/checksums | 3 +- .yardoc/object_types | Bin 678 -> 668 bytes .yardoc/objects/root.dat | Bin 27854 -> 26107 bytes Gemfile | 5 +- Gemfile.lock | 25 + doc/ClassyFireAPI.html | 921 ++++++++++++++++------------------- doc/EntityResource.html | 4 +- doc/NodeResource.html | 123 +++++ doc/QueryResource.html | 4 +- doc/SequenceResource.html | 4 +- doc/_index.html | 17 +- doc/class_list.html | 2 +- doc/file.README.html | 4 +- doc/index.html | 4 +- doc/method_list.html | 30 +- doc/top-level-namespace.html | 6 +- lib/classyfire_api.rb | 141 ++---- lib/node_resource.rb | 8 + 18 files changed, 669 insertions(+), 632 deletions(-) create mode 100644 doc/NodeResource.html create mode 100644 lib/node_resource.rb diff --git a/.yardoc/checksums b/.yardoc/checksums index 733e89f..d62f6d6 100644 --- a/.yardoc/checksums +++ b/.yardoc/checksums @@ -1,4 +1,5 @@ -lib/classyfire_api.rb 3449cdc9aef5fb255b1fdc933f7d7653bb1fa960 +lib/node_resource.rb 91abffbffddd88d43c4fd5408272fa112e053b8d +lib/classyfire_api.rb af1ffb46316f8e1ef09996ab2ca92f19be33c444 lib/query_resource.rb 645cfb1688a5c44e67e5227fc0e9a77589731f24 lib/entity_resource.rb 6c50b4be6a5eb13b44d7080b19c7033b7a37c7cf lib/sequence_resource.rb d8c5007781d50d0bc13cbe360b617e2937a19428 diff --git a/.yardoc/object_types b/.yardoc/object_types index 467fb847c400eba5522b7fbfe0ca2dae80e2b9d6..9fb017421bd864b8e3cf9b1e61957931b670e263 100644 GIT binary patch delta 106 zcmZ3+I)_!8g`=9winAy`za*N?n!$=IIVZ8WIGWQ_NzgApB{e9uIKQ+gIhD%@-2$$pG_ljRr=&nT)^ zl$e*2pBrCXnpB)x5}%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n-kPs@<_BlZ zTNU$m#r&{>$LG_H5F_FvFZeJ_g+4BWWbul*Rx#Jjf@i+>f?_q^kW>GXUIF|}t^j^c zyaKEF3-tXQc5)uzgEDDWR7-RICf|#%XFY0dFpiOH)6*nxkDo<^8bWCELu}h8&5!!X zYJSW+nkYAre!oxC4?mOi!_Ono?;_DJx;JkC1)pD6H$RR`LyTo44f`5>G*l#2FrD1_ z(@CmLPe`*}eTYbqG^qq$4vN7(> z+|^xU{0mWWk!SCSr1X~o{%Y=XV}hH+s<|(WNscd9b6*-X!jWJfN ku!@+OF^-q2It35N`=ox10m`*XdT^sk;_*&(>i4<-2bgpHasU7T diff --git a/Gemfile b/Gemfile index e212456..a43f9f6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,7 @@ source "https://rubygems.org" +#ruby-2.3.0-dev gem 'rest-client' -gem 'yard' \ No newline at end of file +gem 'yard' +gem 'activeresource' +gem 'openbabel' diff --git a/Gemfile.lock b/Gemfile.lock index f77ad1b..5cabbb6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,16 +1,39 @@ GEM remote: https://rubygems.org/ specs: + activemodel (4.2.6) + activesupport (= 4.2.6) + builder (~> 3.1) + activeresource (4.1.0) + activemodel (~> 4.0) + activesupport (~> 4.0) + rails-observers (~> 0.1.2) + activesupport (4.2.6) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + builder (3.2.2) domain_name (0.5.20160309) unf (>= 0.0.5, < 1.0.0) http-cookie (1.0.2) domain_name (~> 0.5) + i18n (0.7.0) + json (1.8.3) mime-types (2.99.1) + minitest (5.9.0) netrc (0.11.0) + openbabel (2.3.2.2) + rails-observers (0.1.2) + activemodel (~> 4.0) rest-client (1.8.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) + thread_safe (0.3.5) + tzinfo (1.2.2) + thread_safe (~> 0.1) unf (0.1.4) unf_ext unf_ext (0.0.7.2) @@ -20,6 +43,8 @@ PLATFORMS ruby DEPENDENCIES + activeresource + openbabel rest-client yard diff --git a/doc/ClassyFireAPI.html b/doc/ClassyFireAPI.html index 5ba7df4..c3b7959 100644 --- a/doc/ClassyFireAPI.html +++ b/doc/ClassyFireAPI.html @@ -84,7 +84,18 @@
+

Overview

+
+ +

require 'node_resource.rb'

+ +
+
+
+ + +

Constant Summary

@@ -114,6 +125,30 @@
  • + + (Text) get_chemont_node(chemontid) + + + + + + + + + + + + + +
    +

    Return data for the TaxNode with ID chemontid.

    +
    + +
  • + + +
  • + + + (Text) get_entity_classification(inchikey, format = "json") @@ -129,7 +164,7 @@
    -

    Retrieves the classification results for a given entity.

    +

    Retrieves the classification results for a given chemical entity.

  • @@ -336,7 +371,7 @@ of a given size.

  • - + (Object) submit_query_input_in_chunks(input_file, slice_length, start, type = 'STRUCTURE') + + (Object) submit_query_input_in_chunks(input_file, slice_length = 1000, start = 1, type = 'STRUCTURE') @@ -355,31 +390,6 @@ of a given size.

    a given size.

    -
  • - - -
  • - - - + (Object) submit_random_subset_of_query_input_in_chunks(tab_separated_input_file, size, type = 'STRUCTURE') - - - - - - - - - - - - - -
    -

    Takes a tab-separated file and submit randomly selected structures in bulks -of a given size.

    -
    -
  • @@ -393,9 +403,9 @@ of a given size.

    -

    +

    - + (Text) get_entity_classification(inchikey, format = "json") + + (Text) get_chemont_node(chemontid) @@ -404,7 +414,9 @@ of a given size.

    -

    Retrieves the classification results for a given entity.

    +

    Return data for the TaxNode with ID chemontid.

    + +

    Use JSON.parse to get a the json object.

    @@ -415,7 +427,7 @@ of a given size.

  • - inchikey + chemontid (String) @@ -424,25 +436,125 @@ of a given size.

    -

    the InChIKey of the entity.

    +

    the ChemOnt ID of the entity.

    +
    + +
  • + + + +

    Returns:

    +
      + +
    • + + + (Text) + + + + — +
      +

      A text displaying the classification results for the entity in the +specified format.

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +
    +
    # File 'lib/classyfire_api.rb', line 63
    +
    +def ClassyFireAPI.get_chemont_node(chemontid)
    +  chemont_id = chemontid.to_s.gsub("CHEMONTID:","C")
    +  begin
    +    RestClient.get "#{URL}/tax_nodes/#{chemont_id}.json", :accept => :json
    +  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
    +
    +
    + +
    +

    + + + (Text) get_entity_classification(inchikey, format = "json") + + + + + +

    +
    + +

    Retrieves the classification results for a given chemical entity.

    + + +
    +
    +
    +

    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 # puts "#{key} :: #{h[key]}" begin - inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip + inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0] # puts inchikey qr = JSON.parse(ClassyFireAPI.get_entity_classification(inchikey,format="json")) qr['identifier'] = key @@ -1231,7 +1342,7 @@ format.

    key = h.keys[-1] # puts "#{key} :: #{h[key]}" begin - inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip + inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0] # puts inchikey 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 # puts "#{key} :: #{h[key]}" begin - inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip + inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0] # puts inchikey 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] - # puts "#{key} :: #{h[key]}" - begin - inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip + begin + inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0] # puts inchikey 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 - # f_output.print res -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
           

    - + (Object) submit_query_input_in_chunks(input_file, slice_length, start, type = 'STRUCTURE') + + (Object) submit_query_input_in_chunks(input_file, slice_length = 1000, start = 1, type = 'STRUCTURE') @@ -1740,7 +1847,6 @@ framgments from the index 'start'.

     
     
    -151
     152
     153
     154
    @@ -1803,49 +1909,68 @@ framgments from the index 'start'.

    211 212 213 -214
    +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224

    -
    # 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
    +      #ID\tSMILES (OR INCHI, OR VALID IUPAC NAME)
    +      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
    +  # puts subdivised_groups[0]
    +  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---------------------- -----------"
    +      # begin
    +        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
    +        # puts q
    +        query_ids << JSON.parse(q)['id']
    +      # rescue Exception => e  
    +        # puts e.message  
    +        # puts e.backtrace.inspect
    +      # end
    +      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'.

    - - -
    -

    - - + (Object) submit_random_subset_of_query_input_in_chunks(tab_separated_input_file, size, type = 'STRUCTURE') - - - - - -

    -
    - -

    Takes a tab-separated file and submit randomly selected structures in bulks -of a given size.

    - -

    For 'STRUCTURE' or 'IUPAC_NAME'query types, each line must -contain either

    - -
    1) Only a structural represenation: SMILES, InChI for the 'STRUCTURE' query_type or a IUPAC name
    -  for the 'IUPAC NAME' query type.
    -2) a tab-separated pair of an ID and the corresponding sructure representation: SMILES, InChI for the 
    -  'STRUCTURE' query_type or a IUPAC name for the 'IUPAC NAME' query type.
    - -

    For 'FASTA' query type, just submit the query as a standard FASTA -text. is fragmented into n part of #slice_length entries each).

    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - tab_separated_input_file - - - (Text) - - - - — -
      -

      The path to the input file.

      -
      - -
    • - -
    • - - size - - - (Integer) - - - - — -
      -

      The maximum number of entries for each query input (the whole file

      -
      - -
    • - -
    • - - type - - - (String) - - - (defaults to: 'STRUCTURE') - - - — -
      -

      The query_type, 'STRUCTURE' (default) or 'IUPAC_NAME' or -'FASTA'.

      -
      - -
    • - -
    - - -
    - - - - -
    -
    -
    -
    -254
    -255
    -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
    -
    -
    # File 'lib/classyfire_api.rb', line 254
    -
    -def ClassyFireAPI.submit_random_subset_of_query_input_in_chunks(tab_separated_input_file,size, type='STRUCTURE')
    -  @start_time = Time.now
    -  absolute_path = File.expand_path(tab_separated_input_file)
    -  f             = File.open(absolute_path, 'r')
    -  input         = []
    -
    -  f.each_line do |line|
    -
    -    sline = line.strip.split("\t")
    -    if sline.length == 1
    -      input <<"#{sline[0]}"
    -    elsif sline.length == 2
    -      input <<"#{sline[0]}\t#{sline[1]}"
    -    end
    -  end
    -
    -  query_ids = []
    -  indexes = []
    -  r = 1
    -  while r <= (size)
    -    s = rand(0..(input.length - 1))
    -    unless indexes.include?(s)
    -      indexes<<s
    -      r += 1
    -    end
    -  end
    -
    -  random_subset = indexes.map{|x| input[x]}
    -  subdivised_groups = random_subset.each_slice(100).to_a
    -  sleeping_time = 120
    -
    -  i = 0
    -  while i < subdivised_groups.length
    -    k = 0
    -    for k in (i..(i + 5))
    -      title     = File.basename(absolute_path).split(".")[0] + "_yannick" + "_part_#{k+1}"
    -      i = i + 1
    -      begin
    -        puts "submitting #{title}"
    -        q = submit_query(title,subdivised_groups[k].join("\n"),type)
    -      rescue Exception => e  
    -        puts e.message  
    -        puts e.backtrace.inspect
    -      end
    -    end
    -    i = k
    -    puts "Going to sleep at #{Time.now - @start_time} for #{sleeping_time} s."
    -    sleep(sleeping_time)
    -    puts "Waking up at #{Time.now - @start_time}"
    -  end
    -end
    -
    @@ -2086,9 +2007,9 @@ text. is fragmented into n part of #slice_length entries each).

    diff --git a/doc/EntityResource.html b/doc/EntityResource.html index a5202f3..4ee04f2 100644 --- a/doc/EntityResource.html +++ b/doc/EntityResource.html @@ -114,9 +114,9 @@ diff --git a/doc/NodeResource.html b/doc/NodeResource.html new file mode 100644 index 0000000..6b53e22 --- /dev/null +++ b/doc/NodeResource.html @@ -0,0 +1,123 @@ + + + + + + Class: NodeResource + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

    Class: NodeResource + + + +

    + +
    + +
    Inherits:
    +
    + ActiveResource::Base + +
      +
    • Object
    • + + + + + +
    + show all + +
    + + + + + + + + + +
    Defined in:
    +
    lib/node_resource.rb
    + +
    +
    + + + + + + + + + + + +
    + + + + + \ No newline at end of file diff --git a/doc/QueryResource.html b/doc/QueryResource.html index 6538bb0..d18afef 100644 --- a/doc/QueryResource.html +++ b/doc/QueryResource.html @@ -183,9 +183,9 @@ diff --git a/doc/SequenceResource.html b/doc/SequenceResource.html index c1c1a8e..85f2f64 100644 --- a/doc/SequenceResource.html +++ b/doc/SequenceResource.html @@ -114,9 +114,9 @@ diff --git a/doc/_index.html b/doc/_index.html index 64f3f27..83cb277 100644 --- a/doc/_index.html +++ b/doc/_index.html @@ -106,6 +106,19 @@ + + +
    • Q
      • @@ -140,9 +153,9 @@ diff --git a/doc/class_list.html b/doc/class_list.html index f7d10fd..335b2b6 100644 --- a/doc/class_list.html +++ b/doc/class_list.html @@ -50,7 +50,7 @@ diff --git a/doc/file.README.html b/doc/file.README.html index c669d32..745a073 100644 --- a/doc/file.README.html +++ b/doc/file.README.html @@ -236,9 +236,9 @@ XML format.

        diff --git a/doc/index.html b/doc/index.html index c669d32..78ac5a8 100644 --- a/doc/index.html +++ b/doc/index.html @@ -236,9 +236,9 @@ XML format.

        diff --git a/doc/method_list.html b/doc/method_list.html index 8a94711..b3ba1fa 100644 --- a/doc/method_list.html +++ b/doc/method_list.html @@ -52,67 +52,67 @@
      • + get_chemont_node + ClassyFireAPI +
      • + + +
      • get_entity_classification ClassyFireAPI
      • -
      • +
      • get_query ClassyFireAPI
      • -
      • +
      • get_sequence_classification ClassyFireAPI
      • -
      • +
      • query_status ClassyFireAPI
      • -
      • +
      • retrieve_classification ClassyFireAPI
      • -
      • +
      • retrieve_entities_json ClassyFireAPI
      • -
      • +
      • retrieve_entities_sdf ClassyFireAPI
      • -
      • +
      • submit_queries_from_directory ClassyFireAPI
      • -
      • +
      • submit_query ClassyFireAPI
      • -
      • - submit_query_input_in_chunks - ClassyFireAPI -
      • - -
      • - submit_random_subset_of_query_input_in_chunks + submit_query_input_in_chunks ClassyFireAPI
      • diff --git a/doc/top-level-namespace.html b/doc/top-level-namespace.html index 5468c69..74fd85a 100644 --- a/doc/top-level-namespace.html +++ b/doc/top-level-namespace.html @@ -89,7 +89,7 @@ - Classes: EntityResource, QueryResource, SequenceResource + Classes: EntityResource, NodeResource, QueryResource, SequenceResource

        @@ -105,9 +105,9 @@ diff --git a/lib/classyfire_api.rb b/lib/classyfire_api.rb index 6c86705..b24f8ae 100644 --- a/lib/classyfire_api.rb +++ b/lib/classyfire_api.rb @@ -1,17 +1,18 @@ require 'JSON' require 'csv' require 'rest-client' +require 'openbabel' +# require 'node_resource.rb' module ClassyFireAPI URL = 'http://classyfire.wishartlab.com' - # Submits a ClassyFire query in a JSON format. # # @param label [String] the label of the query. # @param input [String] the input of the query. # @param type [String] the type of the query. # @return [Hash] A Ruby Hash with the id (and other attributes) of the Query or nil - # if there is an error. + # if there is an error. Use JSON.parse to get a the json object. def ClassyFireAPI.submit_query(label,input, type='STRUCTURE') begin q = RestClient.post URL+'/queries', {:label => label, :query_input => input, :query_type => type}.to_json, :accept => :json, :content_type => :json @@ -55,21 +56,15 @@ module ClassyFireAPI end end - # Retrieves the classification results for a given entity. + # Return data for the TaxNode with ID chemontid. # - # @param inchikey [String] the InChIKey of the entity. - # @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. - def ClassyFireAPI.get_entity_classification(inchikey,format="json") - # inchikey_id = inchikey.to_s.gsub('InChIKey=','') + # @param chemontid [String] the ChemOnt ID of the entity. + # @return [Text] A text displaying the classification results for the entity in the specified format. + # Use JSON.parse to get a the json object. + def ClassyFireAPI.get_chemont_node(chemontid) + chemont_id = chemontid.to_s.gsub("CHEMONTID:","C") begin - if format == "json" - RestClient.get "#{URL}/entities/#{inchikey}.#{format}", :accept => :json - elsif format == "sdf" - RestClient.get "#{URL}/entities/#{inchikey}.#{format}", :accept => :sdf - elsif format == "csv" - RestClient.get "#{URL}/entities/#{inchikey}.#{format}", :accept => :csv - end + RestClient.get "#{URL}/tax_nodes/#{chemont_id}.json", :accept => :json rescue RestClient::ResourceNotFound => e e.response rescue RestClient::InternalServerError => e @@ -83,9 +78,10 @@ module ClassyFireAPI # Retrieves the classification results for a given sequence. # - # @param the fingerprint [String] the fingerprint (generated from the sequence using Digest::MD5). + # @param 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. + # @return [Text] A text displaying the classification results for the entity in the specified format. + # Use JSON.parse to get a the json object. def ClassyFireAPI.get_sequence_classification(fingerprint,format="json") begin if format == "json" @@ -102,6 +98,11 @@ module ClassyFireAPI end end + # Retrieves the classification results for a given chemical entity. + # + # @param the InChIKey [String] of the entity + # @param The 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_entity_classification(inchikey,format="json") inchikey_id = inchikey.to_s.gsub('InChIKey=','') begin @@ -156,36 +157,43 @@ module ClassyFireAPI 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[1]}\t#{sline[0]}" + elsif sline.length == 2 + #ID\tSMILES (OR INCHI, OR VALID IUPAC NAME) + 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 = 360 - initial_nr_of_jobs = 40 + # puts subdivised_groups[0] + 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}" if i <= subdivised_groups.length - begin + puts "\n\n\n\n---------------------- -----------" + # begin puts "submitting #{title}" + puts subdivised_groups[i-1].join("\n") q = submit_query(title,subdivised_groups[i-1].join("\n"),type) + # puts q query_ids << JSON.parse(q)['id'] - rescue Exception => e - puts e.message - puts e.backtrace.inspect - end + # rescue Exception => e + # puts e.message + # puts e.backtrace.inspect + # end i = i + 1 else break @@ -198,7 +206,7 @@ module ClassyFireAPI 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 @@ -241,71 +249,6 @@ module ClassyFireAPI end - # Takes a tab-separated file and submit randomly selected structures in bulks of a given size. - # - # For 'STRUCTURE' or 'IUPAC_NAME'query types, each line must contain either - # 1) Only a structural represenation: SMILES, InChI for the 'STRUCTURE' query_type or a IUPAC name - # for the 'IUPAC NAME' query type. - # 2) a tab-separated pair of an ID and the corresponding sructure representation: SMILES, InChI for the - # 'STRUCTURE' query_type or a IUPAC name for the 'IUPAC NAME' query type. - # - # For 'FASTA' query type, just submit the query as a standard FASTA text. - # @param tab_separated_input_file [Text] The path to the input file. - # @param size [Integer] The maximum number of entries for each query input (the whole file - # is fragmented into n part of #slice_length entries each). - # @param type [String] The query_type, 'STRUCTURE' (default) or 'IUPAC_NAME' or 'FASTA'. - def ClassyFireAPI.submit_random_subset_of_query_input_in_chunks(tab_separated_input_file,size, type='STRUCTURE') - @start_time = Time.now - absolute_path = File.expand_path(tab_separated_input_file) - f = File.open(absolute_path, 'r') - input = [] - - f.each_line do |line| - - sline = line.strip.split("\t") - if sline.length == 1 - input <<"#{sline[0]}" - elsif sline.length == 2 - input <<"#{sline[0]}\t#{sline[1]}" - end - end - - query_ids = [] - indexes = [] - r = 1 - while r <= (size) - s = rand(0..(input.length - 1)) - unless indexes.include?(s) - indexes< e - puts e.message - puts e.backtrace.inspect - end - end - i = k - puts "Going to sleep at #{Time.now - @start_time} for #{sleeping_time} s." - sleep(sleeping_time) - puts "Waking up at #{Time.now - @start_time}" - end - end - # Reads a tab separated file, and use the structure representation #to retrieve the strutcure's classification from ClassyFire. # @@ -405,7 +348,6 @@ module ClassyFireAPI # puts "#{key} :: #{h[key]}" begin inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0] - # inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip # puts inchikey qr = JSON.parse(ClassyFireAPI.get_entity_classification(inchikey,format="json")) qr['identifier'] = key @@ -421,7 +363,6 @@ module ClassyFireAPI # puts "#{key} :: #{h[key]}" begin inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0] - # inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip # puts inchikey qr = JSON.parse(ClassyFireAPI.get_entity_classification(inchikey,format="json")) qr['identifier'] = key @@ -464,7 +405,6 @@ module ClassyFireAPI # puts "#{key} :: #{h[key]}" begin inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0] - # inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip # puts inchikey qr = ClassyFireAPI.get_entity_classification(inchikey,format="sdf") if qr.include?("The page you were looking for doesn't exist") @@ -485,7 +425,6 @@ module ClassyFireAPI key = h.keys[-1] begin inchikey = %x(obabel -:"#{h[key]}" -oinchikey).strip.split("\t")[0] - # inchikey = %x(/Applications/ChemAxon/JChem/bin/molconvert inchikey -s "#{h[key]}").strip # puts inchikey qr = ClassyFireAPI.get_entity_classification(inchikey,format="sdf") if qr.include?("The page you were looking for doesn't exist") @@ -503,4 +442,8 @@ module ClassyFireAPI end end end -end \ No newline at end of file +end + +if __FILE__ == $0 + +end diff --git a/lib/node_resource.rb b/lib/node_resource.rb new file mode 100644 index 0000000..1d7915c --- /dev/null +++ b/lib/node_resource.rb @@ -0,0 +1,8 @@ +require 'active_resource' +require 'rest-client' + +class NodeResource < ActiveResource::Base + self.site ='http://classyfire.wishartlab.com' + self.element_name = "tax_node" + has_many :entities, class_name: 'EntityResource' +end \ No newline at end of file