summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2015-08-19 14:00:55 +0200
committerChristoph Helma <helma@in-silico.ch>2015-08-19 14:00:55 +0200
commit57bb9c2c691d350dce8c30b862030973043818cc (patch)
tree2280a4d622d51fcc2f334130f89ea180705e43cd
parentc4692ae10f898c111a7d9d0bc9e7867820f249e1 (diff)
hydrogens added for 3d generation
-rw-r--r--README.md25
-rw-r--r--ext/lazar/extconf.rb1
-rw-r--r--lib/compound.rb15
3 files changed, 20 insertions, 21 deletions
diff --git a/README.md b/README.md
index ac40156..e0b17d1 100644
--- a/README.md
+++ b/README.md
@@ -12,33 +12,28 @@ Dependencies
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
-```
+ ```
+ 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 lazar`
- Please be patient, the compilation of OpenBabel and Fminer libraries can be very time consuming. If installation fails you can try a
+ Please be patient, the compilation of OpenBabel and Fminer libraries can be very time consuming. If installation fails you can try to install manually:
- Manual installation
- ...................
-
-```
+ ```
git clone https://github.com/opentox/lazar.git
cd lazar
ruby ext/lazar/extconf.rb
bundle install
-```
-
- This should give you more verbose information that can help in debugging (e.g. to identify missing libraries).
+ ```
- This should
+ The output should give you more verbose information that can help in debugging (e.g. to identify missing libraries).
Documentation
-------------
diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb
index b9db3f0..0ee5e93 100644
--- a/ext/lazar/extconf.rb
+++ b/ext/lazar/extconf.rb
@@ -49,7 +49,6 @@ Dir.chdir build_dir do
ENV["PKG_CONFIG_PATH"] = File.dirname(File.expand_path(Dir["#{install_dir}/**/openbabel*pc"].first))
end
-# get include and lib from pkg-config
ob_include= File.expand_path File.join(File.dirname(__FILE__),"../../openbabel/include/openbabel-2.0")
ob_lib= File.expand_path File.join(File.dirname(__FILE__),"../../openbabel/lib")
diff --git a/lib/compound.rb b/lib/compound.rb
index fdec019..6d755da 100644
--- a/lib/compound.rb
+++ b/lib/compound.rb
@@ -46,7 +46,6 @@ module OpenTox
# @param [String] smiles Smiles string
# @return [OpenTox::Compound] Compound
def self.from_smiles smiles
- # do not store smiles because it might be noncanonical
smiles = obconversion(smiles,"smi","can")
if smiles.empty?
Compound.find_or_create_by(:warning => "SMILES parsing failed for '#{smiles}', this may be caused by an incorrect SMILES string.")
@@ -62,7 +61,8 @@ module OpenTox
# Temporary workaround for OpenBabels Inchi bug
# http://sourceforge.net/p/openbabel/bugs/957/
# bug has not been fixed in latest git/development version
- smiles = `echo "#{inchi}" | "#{File.join(File.dirname(__FILE__),"..","openbabel","bin","babel")}" -iinchi - -ocan`.chomp.strip
+ #smiles = `echo "#{inchi}" | "#{File.join(File.dirname(__FILE__),"..","openbabel","bin","babel")}" -iinchi - -ocan`.chomp.strip
+ smiles = obconversion(inchi,"inchi","can")
if smiles.empty?
Compound.find_or_create_by(:warning => "InChi parsing failed for #{inchi}, this may be caused by an incorrect InChi string or a bug in OpenBabel libraries.")
else
@@ -92,7 +92,8 @@ module OpenTox
def inchi
unless self["inchi"]
- result = `echo "#{self.smiles}" | "#{File.join(File.dirname(__FILE__),"..","openbabel","bin","babel")}" -ismi - -oinchi`.chomp
+ result = obconversion(smiles,"smi","inchi")
+ #result = `echo "#{self.smiles}" | "#{File.join(File.dirname(__FILE__),"..","openbabel","bin","babel")}" -ismi - -oinchi`.chomp
update(:inchi => result.chomp) unless result.empty?
end
self["inchi"]
@@ -108,7 +109,7 @@ module OpenTox
# Get (canonical) smiles
# @return [String] Smiles string
def smiles
- update(:smiles => obconversion(self["smiles"],"smi","can")) #unless self["smiles"] # should give canonical smiles, "can" seems to give incorrect results
+ update(:smiles => obconversion(self["smiles"],"smi","can")) unless self["smiles"]
self["smiles"]
end
@@ -219,8 +220,12 @@ p "SDF conversion"
# segfaults with openbabel git master
#OpenBabel::OBOp.find_type("Gen3D").do(obmol)
+ # TODO: find disconnected structures
+ # strip_salts
+ # separate
+ obmol.add_hydrogens
builder = OpenBabel::OBBuilder.new
- builder.build(obmol);
+ builder.build(obmol)
sdf = obconversion.write_string(obmol)
print sdf