labimotion 1.4.0.rc9 → 1.4.0.rc11
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 +25 -0
- data/lib/labimotion/helpers/segment_helpers.rb +1 -1
- 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: 349eb3f74dc52138be867db330fa4cdf18a7a834fb3247961d162ed704590cba
|
4
|
+
data.tar.gz: 5b012425c3faf3921be54879ceb7dbae3f9e73a3cfbdc1c6bff8155d3e5ec206
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81057d05d05f8f8bfcc1ec2accef2c357f7d4393f2db177937b1c8a8246ece7e2ab0af67691a04f87f133322911aeffc1c85266759a42ed140817c7ec66c4b57
|
7
|
+
data.tar.gz: 67ea5a2057eeea3090169993caf874ed95c6aa670aba79b49387428115d6bb7a078bd8903cb322b83d08e187fdffaedb22563f9cbfc7a51d0f1d21747f9bad14
|
@@ -35,6 +35,31 @@ 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_endpoint].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_endpoint], options)
|
47
|
+
response.code == 200 ? { molfile: response.parsed_response } : { molfile: molfile }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
desc 'convert molfile to 3d'
|
52
|
+
params do
|
53
|
+
requires :molfile, type: String, desc: 'Molecule molfile'
|
54
|
+
end
|
55
|
+
post do
|
56
|
+
convert_structure(params[:molfile])
|
57
|
+
rescue StandardError => e
|
58
|
+
# return { msg: { level: 'error', message: e } }
|
59
|
+
{ molfile: params[:molfile], msg: { level: 'error', message: e } }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
38
63
|
resource :options do
|
39
64
|
before do
|
40
65
|
error!(401) unless current_user.profile&.data['converter_admin'] == true
|
@@ -11,7 +11,7 @@ module Labimotion
|
|
11
11
|
def klass_list(el_klass, is_active=false)
|
12
12
|
scope = Labimotion::SegmentKlass.all
|
13
13
|
scope = scope.where(is_active: is_active) if is_active.present? && is_active == true
|
14
|
-
scope = scope.joins(:element_klass).where(klass_element: params[:element], is_active: true) if el_klass.present?
|
14
|
+
scope = scope.joins(:element_klass).where(klass_element: params[:element], is_active: true).preload(:element_klass) if el_klass.present?
|
15
15
|
scope.order('place') || []
|
16
16
|
end
|
17
17
|
|
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.rc11
|
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
|