glycobook 0.1.0.alpha.24-java → 0.1.0.alpha.26-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: c57696fa2ad8b032a46281386ea028f2640043f9ee43fe1b4c6f08e225382ecf
4
- data.tar.gz: 43ed043caab23d4f79af74c595e4c7d86ea91c233c3b3ec5231ce40ae3810e3a
3
+ metadata.gz: 85778515c6bb06cddc7c8a4585ba7b8221e5f0c128b52182c8da8892979ccd09
4
+ data.tar.gz: fb5da58cc677ab39d7c2fec3f0951513a07e2482862c502dcd9245deae87383e
5
5
  SHA512:
6
- metadata.gz: 01a1b387ace6b56ef15b38c2d2ae87bf8dcfa32a1cfc20793a9108dd0f64cc055113a73c73af3fb23533614cf5a94bbcf4af91db76e11f8be9e37b48498a26df
7
- data.tar.gz: 02be25d4e3a1f3d1535a5e2db614316cd2454a77ba51b800ad86b5ee6b1ca3609e18fba9e161d102bb1265bc1594ca296e550d7f226838f56e2e9b2562504389
6
+ metadata.gz: 522239fa63aa56f53ad882acc1936c4ac4ac17731a043e95ae8a6e9bdd36c41c4bd3a3b4a8fd6855311ef3853af34370320c509a4c4f1f6c9bca351e6485bac8
7
+ data.tar.gz: 913af58afa9769074e7a2478c03a9317edbaa4712a136bf300d5a4e17bea3d8c9574c38266f169753eab2def76e72b39a04369dbdc0d3e81cfff940439772549
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"
@@ -44,8 +44,8 @@ libraries:
44
44
 
45
45
  - name: subsumption
46
46
  info: "https://gitlab.glyco.info/glycosmos/subsumption/subsumption"
47
- version: 0.9.9
48
- url: "https://gitlab.glyco.info/glycosmos/subsumption/subsumption/-/package_files/647/download"
47
+ version: 0.10.0
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
@@ -14,17 +14,20 @@ java_import 'org.openscience.cdk.io.SDFWriter'
14
14
  java_import 'org.openscience.cdk.smiles.SmiFlavor'
15
15
  java_import 'org.openscience.cdk.smiles.SmilesGenerator'
16
16
  java_import 'org.openscience.cdk.silent.SilentChemObjectBuilder'
17
- java_import 'java.io.StringReader'
18
17
  java_import 'java.nio.file.Files'
19
18
  java_import 'java.nio.file.Paths'
20
- java_import 'java.io.IOException'
21
19
  java_import 'java.lang.System'
22
20
  java_import 'java.util.ArrayList'
23
21
  java_import 'java.io.StringWriter'
22
+ java_import 'java.io.IOException'
23
+ java_import 'java.io.StringReader'
24
24
 
25
25
  module GlycoBook
26
- class MolWURCS
27
- def wurcs2mol(w, format)
26
+ class MolWURCS
27
+ # @param [String] w String of WURCS
28
+ # @param [String] format: smiles or sdf
29
+ # @return [String] string with specified molecular descriptor
30
+ def wurcs2mol(w,format)
28
31
  mols = read_wurcs(w)
29
32
  return {"flag": false,"wurcs": w, "message": "WURCS strings that could not be parsed to the atomic level"} if mols.nil?
30
33
 
@@ -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
@@ -12,7 +12,7 @@ java_import 'org.slf4j.Logger'
12
12
  class WurcsVerify
13
13
  def initialize
14
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")
15
+ @wfw_101_loader = self.create_custom_classloader("jar/wurcsframework-1.3.1.jar")
16
16
  @validator_latest = java.lang.Class.forName("org.glycoinfo.WURCSFramework.util.validation.WURCSValidator",true,@wfw_latest_loader)
17
17
  @validator_101 = java.lang.Class.forName("org.glycoinfo.WURCSFramework.util.validation.WURCSValidator", true, @wfw_101_loader)
18
18
  end
@@ -31,7 +31,7 @@ class WurcsVerify
31
31
  v_101.start(w)
32
32
 
33
33
  ret = {"1.2.14" => self.dovalidator(v_latest),
34
- "1.0.1" => self.dovalidator101(v_101) }
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.24
4
+ version: 0.1.0.alpha.26
5
5
  platform: java
6
6
  authors:
7
7
  - Akihiro Fujita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-04 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
@@ -17,8 +17,8 @@ dependencies:
17
17
  - !ruby/object:Gem::Version
18
18
  version: 0.0.2
19
19
  name: java
20
- type: :runtime
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
@@ -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
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  - !ruby/object:Gem::Version
65
65
  version: 1.3.1
66
66
  requirements: []
67
- rubygems_version: 3.4.22
67
+ rubygems_version: 3.3.26
68
68
  signing_key:
69
69
  specification_version: 4
70
70
  summary: Glycobook is a JRuby library for glycaninformatics