glycobook 0.1.0.alpha.19-java → 0.1.0.alpha.21-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: 3f52e13a1a5a36f8775acb3a30c2aa5b82eae52372a4e3c2c0b18bf76512cc65
4
- data.tar.gz: fc3899188446b9e7a0243da35e6f5bdb38a1e6cfa66deff65910a91334ead78c
3
+ metadata.gz: 3a227432de6774f55812c86238f8d902f4828eabb6b6b43492df5039e19f0817
4
+ data.tar.gz: 1b78af14d379b5761825836a9c3a55ef6e51e21261982226101aa16746b8da63
5
5
  SHA512:
6
- metadata.gz: cace03b87e531f747e524dcb286c07ef56be6ca2939c0884a03f21f020cae51aff543cbeda7a91cc1e1222d9c3891710ef70452860b2a31b1ccc7b4529bf2d22
7
- data.tar.gz: 62c70f81326e3fe530a44f4492cc3cffedbc93551b11098197d6aa99b186c98adfd9cee7b8f36229bac1e99b8be2ede2a7c03f857ed4040e758744cb96d9235a
6
+ metadata.gz: 1a2321e9a25ff82ed4b05b863d615a89666e17baf4c71c4316be00694c5008c7f12ddddec8621a0ab469ec7dda8e0f73d063e54c225b6587fd6c17a74c26edec
7
+ data.tar.gz: baed8895eda5734856a734bc84cbe53703c8639ddf25f985ee4b734b71f968eea4e9a1c01192ee33fe8b6f4d8083a746d405b7d35c954e9c6a794f3e28146e1f
data/jar.yml CHANGED
@@ -1,24 +1,79 @@
1
1
  ---
2
- list:
3
- - url: "https://repo1.maven.org/maven2/org/apache/xmlgraphics/batik-all/1.16/batik-all-1.16.jar"
2
+ libraries:
3
+ - name: batik-all
4
+ info: "https://xmlgraphics.apache.org/batik/download.html"
5
+ version: 1.16
6
+ url: "https://repo1.maven.org/maven2/org/apache/xmlgraphics/batik-all/1.16/batik-all-1.16.jar"
4
7
  file: "jar/batik-all.jar"
5
- - url: "https://raw.githubusercontent.com/glycoinfo/MavenRepository/master/org/eurocarbdb/glycanbuilder/glycanbuilder2/1.23.1/glycanbuilder2-1.23.1.jar"
8
+
9
+ - name: glycanbuilder2
10
+ info: "https://gitlab.com/glycoinfo/glycanbuilder2"
11
+ version: 1.23.1
12
+ url: "https://raw.githubusercontent.com/glycoinfo/MavenRepository/master/org/eurocarbdb/glycanbuilder/glycanbuilder2/1.23.1/glycanbuilder2-1.23.1.jar"
6
13
  file: "jar/glycanbuilder2.jar"
7
- - url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/87428121/download"
14
+
15
+ - name: wurcsframework
16
+ info: "https://gitlab.com/glycoinfo/wurcsframework"
17
+ version: 1.2.14
18
+ url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/87428121/download"
8
19
  file: "jar/wurcsframework.jar"
9
- - url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/87428121/download"
20
+
21
+ - name: wurcsframework-1.2.14
22
+ info: "https://gitlab.com/glycoinfo/wurcsframework"
23
+ version: 1.2.14
24
+ url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/87428121/download"
10
25
  file: "jar/wurcsframework-1.2.14.jar"
11
- - url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/70458150/download"
26
+
27
+ - name: wurcsframework-1.0.1
28
+ info: "https://gitlab.com/glycoinfo/wurcsframework"
29
+ version: 1.0.1
30
+ url: "https://gitlab.com/glycoinfo/wurcsframework/-/package_files/70458150/download"
12
31
  file: "jar/wurcsframework-1.0.1.jar"
13
- - url: "https://repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar"
32
+
33
+ - name: slf4j-api
34
+ info: "https://www.slf4j.org/index.html"
35
+ version: 2.0.9
36
+ url: https://repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar
14
37
  file: "jar/slf4j-api.jar"
15
- - url: "https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/2.0.9/slf4j-simple-2.0.9.jar"
38
+
39
+ - name: slf4j-simple
40
+ info: "https://www.slf4j.org/index.html"
41
+ version: 2.0.9
42
+ url: "https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/2.0.9/slf4j-simple-2.0.9.jar"
16
43
  file: "jar/slf4j-simple.jar"
17
- - url: "https://gitlab.glyco.info/glycosmos/subsumption/subsumption/-/package_files/567/download"
44
+
45
+ - name: subsumption
46
+ info: "https://gitlab.glyco.info/glycosmos/subsumption/subsumption"
47
+ version: 0.9.6
48
+ url: "https://gitlab.glyco.info/glycosmos/subsumption/subsumption/-/package_files/590/download"
18
49
  file: "jar/subsumption.jar"
19
- - url: "https://gitlab.glyco.info/glycosmos/glytoucangroup/archetype/lib/-/package_files/489/download"
50
+
51
+ - name: archetype
52
+ info: "https://gitlab.glyco.info/glycosmos/glytoucangroup/archetype/lib"
53
+ version: 0.1.4
54
+ url: "https://gitlab.glyco.info/glycosmos/glytoucangroup/archetype/lib/-/package_files/489/download"
20
55
  file: "jar/archetype.jar"
21
- - url: "https://gitlab.com/glycoinfo/glycanformatconverter/-/package_files/81149971/download"
56
+
57
+ - name: glycanformatconverter
58
+ info: "https://gitlab.com/glycoinfo/glycanformatconverter"
59
+ version: 2.10.0
60
+ url: "https://gitlab.com/glycoinfo/glycanformatconverter/-/package_files/81149971/download"
22
61
  file: "jar/glycanformatconverter.jar"
23
- - url: "https://raw.githubusercontent.com/glycoinfo/MavenRepository/master/org/eurocarbdb/MolecularFramework/1.0.0/MolecularFramework-1.0.0.jar"
62
+
63
+ - name: MolecularFramework
64
+ info: "https://github.com/glycoinfo/MolecularFramework"
65
+ version: 1.0.0
66
+ url: "https://raw.githubusercontent.com/glycoinfo/MavenRepository/master/org/eurocarbdb/MolecularFramework/1.0.0/MolecularFramework-1.0.0.jar"
24
67
  file: "jar/MolecularFramework.jar"
68
+
69
+ - name: The Chemistry Development Kit
70
+ info: https://github.com/cdk/cdk
71
+ version: 2.9
72
+ url: https://github.com/cdk/cdk/releases/download/cdk-2.9/cdk-2.9.jar
73
+ file: jar/cdk.jar
74
+
75
+ - name: MolWURCS
76
+ info: https://gitlab.com/glycoinfo/molwurcs
77
+ version: 0.10.2
78
+ url: https://gitlab.com/glycoinfo/molwurcs/-/package_files/89942780/download
79
+ file: jar/MolWURCS.jar
data/lib/bookinit.rb CHANGED
@@ -36,35 +36,49 @@ Would you like to resolve Java dependencies?(No/yes)
36
36
  end
37
37
 
38
38
 
39
- # YAMLファイルからdownloads情報をロード
40
- downloads = load_settings(ENV['HOME'] + "/.glycobook/jar.yml")
41
-
42
- require 'open-uri'
39
+ # YAMLファイルからdownloads情報をロード
40
+ downloads = load_settings(ENV['HOME'] + "/.glycobook/jar.yml")
43
41
 
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["list"].each do |download|
42
+ require 'open-uri'
53
43
 
54
- uri = URI(download["url"])
55
- response = Net::HTTP.get_response(uri)
56
- if response.is_a?(Net::HTTPSuccess)
57
- begin
58
- File.open(File.dirname(__FILE__)+"/"+download["file"], 'wb') do |file|
59
- file.write(response.body)
60
- puts "Installed " + download["file"]
61
- end
62
- rescue StandardError => e
63
- puts "Failed to save file: #{download["file"]}. Error: #{e.message}"
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)
64
+ http = Net::HTTP.new(url.host, url.port)
65
+ http.use_ssl = (url.scheme == 'https')
66
+ request = Net::HTTP::Get.new(url.request_uri)
67
+ 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"]
64
75
  end
65
- else
66
- puts "Failed to download file: #{download["file"]}"
76
+ rescue StandardError => e
77
+ puts "Failed to save file: #{download["file"]}. Error: #{e.message}"
67
78
  end
79
+ else
80
+ puts "Failed to download file: #{download["file"]}"
81
+ end
68
82
 
69
83
  end
70
84
  end
@@ -0,0 +1,56 @@
1
+ require "java"
2
+
3
+ require_relative '../jar/cdk.jar'
4
+ require_relative '../jar/MolWURCS.jar'
5
+
6
+ java_import 'org.glycoinfo.MolWURCS.io.formats.ChemFormatType'
7
+ java_import 'org.openscience.cdk.exception.CDKException'
8
+ java_import 'org.openscience.cdk.interfaces.IAtomContainerSet'
9
+ java_import 'org.openscience.cdk.io.IChemObjectWriter'
10
+ java_import 'org.openscience.cdk.io.ISimpleChemObjectReader'
11
+ java_import 'org.openscience.cdk.silent.AtomContainerSet'
12
+ java_import 'java.io.StringReader'
13
+ java_import 'java.nio.file.Files'
14
+ java_import 'java.nio.file.Paths'
15
+ java_import 'java.io.IOException'
16
+ java_import 'java.lang.System'
17
+ java_import 'java.util.ArrayList'
18
+
19
+ module GlycoBook
20
+ class MolWURCS
21
+
22
+ def wurcs2mdlmol(w)
23
+
24
+ begin
25
+ reader = ChemFormatType::WURCS.createReader
26
+ reader.setReader(StringReader.new(w))
27
+ return unless reader.accepts(AtomContainerSet.java_class)
28
+ mols = AtomContainerSet.new
29
+ mols = reader.read(mols)
30
+ reader.close
31
+ rescue CDKException, IOException => e
32
+ e.printStackTrace()
33
+ end
34
+
35
+ return if mols.nil?
36
+
37
+ # write mol
38
+ string_writer = java.io.StringWriter.new
39
+
40
+ begin
41
+ writer = org.openscience.cdk.io.SDFWriter.new(string_writer)
42
+ if writer.accepts(mols.java_class)
43
+ writer.write(mols)
44
+ elsif writer.accepts(mols.get_atom_container(0).java_class)
45
+ writer.write(mols.get_atom_container(0))
46
+ end
47
+ writer.close
48
+ rescue Java::OrgOpenscienceCdkException::CDKException, Java::JavaIo::IOException => e
49
+ e.printStackTrace()
50
+ end
51
+
52
+ return string_writer.to_s
53
+ end
54
+
55
+ end
56
+ end
data/lib/glycobook.rb CHANGED
@@ -7,6 +7,7 @@ require 'glycobook/glycan_format_converter'
7
7
  require 'glycobook/gly_tou_can'
8
8
  require 'glycobook/subsumption'
9
9
  require 'glycobook/wurcs_frame_work'
10
+ require 'glycobook/mol_wurcs'
10
11
  require 'open-uri'
11
12
  require 'net/http'
12
13
  require 'fileutils'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glycobook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.alpha.19
4
+ version: 0.1.0.alpha.21
5
5
  platform: java
6
6
  authors:
7
7
  - Akihiro Fujita
@@ -38,6 +38,7 @@ files:
38
38
  - lib/glycobook/gly_tou_can.rb
39
39
  - lib/glycobook/glycan_builder.rb
40
40
  - lib/glycobook/glycan_format_converter.rb
41
+ - lib/glycobook/mol_wurcs.rb
41
42
  - lib/glycobook/subsumption.rb
42
43
  - lib/glycobook/wurcs_frame_work.rb
43
44
  - lib/wurcsverify.rb
@@ -63,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
64
  - !ruby/object:Gem::Version
64
65
  version: 1.3.1
65
66
  requirements: []
66
- rubygems_version: 3.2.33
67
+ rubygems_version: 3.3.26
67
68
  signing_key:
68
69
  specification_version: 4
69
70
  summary: Glycobook is a JRuby library for glycaninformatics