rcdk 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +18 -9
- data/Rakefile +9 -3
- data/java/lib/opsin-big-0.1.0.jar +0 -0
- data/lib/rcdk.rb +13 -11
- data/lib/rcdk/java.rb +87 -0
- data/lib/{util.rb → rcdk/util.rb} +81 -24
- data/test/test.rb +32 -14
- metadata +15 -10
- data/lib/java.rb +0 -69
data/README
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
=RCDK - The Ruby Interface for the Chemistry Development Kit (CDK)
|
2
2
|
|
3
|
-
RCDK makes it possible to use the
|
4
|
-
|
3
|
+
RCDK makes it possible to use the Chemistry Development Kit (CDK)
|
4
|
+
from Ruby. CDK is a Java library for chemical informatics.
|
5
5
|
|
6
6
|
==Typical Usage
|
7
7
|
|
8
8
|
require 'rubygems'
|
9
9
|
require_gem 'rcdk'
|
10
|
-
require 'util'
|
10
|
+
require 'rcdk/util'
|
11
11
|
|
12
|
-
mol = RCDK::Util::Lang.read_smiles
|
12
|
+
mol = RCDK::Util::Lang.read_smiles 'c1ccccc1'
|
13
13
|
|
14
14
|
puts mol.getAtomCount # =>6
|
15
15
|
|
@@ -23,7 +23,8 @@ http://rubyforge.org/projects/rcdk
|
|
23
23
|
==Requirements
|
24
24
|
|
25
25
|
RCDK was developed with Ruby 1.8.4. Earlier versions of Ruby
|
26
|
-
may also be compatible.
|
26
|
+
may also be compatible. Ruby Java Bridge is used to interface
|
27
|
+
to the Java Virtual Machine.
|
27
28
|
|
28
29
|
==Installing
|
29
30
|
|
@@ -32,12 +33,20 @@ The RubyGems package can be installed using the following command
|
|
32
33
|
|
33
34
|
gem install rcdk
|
34
35
|
|
36
|
+
This command will optionally install Ruby Java Bridge, if it
|
37
|
+
hasn't been installed yet.
|
38
|
+
|
35
39
|
==License
|
36
40
|
RCDK is distributed under the GNU LGPL version 2.1 (see 'LICENSE').
|
37
|
-
It contains bytecode from the
|
38
|
-
|
39
|
-
|
41
|
+
It contains bytecode from the following sources:
|
42
|
+
|
43
|
+
-Chemistry Development Kit (CDK), licensed under the LGPL: http://cdk.sf.net
|
44
|
+
|
45
|
+
-OPSIN, licensed under the Artistic License: http://sourceforge.net/projects/oscar3-chem/
|
46
|
+
|
47
|
+
-Structure-CDK, licensed under the LGPL: http://sf.net/projects/structure
|
40
48
|
|
41
49
|
==Contact
|
42
50
|
|
43
|
-
|
51
|
+
Blog: http://depth-first.com
|
52
|
+
Email: r_apodaca at users dot sf dot net
|
data/Rakefile
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
# RCDK - The Chemistry Development Kit for Ruby
|
3
3
|
# =============================================
|
4
4
|
#
|
5
|
-
# Project Info: http://
|
5
|
+
# Project Info: http://rubyforge.org/projects/rcdk
|
6
|
+
# Blog: http://depth-first.com
|
6
7
|
#
|
7
8
|
# Copyright (C) 2006 Richard L. Apodaca
|
8
9
|
#
|
@@ -26,7 +27,7 @@ require 'rake/testtask'
|
|
26
27
|
require 'rake/rdoctask'
|
27
28
|
require 'rake/gempackagetask'
|
28
29
|
|
29
|
-
PKG_VERSION = "0.
|
30
|
+
PKG_VERSION = "0.3.0"
|
30
31
|
|
31
32
|
PKG_FILES = FileList[
|
32
33
|
"Rakefile", "README",
|
@@ -95,7 +96,7 @@ spec = Gem::Specification.new do |s|
|
|
95
96
|
s.name = 'rcdk'
|
96
97
|
s.version = PKG_VERSION
|
97
98
|
s.author = "Richard Apodaca"
|
98
|
-
s.homepage = "http://
|
99
|
+
s.homepage = "http://rubyforge.org/projects/rcdk"
|
99
100
|
s.platform = Gem::Platform::RUBY
|
100
101
|
s.require_path = 'lib'
|
101
102
|
s.autorequire = 'rcdk'
|
@@ -103,6 +104,11 @@ spec = Gem::Specification.new do |s|
|
|
103
104
|
s.files = PKG_FILES
|
104
105
|
s.summary = "A Ruby wrapper for the Chemistry Development Kit"
|
105
106
|
s.add_dependency("rjb", ">= 1.0.0")
|
107
|
+
s.description = s.summary
|
108
|
+
s.extra_rdoc_files = ['README']
|
109
|
+
s.rdoc_options << '--title' << 'Ruby Chemistry Development Kit (RCDK)' <<
|
110
|
+
'--main' << 'README' <<
|
111
|
+
'--line-numbers'
|
106
112
|
end
|
107
113
|
|
108
114
|
Rake::GemPackageTask.new(spec) do |gem|
|
Binary file
|
data/lib/rcdk.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
# RCDK - The Chemistry Development Kit for Ruby
|
3
3
|
# =============================================
|
4
4
|
#
|
5
|
-
# Project Info: http://
|
5
|
+
# Project Info: http://rubyforge.org/projects/rcdk
|
6
|
+
# Blog: http://depth-first.com
|
6
7
|
#
|
7
8
|
# Copyright (C) 2006 Richard L. Apodaca
|
8
9
|
#
|
@@ -15,18 +16,19 @@
|
|
15
16
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
17
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
18
|
# Lesser General Public License for more details.
|
19
|
+
#
|
20
|
+
# You should have received a copy of the GNU Lesser General Public
|
21
|
+
# License along with this library; if not, write to the Free
|
22
|
+
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
|
23
|
+
# Boston, MA 02111-1301, USA.
|
18
24
|
|
19
|
-
|
20
|
-
|
21
|
-
RCDK_VERSION = '0.2.0'
|
25
|
+
RCDK_VERSION = '0.3.0'
|
22
26
|
CDK_VERSION = '20060714'
|
23
27
|
STRUCTURE_CDK_VERSION = '0.1.2'
|
28
|
+
OPSIN_VERSION = '0.1.0'
|
24
29
|
|
25
|
-
|
26
|
-
File.join('gems', 'rcdk-' + RCDK_VERSION, 'java', 'lib', 'cdk-' +
|
27
|
-
CDK_VERSION + '.jar'))
|
28
|
-
|
29
|
-
Java::Classpath.add(Gem.dir + File::SEPARATOR +
|
30
|
-
File.join('gems', 'rcdk-' + RCDK_VERSION, 'java', 'lib', 'structure-cdk-' +
|
31
|
-
STRUCTURE_CDK_VERSION + '.jar'))
|
30
|
+
require 'rcdk/java'
|
32
31
|
|
32
|
+
require_jar File.join(File.dirname(__FILE__), '..', 'java', 'lib', 'cdk-' + CDK_VERSION + '.jar')
|
33
|
+
require_jar File.join(File.dirname(__FILE__), '..', 'java', 'lib', 'structure-cdk-' + STRUCTURE_CDK_VERSION + '.jar')
|
34
|
+
require_jar File.join(File.dirname(__FILE__), '..', 'java', 'lib', 'opsin-big-' + OPSIN_VERSION + '.jar')
|
data/lib/rcdk/java.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# =============================================
|
2
|
+
# RCDK - The Chemistry Development Kit for Ruby
|
3
|
+
# =============================================
|
4
|
+
#
|
5
|
+
# Project Info: http://rubyforge.org/projects/rcdk
|
6
|
+
# Blog: http://depth-first.com
|
7
|
+
#
|
8
|
+
# Copyright (C) 2006 Richard L. Apodaca
|
9
|
+
#
|
10
|
+
# This library is free software; you can redistribute it and/or
|
11
|
+
# modify it under the terms of the GNU Lesser General Public
|
12
|
+
# License version 2.1 as published by the Free Software
|
13
|
+
# Foundation.
|
14
|
+
#
|
15
|
+
# This library is distributed in the hope that it will be useful,
|
16
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
18
|
+
# Lesser General Public License for more details.
|
19
|
+
#
|
20
|
+
# You should have received a copy of the GNU Lesser General Public
|
21
|
+
# License along with this library; if not, write to the Free
|
22
|
+
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
|
23
|
+
# Boston, MA 02111-1301, USA.
|
24
|
+
|
25
|
+
require 'rubygems'
|
26
|
+
require_gem 'rjb'
|
27
|
+
require 'rjb'
|
28
|
+
|
29
|
+
# Adds the fully-qualified path <tt>path_to_jarfile</tt> to the <tt>
|
30
|
+
# CLASSPATH</tt> environment variable. Any jarfiles added after the
|
31
|
+
# first invocation of a Java constructor will be globally ignored, i.e., <tt>
|
32
|
+
# require</tt> all jarfiles first in your program before constructing
|
33
|
+
# objects from them.
|
34
|
+
def require_jar(path_to_jarfile)
|
35
|
+
if classpath_set?
|
36
|
+
ENV['CLASSPATH'] = ENV['CLASSPATH'] + File::PATH_SEPARATOR + path_to_jarfile
|
37
|
+
else
|
38
|
+
ENV['CLASSPATH'] = path_to_jarfile
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
# Returns false if the <tt>CLASSPATH</tt> variable is either null or
|
45
|
+
# empty, or otherwise true.
|
46
|
+
def classpath_set?
|
47
|
+
if !ENV['CLASSPATH']
|
48
|
+
return false
|
49
|
+
elsif ''.eql?(ENV['CLASSPATH'])
|
50
|
+
return false
|
51
|
+
end
|
52
|
+
|
53
|
+
true
|
54
|
+
end
|
55
|
+
|
56
|
+
module Kernel
|
57
|
+
|
58
|
+
# Maps the packages and class name specified by <tt>qualified_class_name</tt>
|
59
|
+
# to a nested set of Ruby modules. The first letter of each module name is
|
60
|
+
# capitalized. For example, <tt>java.util.HashMap</tt> would become <tt>
|
61
|
+
# Java::Util::HashMap</tt>.
|
62
|
+
#
|
63
|
+
# The first use of <tt>jrequire</tt> will render all subsequent calls
|
64
|
+
# to <tt>require_jar</tt> ineffective.
|
65
|
+
def jrequire(qualified_class_name)
|
66
|
+
java_class = Rjb::import(qualified_class_name)
|
67
|
+
package_names = qualified_class_name.to_s.split('.')
|
68
|
+
java_class_name = package_names.delete(package_names.last)
|
69
|
+
new_module = self.class
|
70
|
+
|
71
|
+
package_names.each do |package_name|
|
72
|
+
module_name = package_name.capitalize
|
73
|
+
|
74
|
+
if !new_module.const_defined?(module_name)
|
75
|
+
new_module = new_module.const_set(module_name, Module.new)
|
76
|
+
else
|
77
|
+
new_module = new_module.const_get(module_name)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
return false if new_module.const_defined?(java_class_name)
|
82
|
+
|
83
|
+
new_module.const_set(java_class_name, java_class)
|
84
|
+
|
85
|
+
return true
|
86
|
+
end
|
87
|
+
end
|
@@ -2,7 +2,8 @@
|
|
2
2
|
# RCDK - The Chemistry Development Kit for Ruby
|
3
3
|
# =============================================
|
4
4
|
#
|
5
|
-
# Project Info: http://
|
5
|
+
# Project Info: http://rubyforge.org/projects/rcdk
|
6
|
+
# Blog: http://depth-first.com
|
6
7
|
#
|
7
8
|
# Copyright (C) 2006 Richard L. Apodaca
|
8
9
|
#
|
@@ -15,21 +16,27 @@
|
|
15
16
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
17
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
18
|
# Lesser General Public License for more details.
|
19
|
+
#
|
20
|
+
# You should have received a copy of the GNU Lesser General Public
|
21
|
+
# License along with this library; if not, write to the Free
|
22
|
+
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
|
23
|
+
# Boston, MA 02111-1301, USA.
|
18
24
|
|
19
25
|
require 'rcdk'
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
jrequire 'java.io.StringReader'
|
28
|
+
jrequire 'java.io.StringWriter'
|
29
|
+
jrequire 'org.openscience.cdk.io.MDLWriter'
|
30
|
+
jrequire 'org.openscience.cdk.io.MDLReader'
|
31
|
+
jrequire 'org.openscience.cdk.smiles.SmilesParser'
|
32
|
+
jrequire 'org.openscience.cdk.smiles.SmilesGenerator'
|
33
|
+
jrequire 'org.openscience.cdk.DefaultChemObjectBuilder'
|
34
|
+
jrequire 'org.openscience.cdk.Molecule'
|
35
|
+
jrequire 'org.openscience.cdk.layout.StructureDiagramGenerator'
|
36
|
+
jrequire 'org.openscience.cdk.io.CMLReader'
|
37
|
+
jrequire 'org.openscience.cdk.ChemFile'
|
38
|
+
jrequire 'net.sf.structure.cdk.util.ImageKit'
|
39
|
+
jrequire 'uk.ac.cam.ch.wwmm.opsin.NameToStructure'
|
33
40
|
|
34
41
|
# The Ruby Chemistry Development Kit.
|
35
42
|
module RCDK
|
@@ -37,24 +44,45 @@ module RCDK
|
|
37
44
|
# Convenience methods for working with the CDK.
|
38
45
|
module Util
|
39
46
|
|
40
|
-
# Molecular language translation. Currently molfile
|
41
|
-
# are implemented.
|
47
|
+
# Molecular language translation. Currently molfile, SMILES,
|
48
|
+
# and IUPAC nomenclature (read-only) are implemented.
|
42
49
|
class Lang
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
50
|
+
include Org::Openscience::Cdk
|
51
|
+
include Org::Openscience::Cdk::Io
|
52
|
+
include Java::Io
|
53
|
+
include Uk::Ac::Cam::Ch::Wwmm::Opsin
|
54
|
+
|
55
|
+
@@mdl_reader = Io::MDLReader.new
|
56
|
+
@@mdl_writer = Io::MDLWriter.new
|
57
|
+
@@smiles_parser = Smiles::SmilesParser.new
|
58
|
+
@@smiles_generator = Smiles::SmilesGenerator.new(DefaultChemObjectBuilder.getInstance)
|
59
|
+
@@cml_reader = nil
|
47
60
|
|
48
61
|
# Returns a CDK <tt>Molecule</tt> given the String-based molfile
|
49
62
|
# <tt>molfile</tt>.
|
50
63
|
def self.read_molfile(molfile)
|
51
|
-
reader =
|
52
|
-
StringReader.new_with_sig('Ljava.lang.String;', molfile)
|
64
|
+
reader = StringReader.new(molfile)
|
53
65
|
|
54
66
|
@@mdl_reader.setReader(reader)
|
55
67
|
@@mdl_reader.read(Molecule.new)
|
56
68
|
end
|
57
69
|
|
70
|
+
# Returns a CDK <tt>Molecule</tt> given the specified <tt>iupac_name</tt>.
|
71
|
+
def self.read_iupac(iupac_name)
|
72
|
+
nts = NameToStructure.getInstance
|
73
|
+
cml = nts.parseToCML(iupac_name)
|
74
|
+
|
75
|
+
raise "Couldn't parse #{iupac_name}." unless cml
|
76
|
+
|
77
|
+
string_reader = StringReader.new(cml.toXML)
|
78
|
+
|
79
|
+
@@cml_reader = CMLReader.new unless @@cml_reader
|
80
|
+
@@cml_reader.setReader(string_reader)
|
81
|
+
|
82
|
+
chem_file = @@cml_reader.read(ChemFile.new)
|
83
|
+
chem_file.getChemSequence(0).getChemModel(0).getSetOfMolecules.getMolecule(0)
|
84
|
+
end
|
85
|
+
|
58
86
|
# Returns a String-based molfile by parsing the CDK <tt>molecule</tt>.
|
59
87
|
def self.get_molfile(molecule)
|
60
88
|
writer = StringWriter.new
|
@@ -86,12 +114,13 @@ module RCDK
|
|
86
114
|
def self.smiles_to_molfile(smiles)
|
87
115
|
get_molfile(read_smiles(smiles))
|
88
116
|
end
|
89
|
-
|
90
117
|
end
|
91
118
|
|
92
119
|
# 2-D coordinate generation.
|
93
120
|
class XY
|
94
|
-
|
121
|
+
include Org::Openscience::Cdk
|
122
|
+
|
123
|
+
@@sdg = Layout::StructureDiagramGenerator.new
|
95
124
|
|
96
125
|
# Assigns 2-D coordinates to the indicated <tt>molfile</tt> string.
|
97
126
|
def self.coordinate_molfile(molfile)
|
@@ -110,7 +139,8 @@ module RCDK
|
|
110
139
|
|
111
140
|
# Raster and SVG 2-D molecular images.
|
112
141
|
class Image
|
113
|
-
|
142
|
+
include Net::Sf::Structure::Cdk::Util
|
143
|
+
|
114
144
|
# Writes a <tt>width</tt> by <tt>height</tt> PNG image to
|
115
145
|
# <tt>path_to_png</tt> using <tt>molfile</tt>.
|
116
146
|
def self.molfile_to_png(molfile, path_to_png, width, height)
|
@@ -155,6 +185,33 @@ module RCDK
|
|
155
185
|
|
156
186
|
ImageKit.writeJPG(mol, width, height, path_to_jpg)
|
157
187
|
end
|
188
|
+
|
189
|
+
# Writes a <tt>width</tt> by <tt>height</tt> PNG image to
|
190
|
+
# <tt>path_to_png</tt> using <tt>iupac_name</tt>. Coordinates
|
191
|
+
# are automatically assigned.
|
192
|
+
def self.iupac_to_png(iupac_name, path_to_png, width, height)
|
193
|
+
mol = XY.coordinate_molecule(Lang.read_iupac(iupac_name))
|
194
|
+
|
195
|
+
ImageKit.writePNG(mol, width, height, path_to_png)
|
196
|
+
end
|
197
|
+
|
198
|
+
# Writes a <tt>width</tt> by <tt>height</tt> SVG document to
|
199
|
+
# <tt>path_to_svg</tt> using <tt>iupac_name</tt>. Coordinates
|
200
|
+
# are automatically assigned.
|
201
|
+
def self.iupac_to_svg(iupac_name, path_to_svg, width, height)
|
202
|
+
mol = XY.coordinate_molecule(Lang.read_iupac(iupac_name))
|
203
|
+
|
204
|
+
ImageKit.writeSVG(mol, width, height, path_to_svg)
|
205
|
+
end
|
206
|
+
|
207
|
+
# Writes a <tt>width</tt> by <tt>height</tt> JPG image to
|
208
|
+
# <tt>path_to_jpg</tt> using <tt>iupac_name</tt>. Coordinates
|
209
|
+
# are automatically assigned.
|
210
|
+
def self.iupac_to_jpg(iupac_name, path_to_jpg, width, height)
|
211
|
+
mol = XY.coordinate_molecule(Lang.read_iupac(iupac_name))
|
212
|
+
|
213
|
+
ImageKit.writeJPG(mol, width, height, path_to_jpg)
|
214
|
+
end
|
158
215
|
end
|
159
216
|
end
|
160
217
|
end
|
data/test/test.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
# RCDK - The Chemistry Development Kit for Ruby
|
3
3
|
# =============================================
|
4
4
|
#
|
5
|
-
# Project Info: http://
|
5
|
+
# Project Info: http://rubyforge.org/projects/rcdk
|
6
|
+
# Blog: http://depth-first.com
|
6
7
|
#
|
7
8
|
# Copyright (C) 2006 Richard L. Apodaca
|
8
9
|
#
|
@@ -15,26 +16,25 @@
|
|
15
16
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
17
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
18
|
# Lesser General Public License for more details.
|
19
|
+
#
|
20
|
+
# You should have received a copy of the GNU Lesser General Public
|
21
|
+
# License along with this library; if not, write to the Free
|
22
|
+
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
|
23
|
+
# Boston, MA 02111-1301, USA.
|
18
24
|
|
19
25
|
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
20
26
|
|
21
|
-
|
22
|
-
require 'rcdk'
|
23
27
|
require 'test/unit'
|
28
|
+
require 'rcdk'
|
29
|
+
require 'rcdk/util'
|
24
30
|
|
25
|
-
|
26
|
-
Java::Classpath.add(File.join('java', 'lib', 'cdk-' + CDK_VERSION + '.jar'))
|
27
|
-
Java::Classpath.add(File.join('java', 'lib', 'structure-cdk-' + STRUCTURE_CDK_VERSION + '.jar'))
|
28
|
-
|
29
|
-
require 'util'
|
30
|
-
|
31
|
-
include RCDK::Util
|
32
|
-
|
33
|
-
MoleculeFactory = import 'org.openscience.cdk.templates.MoleculeFactory'
|
31
|
+
jrequire 'org.openscience.cdk.templates.MoleculeFactory'
|
34
32
|
|
35
33
|
# A very simple test suite. Woefully incomplete. Just exercises the API.
|
36
34
|
class BasicTest < Test::Unit::TestCase
|
37
|
-
|
35
|
+
include RCDK::Util
|
36
|
+
include Org::Openscience::Cdk::Templates
|
37
|
+
|
38
38
|
def setup
|
39
39
|
@benzene =
|
40
40
|
"c1ccccc1
|
@@ -75,6 +75,12 @@ M END"
|
|
75
75
|
assert_equal(6, molecule.getAtomCount)
|
76
76
|
end
|
77
77
|
|
78
|
+
def test_read_iupac
|
79
|
+
molecule = Lang.read_iupac('benzene')
|
80
|
+
|
81
|
+
assert_equal(6, molecule.getAtomCount)
|
82
|
+
end
|
83
|
+
|
78
84
|
def test_write_smiles
|
79
85
|
smiles = Lang.get_smiles(MoleculeFactory.makeBenzene)
|
80
86
|
|
@@ -123,7 +129,19 @@ M END"
|
|
123
129
|
end
|
124
130
|
|
125
131
|
def test_smiles_to_jpg
|
126
|
-
Image.smiles_to_jpg('Clc1ccccc1', 'output/
|
132
|
+
Image.smiles_to_jpg('Clc1ccccc1', 'output/chlorobenzene.jpg', 200, 200)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_iupac_to_png
|
136
|
+
Image.iupac_to_png('quinoline', 'output/quinoline.png', 200, 200)
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_iupac_to_svg
|
140
|
+
Image.iupac_to_svg('quinoline', 'output/quinoline.svg', 200, 200)
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_iupac_to_jpg
|
144
|
+
Image.iupac_to_jpg('quinoline', 'output/quinoline.jpg', 200, 200)
|
127
145
|
end
|
128
146
|
end
|
129
147
|
|
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rcdk
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.3.0
|
7
|
+
date: 2006-10-28 00:00:00 -07:00
|
8
8
|
summary: A Ruby wrapper for the Chemistry Development Kit
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email:
|
12
|
-
homepage: http://
|
12
|
+
homepage: http://rubyforge.org/projects/rcdk
|
13
13
|
rubyforge_project:
|
14
|
-
description:
|
14
|
+
description: A Ruby wrapper for the Chemistry Development Kit
|
15
15
|
autorequire: rcdk
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
@@ -32,17 +32,22 @@ files:
|
|
32
32
|
- Rakefile
|
33
33
|
- README
|
34
34
|
- lib/rcdk.rb
|
35
|
-
- lib/java.rb
|
36
|
-
- lib/util.rb
|
35
|
+
- lib/rcdk/java.rb
|
36
|
+
- lib/rcdk/util.rb
|
37
37
|
- test/test.rb
|
38
38
|
- java/lib/cdk-20060714.jar
|
39
|
+
- java/lib/opsin-big-0.1.0.jar
|
39
40
|
- java/lib/structure-cdk-0.1.2.jar
|
40
41
|
test_files: []
|
41
42
|
|
42
|
-
rdoc_options:
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
rdoc_options:
|
44
|
+
- --title
|
45
|
+
- Ruby Chemistry Development Kit (RCDK)
|
46
|
+
- --main
|
47
|
+
- README
|
48
|
+
- --line-numbers
|
49
|
+
extra_rdoc_files:
|
50
|
+
- README
|
46
51
|
executables: []
|
47
52
|
|
48
53
|
extensions: []
|
data/lib/java.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# =============================================
|
2
|
-
# RCDK - The Chemistry Development Kit for Ruby
|
3
|
-
# =============================================
|
4
|
-
#
|
5
|
-
# Project Info: http://rcdk.rubyforge.org
|
6
|
-
#
|
7
|
-
# Copyright (C) 2006 Richard L. Apodaca
|
8
|
-
#
|
9
|
-
# This library is free software; you can redistribute it and/or
|
10
|
-
# modify it under the terms of the GNU Lesser General Public
|
11
|
-
# License version 2.1 as published by the Free Software
|
12
|
-
# Foundation.
|
13
|
-
#
|
14
|
-
# This library is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
-
# Lesser General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU Lesser General Public
|
20
|
-
# License along with this library; if not, write to the Free
|
21
|
-
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
|
22
|
-
# Boston, MA 02111-1301, USA.
|
23
|
-
|
24
|
-
require 'rubygems'
|
25
|
-
require_gem 'rjb'
|
26
|
-
require 'rjb'
|
27
|
-
|
28
|
-
# Returns the Java class represented by the fully qualified name
|
29
|
-
# <tt>klass</tt> via Ruby Java Bridge (RJB).
|
30
|
-
def import(klass)
|
31
|
-
Rjb::import(klass)
|
32
|
-
end
|
33
|
-
|
34
|
-
# Configuration and use of Java classes through Ruby Java Bridge (RJB).
|
35
|
-
module Java
|
36
|
-
# Configuration of classpath.
|
37
|
-
class Classpath
|
38
|
-
# Appends <tt>path</tt> to the <tt>CLASSPATH</tt> environment variable.
|
39
|
-
def self.add(path)
|
40
|
-
if set?
|
41
|
-
ENV['CLASSPATH'] = ENV['CLASSPATH'] + File::PATH_SEPARATOR + path
|
42
|
-
else
|
43
|
-
ENV['CLASSPATH'] = path
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# Returns false if the <tt>CLASSPATH</tt> variable is either null or
|
48
|
-
# empty, or otherwise true.
|
49
|
-
def self.set?
|
50
|
-
if !ENV['CLASSPATH']
|
51
|
-
return false
|
52
|
-
elsif ''.eql?(ENV['CLASSPATH'])
|
53
|
-
return false
|
54
|
-
end
|
55
|
-
|
56
|
-
true
|
57
|
-
end
|
58
|
-
|
59
|
-
# Returns the value of the <tt>CLASSPATH</tt> variable.
|
60
|
-
def self.get
|
61
|
-
ENV['CLASSPATH']
|
62
|
-
end
|
63
|
-
|
64
|
-
# Sets the value of the <tt>CLASSPATH</tt> varible to <tt>nil</tt>.
|
65
|
-
def self.clear!
|
66
|
-
ENV['CLASSPATH'] = nil
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|