From 36e10aa98a3d19a78a1889857262abe338a05eef Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Wed, 19 Aug 2015 12:57:23 +0200 Subject: libfminer rpath fixed, installation instructions --- README.md | 41 ++++++++++++++++++----------------------- ext/lazar/extconf.rb | 2 +- lib/compound.rb | 13 ++++++++++++- lib/lazar.rb | 3 --- test/compound.rb | 5 ++--- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 91889ec..c398df2 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,33 @@ -opentox-client -==================== - -Thin Ruby wrapper for the [OpenTox](http://www.opentox.org) REST API - -Libraries: - -* {OpenTox::Algorithm} Wrapper for OpenTox Algorithms -* {OpenTox::Authorization} Authorization and Authentication -* {OpenTox::Compound} Compound Library -* {OpenTox::Dataset} Dataset Library -* {OpenTox::Error} extends Exception class according the OpenTox API -* {OpenTox::Model} Model Library -* {OpenTox} OpenTox Library - general definition of OpenTox objects -* {OTLogger} OpenTox Logger Extensions -* {OpenTox::Policies} parse and serialize XML for the openSSO A&A server -* {OpenTox::RestClientWrapper} wrapper for the RestClient gem -* {OpenTox::Task} Task Library +lazar +===== +Ruby libraries for the lazar framework Dependencies ------------ - libraptor1-dev + lazar depends on a couple of external programs and libraries. On Debian 7 "Wheezy" systems you can install them with + + `sudo apt-get install build-essential ruby ruby-dev git cmake swig r-base r-base-dev r-cran-rserve openjdk-7-jre libgsl0-dev libxml2-dev zlib1g-dev libcairo2-dev` + + You will also need at least mongodb version 3.0, but Debian "Wheezy" provides version 2.4. Please follow the instructions at http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian/: + + ``` + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 + echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list + sudo apt-get update + sudo apt-get install -y mongodb-org + ``` Installation ------------ - gem install opentox-client + gem install lazar Documentation ------------- -* [API documentation](http://rdoc.info/gems/opentox-client) -* [RubyDoc.info Code documentation](http://rubydoc.info/github/opentox/opentox-client/development/frames) +* [API documentation](http://rdoc.info/gems/lazar) Copyright --------- -Copyright (c) 2009-2014 Christoph Helma, Martin Guetlein, Micha Rautenberg, Andreas Maunz, David Vorgrimmler, Denis Gebele. See LICENSE for details. +Copyright (c) 2009-2015 Christoph Helma, Martin Guetlein, Micha Rautenberg, Andreas Maunz, David Vorgrimmler, Denis Gebele. See LICENSE for details. diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb index d274c4d..b86c61b 100644 --- a/ext/lazar/extconf.rb +++ b/ext/lazar/extconf.rb @@ -73,7 +73,7 @@ system "git clone git://github.com/amaunz/fminer2.git #{fminer_dir}" system "sed -i 's,^INCLUDE_RB.*,INCLUDE_RB\ =\ #{RbConfig::CONFIG['rubyhdrdir']},g' Makefile" # TODO fix in fminer Makefile system "sed -i 's,-g, -g -I #{RbConfig::CONFIG['rubyhdrdir']} -I #{RbConfig::CONFIG['rubyarchhdrdir']} -I,' Makefile" # fix include path (CH) - system "sed -i '74s/$(CC)/$(CC) -L/' Makefile" # fix library path (CH) + system "sed -i '74s/$(CC)/$(CC) -Wl,-rpath,#{ob_lib.gsub('/','\/')} -L/' Makefile" # fix library path (CH) system "make ruby" end diff --git a/lib/compound.rb b/lib/compound.rb index e51e9ad..fdec019 100644 --- a/lib/compound.rb +++ b/lib/compound.rb @@ -213,11 +213,22 @@ module OpenTox when /smi|can|inchi/ obconversion.write_string(obmol).gsub(/\s/,'').chomp when /sdf/ -# TODO set 3D +p "SDF conversion" + # has no effect + #obconversion.add_option("gen3D", OpenBabel::OBConversion::GENOPTIONS) + # segfaults with openbabel git master #OpenBabel::OBOp.find_type("Gen3D").do(obmol) + + builder = OpenBabel::OBBuilder.new + builder.build(obmol); + sdf = obconversion.write_string(obmol) +print sdf if sdf.match(/.nan/) + +# TODO: fix or eliminate 2d generation $logger.warn "3D generation failed for compound #{identifier}, trying to calculate 2D structure" + obconversion.set_options("gen2D", OpenBabel::OBConversion::GENOPTIONS) #OpenBabel::OBOp.find_type("Gen2D").do(obmol) sdf = obconversion.write_string(obmol) if sdf.match(/.nan/) diff --git a/lib/lazar.rb b/lib/lazar.rb index 9e2363c..2ea8cba 100644 --- a/lib/lazar.rb +++ b/lib/lazar.rb @@ -31,9 +31,6 @@ Mongo::Logger.level = Logger::WARN #Mongoid.logger = $logger # Require sub-Repositories -# TODO: set -ENV["LD_LIBRARY_PATH"] = "#{File.join File.dirname(__FILE__),'..','openbabel','lib'}" -p ENV["LD_LIBRARY_PATH"] require_relative '../libfminer/libbbrc/bbrc' # include before openbabel require_relative '../libfminer/liblast/last' # require_relative '../last-utils/lu.rb' diff --git a/test/compound.rb b/test/compound.rb index 40b9f9e..7265ef5 100644 --- a/test/compound.rb +++ b/test/compound.rb @@ -40,6 +40,7 @@ class CompoundTest < MiniTest::Test def test_sdf_export c = OpenTox::Compound.from_smiles "CC=O" +print c.sdf assert_match /7 6 0 0 0 0 0 0 0 0999 V2000/, c.sdf end @@ -51,7 +52,6 @@ class CompoundTest < MiniTest::Test File.unlink(testbild) end - # OpenBabel segfaults randomly during inchikey calculation def test_inchikey c = OpenTox::Compound.from_inchi "InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H" p c @@ -94,8 +94,7 @@ class CompoundTest < MiniTest::Test def test_openbabel_segfault inchi = "InChI=1S/C19H27NO7/c1-11-9-19(12(2)27-19)17(23)26-14-6-8-20(4)7-5-13(15(14)21)10-25-16(22)18(11,3)24/h5,11-12,14,24H,6-10H2,1-4H3/b13-5-/t11-,12-,14-,18-,19?/m1/s1" - #r = `echo "#{inchi}" | babel -iinchi - -oinchi` c = Compound.from_inchi(inchi) - assert_nil c + assert_equal inchi, c.inchi end end -- cgit v1.2.3