labimotion 1.4.0.rc10 → 1.4.0.rc12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/labimotion/apis/converter_api.rb +29 -0
- data/lib/labimotion/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 845b494d26394b1bd9a4b4aa3df035d4770fa362cd17d56f8de20f4e0e75f0ad
|
4
|
+
data.tar.gz: 5099822a69c3e9184d37e79612fddb70ff780a6edb35b84a2e19f54c1904ddb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba938cb0ae39b16ab62a38d0e0d8113ff700e7b762b817deaa2c7fdf1707cf7388792dd378628fad1631cf0314530f09b7b2127ba25d783bb1bdf73c27a0e57e
|
7
|
+
data.tar.gz: 15f16e4381082263476499c747cc2fc9cab5b6e068043cb6b34069fc635ffde7bf0735837ee5a44a32044d226e8fc05e10f1fea70becea12139dc3e25a5f95ca
|
@@ -35,6 +35,35 @@ module Labimotion
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
resource :structure do
|
39
|
+
helpers do
|
40
|
+
def convert_structure(molfile)
|
41
|
+
molecule_viewer = Matrice.molecule_viewer
|
42
|
+
if molecule_viewer.blank? || molecule_viewer[:chembox_api].blank?
|
43
|
+
{ molfile: molfile }
|
44
|
+
else
|
45
|
+
options = { timeout: 10, body: { mol: molfile }.to_json, headers: { 'Content-Type' => 'application/json' } }
|
46
|
+
response = HTTParty.post("#{molecule_viewer[:chembox_api]}/core/rdkit/v1/structure", options)
|
47
|
+
if response.code == 200
|
48
|
+
{ molfile: (response.parsed_response && response.parsed_response['molfile']) || molfile }
|
49
|
+
else
|
50
|
+
{ molfile: molfile }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
desc 'convert molfile to 3d'
|
56
|
+
params do
|
57
|
+
requires :mol, type: String, desc: 'Molecule molfile'
|
58
|
+
end
|
59
|
+
post do
|
60
|
+
convert_structure(params[:mol])
|
61
|
+
rescue StandardError => e
|
62
|
+
# return { msg: { level: 'error', message: e } }
|
63
|
+
{ molfile: params[:mol], msg: { level: 'error', message: e } }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
38
67
|
resource :options do
|
39
68
|
before do
|
40
69
|
error!(401) unless current_user.profile&.data['converter_admin'] == true
|
data/lib/labimotion/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: labimotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.0.
|
4
|
+
version: 1.4.0.rc12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chia-Lin Lin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|