summaryrefslogtreecommitdiff
path: root/lib/compound.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compound.rb')
-rw-r--r--lib/compound.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/compound.rb b/lib/compound.rb
index 562baaa..56646c0 100644
--- a/lib/compound.rb
+++ b/lib/compound.rb
@@ -21,20 +21,20 @@ module OpenTox
@uri = File.join(@@config[:services]["opentox-compound"],URI.escape(@inchi))
elsif params[:uri]
@uri = params[:uri]
- if params[:uri].match(/InChI/) # shortcut for IST services
+ case params[:uri]
+ when /ambit/ # Ambit does not deliver InChIs reliably
+ smiles = RestClient.get @uri, :accept => 'chemical/x-daylight-smiles'
+ @inchi = obconversion(smiles,'smi','inchi')
+ when /InChI/ # shortcut for IST services
@inchi = params[:uri].sub(/^.*InChI/, 'InChI')
else
@inchi = RestClient.get @uri, :accept => 'chemical/x-inchi'
- # AMBIT does not provide InChIs
- #smiles = RestClient.get(@uri, :accept => 'chemical/x-daylight-smiles').split(/\s+/).first # fix ambit output
- #@inchi = obconversion(smiles,'smi','inchi')
end
end
end
# Get the (canonical) smiles
def smiles
- #RestClient.get(@uri, :accept => 'chemical/x-daylight-smiles').split(/\s+/).first # fix ambit output
obconversion(@inchi,'inchi','can')
end