summaryrefslogtreecommitdiff
path: root/compound.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2009-10-06 09:54:52 +0200
committerChristoph Helma <helma@in-silico.de>2009-10-06 09:54:52 +0200
commitf1141973d478679b4609d8bc0957db7d6c313dcf (patch)
tree756fdd4646da1b16e5083bf124c7ef7a5cbe63d3 /compound.rb
parent03055c09593a14eb4af24fb85a7be43b52277fca (diff)
Passes tests in opentox-test
Diffstat (limited to 'compound.rb')
-rw-r--r--compound.rb33
1 files changed, 0 insertions, 33 deletions
diff --git a/compound.rb b/compound.rb
deleted file mode 100644
index 9c1552e..0000000
--- a/compound.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-mime :uid, "text/plain"
-mime :smiles, "chemical/x-daylight-smiles"
-mime :inchi, "chemical/x-inchi"
-mime :sdf, "chemical/x-mdl-sdfile"
-mime :image, "image/gif"
-mime :names, "text/plain"
-
-set :default_content, :smiles
-
-get '/compound/*/match/*' do
- "#{OpenTox::Compound.new(:inchi => params[:splat][0]).match(params[:splat][1])}"
-end
-
-get %r{/compound/(.+)} do |inchi| # catches all remaining get requests
- inchi.gsub!(/ /,'+') # fix CGI? escaping of + signs
- respond_to do |format|
- format.smiles { inchi2smiles inchi }
- format.names { RestClient.get "#{CACTUS_URI}#{inchi}/names" }
- format.inchi { inchi }
- format.sdf { RestClient.get "#{CACTUS_URI}#{inchi}/sdf" }
- format.image { "#{CACTUS_URI}#{inchi}/image" }
- end
-end
-
-post '/compound/?' do
- if params[:smiles]
- OpenTox::Compound.new(:smiles => params[:smiles]).uri
- elsif params[:inchi]
- OpenTox::Compound.new(:inchi => params[:inchi]).uri
- elsif params[:name]
- OpenTox::Compound.new(:name => params[:name]).uri
- end
-end