openbabel 2.3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +15 -0
- data/Rakefile +8 -0
- data/ext/openbabel/Makefile +8 -0
- data/ext/openbabel/extconf.rb +27 -0
- data/lib/openbabel.rb +1 -0
- data/test/test_openbabel.rb +21 -0
- metadata +70 -0
data/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# openbabel gem
|
2
|
+
|
3
|
+
GEM for [OpenBabel](http://openbabel.sf.net), a chemical library by Noel O'Boyle and others.
|
4
|
+
|
5
|
+
openbabel gem has been tested with ruby 1.9. It only compiles on POSIX systems and requires the following to be installed already:
|
6
|
+
|
7
|
+
* openbabel library
|
8
|
+
* cmake
|
9
|
+
* curl
|
10
|
+
* tar, sed, make (those should be present anyway)
|
11
|
+
|
12
|
+
## Install
|
13
|
+
gem install openbabel
|
14
|
+
|
15
|
+
It downloads the sources, compiles the ruby bindings and installs them. Check out [http://cs.maunz.de](http://cs.maunz.de) for more information.
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
ob_num_ver="2.3.1"
|
5
|
+
ob_ver="openbabel-"+ob_num_ver
|
6
|
+
|
7
|
+
main_dir = Dir.mktmpdir
|
8
|
+
ob_main_dir=main_dir+"/"+ob_ver
|
9
|
+
ob_bindings_dir=ob_main_dir+"/scripts/ruby"
|
10
|
+
|
11
|
+
begin
|
12
|
+
Dir.chdir main_dir do
|
13
|
+
FileUtils.rm_rf ob_main_dir
|
14
|
+
`curl -L -d use_mirror=netcologne "http://downloads.sourceforge.net/project/openbabel/openbabel/#{ob_num_ver}/openbabel-#{ob_num_ver}.tar.gz" | tar xz`
|
15
|
+
end
|
16
|
+
Dir.chdir ob_main_dir do
|
17
|
+
`cmake #{ob_main_dir}`
|
18
|
+
end
|
19
|
+
Dir.chdir ob_bindings_dir do
|
20
|
+
`sed -i 's/Init_OpenBabel/Init_openbabel/g' *cpp`
|
21
|
+
require './extconf.rb'
|
22
|
+
`make`
|
23
|
+
end
|
24
|
+
FileUtils.cp(ob_bindings_dir+"/openbabel.so", "./")
|
25
|
+
ensure
|
26
|
+
FileUtils.remove_entry_secure main_dir
|
27
|
+
end
|
data/lib/openbabel.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'openbabel/openbabel'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'openbabel'
|
3
|
+
include OpenBabel
|
4
|
+
|
5
|
+
class OBTest < Test::Unit::TestCase
|
6
|
+
def test_obmol
|
7
|
+
# Code from http://goo.gl/9H1LZ
|
8
|
+
|
9
|
+
smi2mol = OBConversion.new
|
10
|
+
smi2mol.set_in_format("smi")
|
11
|
+
|
12
|
+
mol = OBMol.new
|
13
|
+
smi2mol.read_string(mol, 'CC(C)CCCC(C)C1CCC2C1(CCC3C2CC=C4C3(CCC(C4)O)C)C') # cholesterol, no chirality
|
14
|
+
mol.add_hydrogens
|
15
|
+
|
16
|
+
assert_equal(mol.num_atoms, 74)
|
17
|
+
assert_in_delta(mol.get_mol_wt, 386.65, 0.1)
|
18
|
+
assert_equal(mol.get_formula, "C27H46O")
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: openbabel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 2
|
7
|
+
- 3
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 2.3.1.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Andreas Maunz
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-04-03 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: OpenBabel as a GEM
|
23
|
+
email: andreas@maunz.de
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions:
|
27
|
+
- ext/openbabel/extconf.rb
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- Rakefile
|
32
|
+
- README.md
|
33
|
+
- lib/openbabel.rb
|
34
|
+
- ext/openbabel/Makefile
|
35
|
+
- test/test_openbabel.rb
|
36
|
+
- ext/openbabel/extconf.rb
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://cs.maunz.de
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
version: "0"
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.3.7
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: OpenBabel!
|
69
|
+
test_files:
|
70
|
+
- test/test_openbabel.rb
|