diff --git a/Gemfile b/Gemfile index 43ee750..50c8d49 100644 --- a/Gemfile +++ b/Gemfile @@ -10,8 +10,9 @@ gemspec # Git. Remember to move these dependencies to your gemspec before releasing # your gem to rubygems.org. -gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f' +gem 'openbabel', '2.4.90.3', git: 'https://github.com/ComPlat/openbabel-gem.git', branch: 'hot-fix-svg' +gem 'inchi-gem', '1.06.1', git: 'https://github.com/ComPlat/inchi-gem.git', branch: 'main' # To use a debugger # gem 'byebug', group: [:development, :test] -gem 'openbabel', '2.4.90.3', git: 'https://github.com/ComPlat/openbabel-gem.git', branch: 'hot-fix-svg' \ No newline at end of file + diff --git a/Gemfile.lock b/Gemfile.lock index 6ba7e9c..315e179 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,10 @@ +GIT + remote: https://github.com/ComPlat/inchi-gem.git + revision: 9a95669b42e18a20d2a0c2d5440670ff94e46c37 + branch: main + specs: + inchi-gem (1.06.1) + GIT remote: https://github.com/ComPlat/openbabel-gem.git revision: 3e25548fd95c2ac83c7fb5d9544ed2cf6ae1344b @@ -5,13 +12,6 @@ GIT specs: openbabel (2.4.90.3) -GIT - remote: https://github.com/mimemagicrb/mimemagic.git - revision: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f - ref: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f - specs: - mimemagic (0.3.5) - PATH remote: . specs: @@ -25,9 +25,11 @@ PATH grape-active_model_serializers (~> 1.3.2) haml-rails httparty + inchi-gem jquery-rails jquery-ui-rails (~> 5.0.5) kaminari + mimemagic (>= 0.3.10) nokogiri (>= 1.10, < 1.13) openbabel paperclip (~> 5.2.0) @@ -193,6 +195,9 @@ GEM mime-types (3.4.1) mime-types-data (~> 3.2015) mime-types-data (3.2021.1115) + mimemagic (0.3.10) + nokogiri (~> 1) + rake mini_mime (1.1.2) mini_portile2 (2.6.1) minitest (5.14.4) @@ -290,8 +295,8 @@ DEPENDENCIES byebug grape grape-swagger + inchi-gem (= 1.06.1)! ketcherails! - mimemagic! openbabel (= 2.4.90.3)! pg rspec diff --git a/app/api/ketcherails/ketcher_api.rb b/app/api/ketcherails/ketcher_api.rb index 178701b..3466fb0 100644 --- a/app/api/ketcherails/ketcher_api.rb +++ b/app/api/ketcherails/ketcher_api.rb @@ -99,6 +99,18 @@ class KetcherAPI < Grape::API name: mol_info[:names] } end + + desc 'Return Inchi from mol data' + params do + requires :moldata, type: String, desc: 'Mol data' + end + post :getinchi do + return_values = Inchi::ExtraInchiReturnValues.new + inchikey = Inchi.molfileToInchi(params[:moldata], return_values, '-Polymers -FoldCRU -NPZz -SAtZZ -LargeMolecules') + + env['api.format'] = :binary + "Ok.\n" + inchikey + end end end end diff --git a/app/assets/javascripts/ketcherails/ui/ui.js.erb b/app/assets/javascripts/ketcherails/ui/ui.js.erb index 62031fb..6fde49f 100644 --- a/app/assets/javascripts/ketcherails/ui/ui.js.erb +++ b/app/assets/javascripts/ketcherails/ui/ui.js.erb @@ -1711,7 +1711,7 @@ ui.buildAminoAcidsSequence = function(sequence_name, reversed = false) { var tool = new rnd.Editor.TemplateTool(ui.editor, data); ui.render.current_tool = tool; } else if(res.status == 404) { - alert("Error: can not find one of items in sequnce. Some items are not known."); + alert("Error: block unknown: cannot find one of the block from the sequence."); } else if (res.responseText.startsWith('Error.')) { alert(res.responseText.split('\n')[1]); diff --git a/ketcherails.gemspec b/ketcherails.gemspec index c2cdfa0..2272b1c 100644 --- a/ketcherails.gemspec +++ b/ketcherails.gemspec @@ -34,7 +34,8 @@ Gem::Specification.new do |s| s.add_dependency 'grape-active_model_serializers', '~> 1.3.2' s.add_dependency 'active_model_serializers', '< 0.10.0' s.add_dependency 'openbabel' - + s.add_dependency 'mimemagic', '>= 0.3.10' + s.add_dependency 'inchi-gem' # s.add_dependency 'openbabel', '~> 2.4.90.1'#, git: 'https://github.com/ComPlat/openbabel-gem'