glydevkit 0.1-java → 0.2.beta.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f35fa57e6677d427e287dd2a019ab2894b6a6d65671c065f5457eebfd7eb8d28
4
- data.tar.gz: dc0234344840c9d9970a9b9c90ec595982536252bd486dd6abc338ab8c20dddf
3
+ metadata.gz: c912a7e2a35037df8e3878dbd2afaaa8647034457ee4569ce84a8e78b1c6b3d8
4
+ data.tar.gz: f87718ac5617735afe4d38026cc66ebcf23bbd15d41b718515d15b248800a088
5
5
  SHA512:
6
- metadata.gz: 179c8854710c3459b13259e026c2a49e06a7b67ed0649ec38ac9e3e111e73aa59b8cab39646df21dcd44d714ef810c80a961e740e0e406ff2e4b146e57b065ec
7
- data.tar.gz: 8af420af02a32a1c1dc32de58fba405efe972150876eec903f2849c30bb6d65c4dccc2950e400d86a6ec1dd16f2a69e9c2a3241019b45931c3a62056f0930ab3
6
+ metadata.gz: aab88ca9b8ca7c18ff72c342ffa66ddb5649a76bba36c81de8d07f4b2654a9435c0d00b694620a365ad685b8e18670db4e470da5f3cab45599d1a5f1ab70e649
7
+ data.tar.gz: 4e44ccc0ebb190851a9e577d7cda0ac458821320df6c2d15f1675fe279bed673f7daa730ac4a06fa4e0e134a20f816f194c34795b73f4c376a4e530be9f1f3d3
data/jar.yml CHANGED
@@ -14,8 +14,8 @@ libraries:
14
14
 
15
15
  - name: wurcsframework
16
16
  info: "https://gitlab.com/glycoinfo/wurcsframework"
17
- version: 1.2.14
18
- url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/87428121/download"
17
+ version: 1.3.1
18
+ url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/127116856/download"
19
19
  file: "jar/wurcsframework.jar"
20
20
 
21
21
  - name: wurcsframework-1.2.14
@@ -7,70 +7,85 @@ module GlyDevKit
7
7
  require_relative '../jar/wurcsframework.jar'
8
8
  java_import 'org.glycoinfo.WURCSFramework.util.validation.WURCSValidator'
9
9
 
10
- def validator(w)
10
+ def validator(w,maxbranch)
11
11
  validator = WURCSValidator.new
12
+ validator.setMaxBranchCount(maxbranch)
12
13
  validator.start(w)
13
- reports = {}
14
- reports["VALIDATOR"] = ["WURCSFramework-1.2.14"]
15
- reports["WARNING"] = validator.getReport().hasWarning()
16
- reports["ERROR"] = validator.getReport().hasError()
17
- reports["UNVERIFIABLE"] = validator.getReport().hasUnverifiable()
18
- return {"message" => reports,
19
- "StandardWURCS" => validator.getReport().standard_string(),
20
- "RESULTS" => validator.getReport().getResults() }
14
+ report = validator.getReport()
15
+
16
+ {
17
+ "message" => {
18
+ "VALIDATOR" => ["WURCSFramework-1.2.14"],
19
+ "WARNING" => report.hasWarning(),
20
+ "ERROR" => report.hasError(),
21
+ "UNVERIFIABLE" => report.hasUnverifiable()
22
+ },
23
+ "StandardWURCS" => report.standard_string(),
24
+ "RESULTS" => report.getResults()
25
+ }
21
26
  end
22
27
 
23
28
  def to_graph(w)
24
- g = nil
25
29
  wgn = WURCSGraphNormalizer.new
26
30
  begin
27
31
  factory = WURCSFactory.new(w)
28
- g = factory.getGraph
29
- wgn.start(g)
32
+ graph = factory.getGraph
33
+ wgn.start(graph)
34
+ graph
30
35
  rescue WURCSException => e
31
36
  e.printStackTrace
37
+ nil
32
38
  end
33
- return g
34
39
  end
35
40
 
36
41
  def get_anomeric_status(a_o_backbone)
37
42
  a_o_backbone.get_backbone_carbons.each do |t_o_bc|
38
- return "archetype_anomer" if t_o_bc.get_descriptor.get_char.chr == 'u'
39
- return "archetype_anomer" if t_o_bc.get_descriptor.get_char.chr == 'U'
43
+ return "archetype_anomer" if %w[u U].include?(t_o_bc.get_descriptor.get_char.chr)
44
+ end
45
+
46
+ case a_o_backbone.get_anomeric_symbol.chr
47
+ when 'x'
48
+ "anomer_unknown"
49
+ when 'a'
50
+ "anomer_alpha"
51
+ when 'b'
52
+ "anomer_beta"
53
+ else
54
+ a_o_backbone.get_anomeric_position != 0 ? "openchain" : nil
40
55
  end
41
- return "anomer_unknown" if a_o_backbone.get_anomeric_symbol.chr == 'x'
42
- return "anomer_alpha" if a_o_backbone.get_anomeric_symbol.chr == 'a'
43
- return "anomer_beta" if a_o_backbone.get_anomeric_symbol.chr == 'b'
44
- return "openchain" if a_o_backbone.get_anomeric_position != 0
45
- return nil
46
56
  end
47
57
 
48
58
  def get_ring_type(a_o_backbone)
49
59
  a_o_backbone.get_backbone_carbons.each do |t_o_bc|
50
- return "archetype_ringtype" if t_o_bc.get_descriptor.get_char.chr == 'u'
51
- return "archetype_ringtype" if t_o_bc.get_descriptor.get_char.chr == 'U'
60
+ return "archetype_ringtype" if %w[u U].include?(t_o_bc.get_descriptor.get_char.chr)
52
61
  end
53
- for edge in a_o_backbone.get_edges
54
- if edge.is_anomeric && edge.get_modification.is_ring
55
- ring_start = edge.get_linkages[0].get_backbone_position
56
- ring_end = edge.get_modification.get_edges[1].get_linkages[0].get_backbone_position
57
- if (ring_end - ring_start) == 6
58
- return "octanose"
59
- elsif (ring_end - ring_start) == 5
60
- return "septanose"
61
- elsif (ring_end - ring_start) == 4
62
- return "pyranose"
63
- elsif (ring_end - ring_start) == 3
64
- return "furanose"
65
- elsif (ring_end - ring_start) == 2
66
- return "oxetose"
67
- elsif (ring_end - ring_start) == 1
68
- return "oxirose"
69
- end
70
- end
62
+
63
+ a_o_backbone.get_edges.each do |edge|
64
+ next unless edge.is_anomeric && edge.get_modification.is_ring
65
+
66
+ ring_start = edge.get_linkages[0].get_backbone_position
67
+ ring_end = edge.get_modification.get_edges[1].get_linkages[0].get_backbone_position
68
+ ring_size = ring_end - ring_start
69
+
70
+ return case ring_size
71
+ when 6 then "octanose"
72
+ when 5 then "septanose"
73
+ when 4 then "pyranose"
74
+ when 3 then "furanose"
75
+ when 2 then "oxetose"
76
+ when 1 then "oxirose"
77
+ end
71
78
  end
72
- return nil
79
+ nil
73
80
  end
74
81
 
82
+ def getWURCSMass(w)
83
+ importer = WURCSImporter.new
84
+ wurcs_array = importer.extractWURCSArray(w)
85
+ WURCSMassCalculator.calcMassWURCS(wurcs_array)
86
+ rescue WURCSException, WURCSMassException, StandardError => e
87
+ e.printStackTrace
88
+ nil
89
+ end
75
90
  end
76
91
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glydevkit
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.2.beta.1
5
5
  platform: java
6
6
  authors:
7
7
  - Akihiro Fujita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-07 00:00:00.000000000 Z
11
+ date: 2024-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement