summaryrefslogtreecommitdiff
path: root/application.rb
blob: 4908917734214c060bb81eb9dec7cb454aa397f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Java Klimbim
ENV["JAVA_HOME"] = "/usr/lib/jvm/java-6-sun" unless ENV["JAVA_HOME"]
ENV["JOELIB2"] = File.join File.expand_path(File.dirname(__FILE__)),"java"
deps = []
deps << "#{ENV["JAVA_HOME"]}/lib/tools.jar"
deps << "#{ENV["JAVA_HOME"]}/lib/classes.jar"
deps << "#{ENV["JOELIB2"]}"
jars = Dir[ENV["JOELIB2"]+"/*.jar"].collect {|f| File.expand_path(f) }
deps = deps + jars
ENV["CLASSPATH"] = deps.join(":")

require 'rubygems'


# fminer libs to be included before openbabel, otherwise strange SWIG overloading problems
require File.join(File.expand_path(File.dirname(__FILE__)), 'libfminer/libbbrc/bbrc') 
require File.join(File.expand_path(File.dirname(__FILE__)), 'libfminer/liblast/last')
require File.join(File.expand_path(File.dirname(__FILE__)), 'last-utils/lu.rb')

gem "opentox-ruby", "~> 4"
require 'opentox-ruby'
require 'rjb'
require 'rinruby'


# main
require 'fminer.rb'
require 'lazar.rb'
require 'fs.rb'
require 'pc.rb'

set :lock, true

before do
	LOGGER.debug "Request: " + request.path
end

# Get a list of available algorithms
#
# @return [text/uri-list] algorithm URIs
get '/?' do
	list = [ url_for('/lazar', :full), url_for('/fminer/bbrc', :full), url_for('/fminer/bbrc/sample', :full), url_for('/fminer/last', :full), url_for('/fminer/bbrc/match', :full), url_for('/fminer/last/match', :full), url_for('/feature_selection/rfe', :full), url_for('/pc', :full) ].join("\n") + "\n"
  case request.env['HTTP_ACCEPT']
  when /text\/html/
    content_type "text/html"
    OpenTox.text_to_html list,@subjectid
  else
    content_type 'text/uri-list'
    list
  end
end