diff options
author | Christoph Helma <helma@in-silico.de> | 2010-01-22 11:16:13 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.de> | 2010-01-22 11:16:13 +0100 |
commit | 09974c5a920bbb07475d8e48a725ef3780e60dbe (patch) | |
tree | e0992268d21f872eb554452da4a73d8d3acb9b2c /lib/compound.rb | |
parent | c86df1faf22bcd90a8f318632c368d5ce474dbf8 (diff) |
central config.ru, generic compound API
Diffstat (limited to 'lib/compound.rb')
-rw-r--r-- | lib/compound.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/compound.rb b/lib/compound.rb index 4385a7d..0a90663 100644 --- a/lib/compound.rb +++ b/lib/compound.rb @@ -20,14 +20,19 @@ module OpenTox @inchi = RestClient.get("#{@@cactus_uri}#{params[:name]}/stdinchi").chomp @uri = File.join(@@config[:services]["opentox-compound"],URI.escape(@inchi)) elsif params[:uri] - @inchi = params[:uri].sub(/^.*InChI/, 'InChI') + if params[:uri].match(/InChI/) # shortcut for IST services + @inchi = params[:uri].sub(/^.*InChI/, 'InChI') + else + @inchi = RestClient.get @uri, :accept => 'chemical/x-inchi' + end @uri = params[:uri] end end # Get the (canonical) smiles def smiles - obconversion(@inchi,'inchi','can') + RestClient.get(@uri, :accept => 'chemical/x-daylight-smiles').split(/\s+/).first # fix ambit output + #obconversion(@inchi,'inchi','can') end def sdf |