labimotion 1.4.0.rc2 → 1.4.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f07e0d77afbb79bc2652b5f7edbc105133f727593a9a9cc236e17762d1b7e15
4
- data.tar.gz: a6d9a86cd6363b5d81f1c141f56ac85974d6622c3cfd06dc21a3184610d5c76b
3
+ metadata.gz: f38f255a309e305ddfe715e5382c0087acde8a05c42434a8c87c03640ad38772
4
+ data.tar.gz: a3ed70fa27d008b51f416fbd4ac9a2ce70e1d3cc117bdfa37e31010a62301b98
5
5
  SHA512:
6
- metadata.gz: 68ab2a10825518b8c7b22e0ae47aeb48c867404f857e98957082f952f7d42983bc07c50f62ff0dd71be1e6c9bb4f0843fabecdcf7f9ef40f5ce0d253b12dc4f6
7
- data.tar.gz: c45113c276c4954803005084733c1e4e13315e9888bb0da50663b3d68577badae0cf5278e2bf1ed4d9cc80002366b981dc80563aa40657cbebf892f34b97f8f7
6
+ metadata.gz: e80ca22f7120c4d3f34b9eecc37baa2b40a83b7d34409b4598129bb939e1c473ed6fa7fe06c7c2396210dc25571238b1bc51733fafb373e8928c076aa8761fe2
7
+ data.tar.gz: 70ddf10ed69d7eea7ac3769e3a32dd59b38b3eed052ba232e9cdbadacaa2ef6bab9ea204537390c2abe71f06246ac9eeb650b2731b28d92ad8d1bc0d534d4b38
@@ -23,7 +23,7 @@ module Labimotion
23
23
 
24
24
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_label'] = el.short_label if field['type'] == Labimotion::FieldType::DRAG_SAMPLE
25
25
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_tip'] = el.short_label if field['type'] == Labimotion::FieldType::DRAG_SAMPLE
26
- object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_svg'] = field['type'] == Labimotion::FieldType::DRAG_SAMPLE ? el.get_svg_path : File.join('/images', 'molecules', el.molecule_svg_file)
26
+ object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_svg'] = field['type'] == Labimotion::FieldType::DRAG_SAMPLE ? el.get_svg_path : File.join('/images', 'molecules', el&.molecule_svg_file || 'nosvg')
27
27
  end
28
28
 
29
29
  field_tables = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::TABLE }
@@ -41,7 +41,7 @@ module Labimotion
41
41
  find_mol = Molecule.find_by(id: sub_value[col_id]['value']['el_id'])
42
42
  next unless find_mol.present?
43
43
 
44
- sub_value[col_id]['value']['el_svg'] = File.join('/images', 'molecules', find_mol.molecule_svg_file)
44
+ sub_value[col_id]['value']['el_svg'] = File.join('/images', 'molecules', find_mol.molecule_svg_file) if find_mol&.molecule_svg_file&.present?
45
45
  sub_value[col_id]['value']['el_inchikey'] = find_mol.inchikey
46
46
  sub_value[col_id]['value']['el_smiles'] = find_mol.cano_smiles
47
47
  sub_value[col_id]['value']['el_iupac'] = find_mol.iupac_name
@@ -47,7 +47,7 @@ module Labimotion
47
47
  el.short_label
48
48
  end
49
49
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_svg'] =
50
- field['type'] == Labimotion::FieldType::DRAG_SAMPLE ? el.get_svg_path : File.join('/images', 'molecules', el.molecule_svg_file)
50
+ field['type'] == Labimotion::FieldType::DRAG_SAMPLE ? el.get_svg_path : File.join('/images', 'molecules', el&.molecule_svg_file || 'nosvg')
51
51
  end
52
52
 
53
53
  field_tables = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::TABLE }
@@ -88,7 +88,7 @@ module Labimotion
88
88
 
89
89
  case obj
90
90
  when Labimotion::Prop::MOLECULE
91
- sub_value[col_id]['value']['el_svg'] = File.join('/images', 'molecules', find_obj.molecule_svg_file)
91
+ sub_value[col_id]['value']['el_svg'] = File.join('/images', 'molecules', find_obj.molecule_svg_file) if find_obj&.molecule_svg_file&.present?
92
92
  sub_value[col_id]['value']['el_inchikey'] = find_obj.inchikey
93
93
  sub_value[col_id]['value']['el_smiles'] = find_obj.cano_smiles
94
94
  sub_value[col_id]['value']['el_iupac'] = find_obj.iupac_name
@@ -20,7 +20,7 @@ module Labimotion
20
20
 
21
21
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_label'] = el.short_label if field['type'] == Labimotion::FieldType::DRAG_SAMPLE
22
22
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_tip'] = el.short_label if field['type'] == Labimotion::FieldType::DRAG_SAMPLE
23
- object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_svg'] = field['type'] == Labimotion::FieldType::DRAG_SAMPLE ? el.get_svg_path : File.join('/images', 'molecules', el.molecule_svg_file)
23
+ object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_svg'] = field['type'] == Labimotion::FieldType::DRAG_SAMPLE ? el.get_svg_path : File.join('/images', 'molecules', el&.molecule_svg_file || 'nosvg')
24
24
  end
25
25
 
26
26
  field_sys_reactions = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::SYS_REACTION }
@@ -69,7 +69,7 @@ module Labimotion
69
69
 
70
70
  case obj
71
71
  when Labimotion::Prop::MOLECULE
72
- sub_value[col_id]['value']['el_svg'] = File.join('/images', 'molecules', find_obj.molecule_svg_file)
72
+ sub_value[col_id]['value']['el_svg'] = File.join('/images', 'molecules', find_obj.molecule_svg_file) if find_obj&.molecule_svg_file&.present?
73
73
  sub_value[col_id]['value']['el_inchikey'] = find_obj.inchikey
74
74
  sub_value[col_id]['value']['el_smiles'] = find_obj.cano_smiles
75
75
  sub_value[col_id]['value']['el_iupac'] = find_obj.iupac_name
@@ -22,7 +22,7 @@ module Labimotion
22
22
 
23
23
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_label'] = el.short_label if field['type'] == Labimotion::FieldType::DRAG_SAMPLE
24
24
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_tip'] = el.short_label if field['type'] == Labimotion::FieldType::DRAG_SAMPLE
25
- object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_svg'] = field['type'] == Labimotion::FieldType::DRAG_SAMPLE ? el.get_svg_path : File.join('/images', 'molecules', el.molecule_svg_file)
25
+ object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_svg'] = field['type'] == Labimotion::FieldType::DRAG_SAMPLE ? el.get_svg_path : File.join('/images', 'molecules', el&.molecule_svg_file || 'nosvg')
26
26
  end
27
27
 
28
28
  field_tables = object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::TABLE }
@@ -40,7 +40,7 @@ module Labimotion
40
40
  find_mol = Molecule.find_by(id: sub_value[col_id]['value']['el_id'])
41
41
  next unless find_mol.present?
42
42
 
43
- sub_value[col_id]['value']['el_svg'] = File.join('/images', 'molecules', find_mol.molecule_svg_file)
43
+ sub_value[col_id]['value']['el_svg'] = File.join('/images', 'molecules', find_mol.molecule_svg_file) if find_mol&.molecule_svg_file&.present?
44
44
  sub_value[col_id]['value']['el_inchikey'] = find_mol.inchikey
45
45
  sub_value[col_id]['value']['el_smiles'] = find_mol.cano_smiles
46
46
  sub_value[col_id]['value']['el_iupac'] = find_mol.iupac_name
@@ -107,9 +107,9 @@ module Labimotion
107
107
  attributes['updated_by'] = current_user.id
108
108
  attributes['sync_by'] = current_user.id
109
109
  attributes['sync_time'] = DateTime.now
110
- attr_klass = response.dig('element_klass', {}) # response['element_klass']
110
+ attr_klass = response['element_klass'] ## response.dig('element_klass', {}) # response['element_klass']
111
111
  validate_klass(attributes, attr_klass)
112
-
112
+
113
113
  rescue StandardError => e
114
114
  Labimotion.log_exception(e, current_user)
115
115
  raise e
@@ -97,7 +97,10 @@ module Labimotion
97
97
  type = "#{field['type']}-#{field['option_layers']}" if field['type'] == Labimotion::FieldType::SELECT || field['type'] == Labimotion::FieldType::SYSTEM_DEFINED
98
98
 
99
99
  show_value = field['value'] =~ /\A\d+,\d+\z/ ? field['value']&.gsub(',', '.') : field['value']
100
- sheet.add_row([' ', field['label'], nil, field['value_system'], field['field'], type, from_device, field['dkey'], nil].freeze)
100
+ ols_short_form = (field['ontology'] && field['ontology']['short_form']) || ''
101
+ ols_label = (field['ontology'] && field['ontology']['label']) || ''
102
+ ols_iri = (field['ontology'] && field['ontology']['iri']) || ''
103
+ sheet.add_row([' ', field['label'], nil, field['value_system'], field['field'], type, from_device, field['dkey'], nil, ols_short_form, ols_label, ols_iri].freeze)
101
104
 
102
105
  case field['type']
103
106
  when Labimotion::FieldType::SELECT
@@ -166,7 +169,7 @@ module Labimotion
166
169
  end
167
170
 
168
171
  def header
169
- ['Layer Label', 'Field Label', 'Value', 'Unit', 'Name', 'Type', 'Source?', 'Source identifier', 'Source data'].freeze
172
+ ['Layer Label', 'Field Label', 'Value', 'Unit', 'Name', 'Type', 'Source?', 'Source identifier', 'Source data', 'Ontology', 'Ontology Label', 'iri'].freeze
170
173
  end
171
174
 
172
175
  def read
@@ -24,7 +24,7 @@ module Labimotion
24
24
  value['el_id'] = molecule.id
25
25
  value['el_tip'] = "#{molecule.inchikey}@@#{molecule.cano_smiles}"
26
26
  value['el_label'] = molecule.iupac_name
27
- value['el_svg'] = File.join('/images', 'molecules', molecule.molecule_svg_file)
27
+ value['el_svg'] = File.join('/images', 'molecules', molecule&.molecule_svg_file) if molecule&.molecule_svg_file.present?
28
28
  value['el_inchikey'] = molecule.inchikey
29
29
  value['el_smiles'] = molecule.cano_smiles
30
30
  value['el_type'] = 'molecule' if value['el_type'].nil?
@@ -13,7 +13,7 @@ module Labimotion
13
13
 
14
14
  case obj
15
15
  when Labimotion::Prop::MOLECULE
16
- sub_value[col_id]['value']['el_svg'] = File.join('/images', 'molecules', find_obj.molecule_svg_file)
16
+ sub_value[col_id]['value']['el_svg'] = File.join('/images', 'molecules', find_obj.molecule_svg_file) if find_obj&.molecule_svg_file&.present?
17
17
  sub_value[col_id]['value']['el_inchikey'] = find_obj.inchikey
18
18
  sub_value[col_id]['value']['el_smiles'] = find_obj.cano_smiles
19
19
  sub_value[col_id]['value']['el_iupac'] = find_obj.iupac_name
@@ -56,7 +56,7 @@ module Labimotion
56
56
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_tip'] = el.short_label if %w[drag_sample].include?(field['type'])
57
57
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_tip'] = "#{el.element_klass&.label}@@#{el.name}" if %w[drag_element].include?(field['type'])
58
58
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['icon_name'] = el.element_klass&.icon_name || '' if %w[drag_element].include?(field['type'])
59
- object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_svg'] = field['type'] == Labimotion::FieldType::DRAG_SAMPLE ? el.get_svg_path : File.join('/images', 'molecules', el.molecule_svg_file) if Labimotion::FieldType::DRAG_MS.include?(field['type'])
59
+ object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_svg'] = field['type'] == Labimotion::FieldType::DRAG_SAMPLE ? el.get_svg_path : File.join('/images', 'molecules', el&.molecule_svg_file || 'nosvg') if Labimotion::FieldType::DRAG_MS.include?(field['type'])
60
60
  object.properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value']['el_decoupled'] = el.decoupled if %w[drag_sample].include?(field['type'])
61
61
  end
62
62
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '1.4.0.rc2'
5
+ VERSION = '1.4.0.rc4'
6
6
  end
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.rc2
4
+ version: 1.4.0.rc4
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-05-29 00:00:00.000000000 Z
12
+ date: 2024-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails