diff options
author | Christoph Helma <helma@in-silico.ch> | 2010-07-22 17:12:51 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2010-07-22 17:12:51 +0200 |
commit | 040d6022a42c9e5fab97a42cded77fd20d3def3f (patch) | |
tree | d9b1342faa8eb24de4e34a0787adf99731519ce6 /application.rb | |
parent | 27223b2821c82ff6d9ff8047beced7aa7daf6c65 (diff) |
CONFIG reverted to @@config
Diffstat (limited to 'application.rb')
-rw-r--r-- | application.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/application.rb b/application.rb index e1c6214..b8b1d04 100644 --- a/application.rb +++ b/application.rb @@ -1,25 +1,37 @@ # Java environment -=begin ENV["JAVA_HOME"] = "/usr/lib/jvm/java-6-sun" unless ENV["JAVA_HOME"] java_dir = File.join File.expand_path(File.dirname(__FILE__)),"public/java" cdk = File.join java_dir, "cdk-1.3.5.jar" jchempaint = File.join java_dir, "cdk-jchempaint-15.jar" ENV["CLASSPATH"] = "#{ENV["CLASSPATH"]}:#{java_dir}:#{cdk}:#{jchempaint}" -=end require 'rubygems' -#require 'rjb' +require 'rjb' gem "opentox-ruby-api-wrapper", "= 1.6.0" require 'opentox-ruby-api-wrapper' -#set :lock, true +get %r{/smiles/(.+)/smarts/(.*)} do |smiles,smarts| + content_type "image/png" + attachment "#{smiles}.png" + #LOGGER.debug "SMILES: #{smiles}, SMARTS: #{smarts}" + s = Rjb::import('Structure').new(smiles,200) + s.match(smarts) + s.show +end + + +get %r{/smiles/(.+)} do |smiles| + content_type "image/png" + attachment "#{smiles}.png" + Rjb::import('Structure').new(smiles,200).show +end get %r{/(.+)/image} do |inchi| # catches all remaining get requests smiles = OpenTox::Compound.new(:inchi => inchi).smiles content_type "image/png" attachment "#{smiles}.png" - Rjb::import('Display').new(smiles,600).image + Rjb::import('Structure').new(smiles,200).show end |