summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2016-11-24 16:31:26 +0000
committergebele <gebele@in-silico.ch>2016-11-24 16:31:26 +0000
commitbfd31ed2c9d0cde8a53238c7368eb3d49c580b7d (patch)
tree91c3a2865302e1017db0dffb6015dfa3eb6c476f /application.rb
parentf0588c7e072ea3e22f26916d669e9baaa8fa3197 (diff)
parentf86c084311282036ffa7b4588c0fa0d5b59af95b (diff)
fixed merge
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb33
1 files changed, 31 insertions, 2 deletions
diff --git a/application.rb b/application.rb
index fc7e415..5f64b84 100644
--- a/application.rb
+++ b/application.rb
@@ -1,4 +1,5 @@
-require_relative 'helper.rb'
+#require_relative 'helper.rb'
+require 'rdiscount'
include OpenTox
#require File.join(ENV["HOME"],".opentox","config","lazar-gui.rb") # until added to ot-tools
@@ -19,19 +20,36 @@ helpers do
end
+before do
+ @version = File.read("VERSION").chomp
+end
+
get '/?' do
redirect to('/predict')
end
get '/predict/?' do
@models = OpenTox::Model::Prediction.all
+ @models = @models.delete_if{|m| m.model.name =~ /\b(Net cell association)\b/}
@endpoints = @models.collect{|m| m.endpoint}.sort.uniq
@models.count <= 0 ? (haml :info) : (haml :predict)
end
get '/predict/modeldetails/:model' do
model = OpenTox::Model::Prediction.find params[:model]
- return haml :model_details, :layout=> false, :locals => {:model => model}
+ crossvalidations = OpenTox::Validation::RepeatedCrossValidation.find(model.repeated_crossvalidation_id).crossvalidations
+ #confidence_plots = crossvalidations.collect{|cv| [cv.id, cv.confidence_plot]}
+ #confidence_plots.each do |confp|
+ # File.open(File.join('public', "confp#{confp[0]}.svg"), 'w'){|file| file.write(confp[1])} unless File.exists? File.join('public', "confp#{confp[0]}.svg")
+ #end
+ #if model.regression?
+ # correlation_plots = crossvalidations.collect{|cv| [cv.id, cv.correlation_plot]}
+ # correlation_plots.each do |corrp|
+ # File.open(File.join('public', "corrp#{corrp[0]}.svg"), 'w'){|file| file.write(corrp[1])} unless File.exists? File.join('public', "corrp#{corrp[0]}.svg")
+ # end
+ #end
+
+ return haml :model_details, :layout=> false, :locals => {:model => model, :crossvalidations => crossvalidations}
end
get '/jme_help/?' do
@@ -292,6 +310,17 @@ post '/predict/?' do
end
end
+get '/license' do
+ @license = RDiscount.new(File.read("LICENSE.md")).to_html
+ haml :license, :layout => false
+end
+
+=begin
+get '/faq' do
+ @faq = RDiscount.new(File.read("FAQ.md")).to_html
+ haml :faq, :layout => :faq_layout
+end
+=end
get '/style.css' do
headers 'Content-Type' => 'text/css; charset=utf-8'
scss :style