glycobook 0.1.0.alpha.25-java → 0.1.0.alpha.27-java

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: b1246f7e09e56a614d5bfc9b3b33001aeb9a95110b53f4a9d9ec980f3e535c6a
4
- data.tar.gz: 564b31e1e4fa5691208b5dcf29b608860e21863e93b4bb9dea75ca78ecabb29a
3
+ metadata.gz: 6272e65de448b555e008b0cf21a3669e8f32a224f655767be5e1a1f1eb3ceeec
4
+ data.tar.gz: b2592c9d2276fe74935a3b7344540af16c97c08137d54129d0e340da0b17fcc3
5
5
  SHA512:
6
- metadata.gz: 20cd26f759a22e602794cfadd066f4a894fbe76c25dd46dafa5f73c52f093d61fb60b8abd4cec514dc6ec037ad363306fcdd8990d6ce654237534aa2b6935938
7
- data.tar.gz: 52dc401adc568e347de39478f6d09207ca3ce68703781cfcc316af9ab28ac6bd35a3715d395b06d91e9eceaafe76fbe7a1a519de0fc8a4c2a2e696849edea9e2
6
+ metadata.gz: e35c8a97d6e542603d803810c03f67a7357fda07f14d8d62fc3d34fc0d0728b30431d39110db5e2dd68383e8f4c756be64821f79bf3160c1e27fd634a9b2d38d
7
+ data.tar.gz: a9bc9acdb39e2c8081e214339c66559f5c8cc14f35e0e3dd542df97342b8a4318e94acc67062d290c19158b59a183efef4b7abbc1357c1cf6155fe8a0831b410
data/jar.yml CHANGED
@@ -24,11 +24,11 @@ libraries:
24
24
  url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/87428121/download"
25
25
  file: "jar/wurcsframework-1.2.14.jar"
26
26
 
27
- - name: wurcsframework-1.0.1
27
+ - name: wurcsframework-1.3.1
28
28
  info: "https://gitlab.com/glycoinfo/wurcsframework"
29
- version: 1.0.1
30
- url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/70458150/download"
31
- file: "jar/wurcsframework-1.0.1.jar"
29
+ version: 1.3.1
30
+ url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/127116856/download"
31
+ file: "jar/wurcsframework-1.3.1.jar"
32
32
 
33
33
  - name: slf4j-api
34
34
  info: "https://www.slf4j.org/index.html"
@@ -45,7 +45,7 @@ libraries:
45
45
  - name: subsumption
46
46
  info: "https://gitlab.glyco.info/glycosmos/subsumption/subsumption"
47
47
  version: 0.10.0
48
- url: "https://gitlab.glyco.info/glycosmos/subsumption/subsumption/-/package_files/729/download"
48
+ url: "https://gitlab.glyco.info/glycosmos/subsumption/subsumption/-/package_files/758/download"
49
49
  file: "jar/subsumption.jar"
50
50
 
51
51
  - name: archetype
data/lib/bookinit.rb CHANGED
@@ -4,18 +4,27 @@ require 'fileutils'
4
4
  require 'yaml'
5
5
 
6
6
  module BookInit
7
+ def self.load_settings(file_path, flag)
8
+ downloads = []
7
9
 
8
- def self.load_settings(file_path)
10
+ unless Dir.exist?(ENV['HOME'] + "/.glycobook")
11
+ Dir.mkdir(ENV['HOME'] + "/.glycobook")
12
+ end
9
13
 
10
- downloads = []
14
+ folder_path = File.dirname(__FILE__) + "/jar"
15
+ unless Dir.exist?(folder_path)
16
+ FileUtils.mkdir_p(folder_path)
17
+ end
11
18
 
12
19
  if File.exist?(file_path)
13
20
  downloads = YAML.load_file(file_path)
14
21
  else
15
- unless Dir.exist?(ENV['HOME'] + "/.glycobook")
16
- Dir.mkdir(ENV['HOME'] + "/.glycobook")
17
- end
18
- FileUtils.mv(File.dirname(File.expand_path(__FILE__)) + "/../jar.yml", file_path)
22
+ FileUtils.cp(File.dirname(File.expand_path(__FILE__)) + "/../jar.yml", file_path)
23
+ end
24
+
25
+ if flag
26
+ FileUtils.cp(File.dirname(File.expand_path(__FILE__)) + "/../jar.yml", file_path)
27
+ downloads = YAML.load_file(file_path)
19
28
  end
20
29
 
21
30
  downloads
@@ -23,63 +32,60 @@ module BookInit
23
32
 
24
33
  def self.run
25
34
  puts <<-EOT
26
-
27
- Would you like to resolve Java dependencies?(No/yes)
35
+ Would you like to resolve Java dependencies? (No/yes)
28
36
  EOT
29
37
 
30
- case gets.chomp
31
- when "yes", "YES", "y"
32
- when "no", "NO", "n"
38
+ case gets.chomp.downcase
39
+ when "yes", "y"
40
+ flag = true
41
+ when "no", "n"
33
42
  exit 1
34
43
  else
44
+ puts "Invalid input. Exiting..."
35
45
  exit 1
36
- end
46
+ end
37
47
 
48
+ puts <<-EOT
49
+ Set recommended Java library version? (No/yes)
50
+ EOT
38
51
 
39
- # YAMLファイルからdownloads情報をロード
40
- downloads = load_settings(ENV['HOME'] + "/.glycobook/jar.yml")
52
+ case gets.chomp.downcase
53
+ when "yes", "y"
54
+ flag = true
55
+ end
41
56
 
42
- require 'open-uri'
57
+ downloads = load_settings(ENV['HOME'] + "/.glycobook/jar.yml", flag)
43
58
 
44
- folder_path = File.dirname(__FILE__)+"/jar"
45
- unless Dir.exist?(folder_path)
46
- FileUtils.mkdir_p(folder_path)
47
- puts "Folder created: #{folder_path}"
48
- else
49
- puts "Folder already exists: #{folder_path}"
50
- end
51
- # ダウンロードを実行する
52
- downloads["libraries"].each do |download|
53
-
54
- url = URI(download["url"])
55
- http = Net::HTTP.new(url.host, url.port)
56
- http.use_ssl = (url.scheme == 'https')
57
-
58
- request = Net::HTTP::Get.new(url.request_uri)
59
- response = http.request(request)
60
-
61
- if response.code.to_i == 302
62
- new_location = response['Location']
63
- url = URI.parse(new_location)
59
+ # ダウンロードを実行する
60
+ downloads["libraries"].each do |download|
61
+ url = URI(download["url"])
64
62
  http = Net::HTTP.new(url.host, url.port)
65
63
  http.use_ssl = (url.scheme == 'https')
64
+
66
65
  request = Net::HTTP::Get.new(url.request_uri)
67
66
  response = http.request(request)
68
- end
69
-
70
- if response.code.to_i == 200
71
- begin
72
- File.open(File.dirname(__FILE__)+"/"+download["file"], 'wb') do |file|
73
- file.write(response.body)
74
- puts "Installed " + download["file"]
75
- end
76
- rescue StandardError => e
77
- puts "Failed to save file: #{download["file"]}. Error: #{e.message}"
67
+
68
+ if response.code.to_i == 302
69
+ new_location = response['Location']
70
+ url = URI.parse(new_location)
71
+ http = Net::HTTP.new(url.host, url.port)
72
+ http.use_ssl = (url.scheme == 'https')
73
+ request = Net::HTTP::Get.new(url.request_uri)
74
+ response = http.request(request)
78
75
  end
79
- else
80
- puts "Failed to download file: #{download["file"]}"
81
- end
82
76
 
77
+ if response.code.to_i == 200
78
+ begin
79
+ File.open(File.dirname(__FILE__) + "/" + download["file"], 'wb') do |file|
80
+ file.write(response.body)
81
+ puts "Installed " + download["file"]
82
+ end
83
+ rescue StandardError => e
84
+ puts "Failed to save file: #{download["file"]}. Error: #{e.message}"
85
+ end
86
+ else
87
+ puts "Failed to download file: #{download["file"]}"
88
+ end
83
89
  end
84
90
  end
85
91
  end
@@ -3,6 +3,7 @@ require 'java'
3
3
  module GlycoBook
4
4
 
5
5
  class WurcsFrameWork
6
+
6
7
  require_relative '../jar/wurcsframework.jar'
7
8
  java_import 'org.glycoinfo.WURCSFramework.util.validation.WURCSValidator'
8
9
 
@@ -18,5 +19,58 @@ module GlycoBook
18
19
  "StandardWURCS" => validator.getReport().standard_string(),
19
20
  "RESULTS" => validator.getReport().getResults() }
20
21
  end
22
+
23
+ def to_graph(w)
24
+ g = nil
25
+ wgn = WURCSGraphNormalizer.new
26
+ begin
27
+ factory = WURCSFactory.new(w)
28
+ g = factory.getGraph
29
+ wgn.start(g)
30
+ rescue WURCSException => e
31
+ e.printStackTrace
32
+ end
33
+ return g
34
+ end
35
+
36
+ def get_anomeric_status(a_o_backbone)
37
+ 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'
40
+ 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
+ end
47
+
48
+ def get_ring_type(a_o_backbone)
49
+ 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'
52
+ 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
71
+ end
72
+ return nil
73
+ end
74
+
21
75
  end
22
76
  end
data/lib/wurcsverify.rb CHANGED
@@ -11,10 +11,10 @@ java_import 'org.slf4j.Logger'
11
11
 
12
12
  class WurcsVerify
13
13
  def initialize
14
- @wfw_latest_loader = self.create_custom_classloader("jar/wurcsframework-1.2.14.jar")
15
- @wfw_101_loader = self.create_custom_classloader("jar/wurcsframework-1.0.1.jar")
16
- @validator_latest = java.lang.Class.forName("org.glycoinfo.WURCSFramework.util.validation.WURCSValidator",true,@wfw_latest_loader)
17
- @validator_101 = java.lang.Class.forName("org.glycoinfo.WURCSFramework.util.validation.WURCSValidator", true, @wfw_101_loader)
14
+ @wfw_glytoucan_loader = self.create_custom_classloader("jar/wurcsframework-1.2.14.jar")
15
+ @wfw_131_loader = self.create_custom_classloader("jar/wurcsframework-1.3.1.jar")
16
+ @validator_glytoucan = java.lang.Class.forName("org.glycoinfo.WURCSFramework.util.validation.WURCSValidator",true,@wfw_glytoucan_loader)
17
+ @validator_131 = java.lang.Class.forName("org.glycoinfo.WURCSFramework.util.validation.WURCSValidator", true, @wfw_131_loader)
18
18
  end
19
19
 
20
20
  def create_custom_classloader(jar_path)
@@ -24,14 +24,14 @@ class WurcsVerify
24
24
  end
25
25
 
26
26
  def validatorVerify(w)
27
- v_latest = @validator_latest.new_instance
28
- v_latest.start(w)
27
+ v_glytoucan = @validator_glytoucan.new_instance
28
+ v_glytoucan.start(w)
29
29
 
30
- v_101 = @validator_101.new_instance
31
- v_101.start(w)
30
+ v_131 = @validator_131.new_instance
31
+ v_131.start(w)
32
32
 
33
- ret = {"1.2.14" => self.dovalidator(v_latest),
34
- "1.0.1" => self.dovalidator101(v_101) }
33
+ ret = {"1.2.14" => self.dovalidator(v_glytoucan),
34
+ "1.3.1" => self.dovalidator131(v_131) }
35
35
  return ret
36
36
  end
37
37
 
@@ -44,8 +44,8 @@ class WurcsVerify
44
44
  "StandardWURCS" => validator.getReport().standard_string(),
45
45
  "RESULTS" => validator.getReport().getResults() }
46
46
  end
47
- def dovalidator101(validator)
48
- reports = { "VALIDATOR" => ["WURCSFramework-1.0.1"],
47
+ def dovalidator131(validator)
48
+ reports = { "VALIDATOR" => ["WURCSFramework-1.3.1"],
49
49
  "WARNING" => validator.getReport().hasWarning(),
50
50
  "ERROR" => validator.getReport().hasError(),
51
51
  "UNVERIFIABLE" => false }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glycobook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.alpha.25
4
+ version: 0.1.0.alpha.27
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-04-30 00:00:00.000000000 Z
11
+ date: 2024-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -44,7 +44,7 @@ files:
44
44
  - lib/wurcsverify.rb
45
45
  homepage: https://github.com/akihirof0005/glycobook/blob/main/README.md
46
46
  licenses:
47
- - LGPL-3.0
47
+ - LGPL-3.0-only
48
48
  metadata:
49
49
  source_code_uri: https://github.com/akihirof0005/glycobook
50
50
  homepage_uri: https://github.com/akihirof0005/glycobook/blob/main/README.md