From 59509099257225b068a13626d3a42eac2f4244ab Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 13 Oct 2020 11:25:51 +0200 Subject: mutagenicity downloads moved, PaDEL metadata --- lib/compound.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/compound.rb') diff --git a/lib/compound.rb b/lib/compound.rb index 4436e9d..4f0a924 100644 --- a/lib/compound.rb +++ b/lib/compound.rb @@ -111,16 +111,16 @@ class Compound # @return [Lazar::Compound] def self.from_smiles smiles return nil if smiles.match(/\s/) # spaces seem to confuse obconversion and may lead to invalid smiles - @smiles = obconversion(smiles,"smi","can") # test if SMILES is correct and return canonical smiles (for compound comparisons) - @smiles.empty? ? nil : @smiles + smiles = obconversion(smiles,"smi","can") # test if SMILES is correct and return canonical smiles (for compound comparisons) + smiles.empty? ? nil : self.new(smiles) end # Create a compound from InChI string # @param [String] InChI # @return [OpenTox::Compound] def self.from_inchi inchi - @smiles = obconversion(inchi,"inchi","can") - @smiles.empty? ? nil : @smiles + smiles = obconversion(inchi,"inchi","can") + smiles.empty? ? nil : self.new(smiles) end # Create a compound from SDF @@ -137,7 +137,7 @@ class Compound # @param [String] name, can be also an InChI/InChiKey, CAS number, etc # @return [OpenTox::Compound] def self.from_name name - Compound.from_smiles RestClientWrapper.get(File.join(PUBCHEM_URI,"compound","name",URI.escape(name),"property","CanonicalSMILES","TXT")).chomp + self.from_smiles RestClientWrapper.get(File.join(PUBCHEM_URI,"compound","name",URI.escape(name),"property","CanonicalSMILES","TXT")).chomp end # Get InChI @@ -224,7 +224,6 @@ class Compound builder.build(obmol) sdf = obconversion.write_string(obmol) -print sdf if sdf.match(/.nan/) #warn "3D generation failed for compound #{identifier}, trying to calculate 2D structure" -- cgit v1.2.3