glycobook 0.1.0.alpha.20-java → 0.1.0.alpha.22-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: cf73eb48398f2b1359df183b08e7ad87869c6f8ff7a97c8e87c6eb86f3b8f720
4
- data.tar.gz: f9e01c7b3d2c8af82fe1925a89a2494aa4e0b7098ebbef37be92b500da566db2
3
+ metadata.gz: c30b663e17567babecd2deaee54be71f43e7fc30452bff1dbbd751156a5e07fb
4
+ data.tar.gz: 9e1c862ce6ff0b91391338d4b42953ea2e53b05265550b4bccb4b1449d8bd3d0
5
5
  SHA512:
6
- metadata.gz: d9e8dbf170eeb0df48cb588ef81d4ed4795e3aeb88d045c7b61016ddd30c5ae357ec8b531aa2a31cee35776948bf1e2d3f1face3239f72963602bd6bc396df07
7
- data.tar.gz: 318bbb162bb4b9969db462ad4d71cc7e5ec1bbba0ecb3447cfee6aa49590ff9416a3dc9f68567d0ef9918270ea0e885a5698c2f1cf82c239805093b703d3c9c4
6
+ metadata.gz: e156bf8df3954c0f29a926fe00ee122ba4ef8e3eda04fe7d9d02f624abd6b6abefd2faef729de5ad8f037ba09356a9b84fcb63c358ed3637cfd0c488cb7bd18d
7
+ data.tar.gz: 9a873652978c7c9bca1dcd975ad7afb6fd4f87d913973f860e46eb4499bac1dd3756cca68ccd9205210359b60d72e34daac383c7fbaae5594ebdebef5553efa8
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/590/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,81 @@
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 'org.openscience.cdk.DefaultChemObjectBuilder'
13
+ java_import 'org.openscience.cdk.io.SDFWriter'
14
+ java_import 'org.openscience.cdk.smiles.SmilesGenerator'
15
+ java_import 'org.openscience.cdk.silent.SilentChemObjectBuilder'
16
+ java_import 'java.io.StringReader'
17
+ java_import 'java.nio.file.Files'
18
+ java_import 'java.nio.file.Paths'
19
+ java_import 'java.io.IOException'
20
+ java_import 'java.lang.System'
21
+ java_import 'java.util.ArrayList'
22
+ java_import 'java.io.StringWriter'
23
+
24
+ module GlycoBook
25
+ class MolWURCS
26
+
27
+ def wurcs2mol(w,format)
28
+
29
+ begin
30
+ reader = ChemFormatType::WURCS.createReader
31
+ reader.setReader(StringReader.new(w))
32
+ return unless reader.accepts(AtomContainerSet.java_class)
33
+ mols = AtomContainerSet.new
34
+ mols = reader.read(mols)
35
+ reader.close
36
+ rescue CDKException, IOException => e
37
+ e.printStackTrace()
38
+ end
39
+
40
+ return if mols.nil?
41
+ if format == "sdf"
42
+ # write mol
43
+ string_writer = java.io.StringWriter.new
44
+
45
+ begin
46
+ writer = org.openscience.cdk.io.SDFWriter.new(string_writer)
47
+ if writer.accepts(mols.java_class)
48
+ writer.write(mols)
49
+ elsif writer.accepts(mols.get_atom_container(0).java_class)
50
+ writer.write(mols.get_atom_container(0))
51
+ end
52
+ writer.close
53
+ rescue Java::OrgOpenscienceCdkException::CDKException, Java::JavaIo::IOException => e
54
+ e.printStackTrace()
55
+ end
56
+
57
+ return string_writer.to_s
58
+
59
+ elsif format == "smiles"
60
+ # SMILESジェネレータの生成
61
+ smiles_gen = SmilesGenerator.absolute()
62
+
63
+ string_writer = java.io.StringWriter.new
64
+
65
+ begin
66
+ mols.atomContainers.each do |mol|
67
+ # 各分子に対してSMILES表現の生成
68
+ smiles = smiles_gen.createSMILES(mol)
69
+ string_writer.write(smiles + "\n")
70
+ end
71
+
72
+ # 生成したSMILESの出力
73
+ return string_writer.toString
74
+ rescue Java::OrgOpenscienceCdkException::CDKException, Java::JavaIo::IOException => e
75
+ e.printStackTrace()
76
+ return ""
77
+ end
78
+ end
79
+ end
80
+ end
81
+ 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,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.20
4
+ version: 0.1.0.alpha.22
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-11-20 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -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