summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2010-07-14 13:56:50 +0200
committerChristoph Helma <helma@in-silico.ch>2010-07-14 13:56:50 +0200
commitfc0f9e5fa3b521397d2026e649c4873600026838 (patch)
treef5bb033210085328e47ba3acac0c0f6906b30519 /application.rb
parent5eec83b4196c84b32817d045d31b0815db38fb05 (diff)
model creation working, validation report generation fails for large datasets
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/application.rb b/application.rb
index c18a394..5d5435e 100644
--- a/application.rb
+++ b/application.rb
@@ -51,21 +51,27 @@ end
get '/model/:id/:view/?' do
response['Content-Type'] = 'text/plain'
model = ToxCreateModel.get(params[:id])
- model = model.process
+ model.process
+ model.save
begin
case params[:view]
when "model"
haml :model, :locals=>{:model=>model}, :layout => false
- when "classification_validation"
- haml :classification_validation, :locals=>{:model=>model}, :layout => false
- when "regression_validation"
- haml :regression_validation, :locals=>{:model=>model}, :layout => false
+ when /validation/
+ if model.type == "classification"
+ haml :classification_validation, :locals=>{:model=>model}, :layout => false
+ elsif model.type == "regression"
+ haml :regression_validation, :locals=>{:model=>model}, :layout => false
+ else
+ return "Unknown model type '#{model.type}'"
+ end
else
- return "render error"
+ return "unable to render model: id #{params[:id]}, view #{params[:view]}"
+ #return "render error"
end
rescue
- return "unable to render model"
+ return "unable to render model: id #{params[:id]}, view #{params[:view]}"
end
end
@@ -145,7 +151,7 @@ post '/upload' do # create a new model
@model.warnings += "<p>Duplicated structures (all structures/activities used for model building, please make sure, that the results were obtained from <em>independent</em> experiments):</p>" + duplicate_warnings unless duplicate_warnings.empty?
@model.save
- flash[:notice] = "Model creation started. Please be patient - model building may take up to several hours depending on the number and size of the input molecules."
+ flash[:notice] = "Model creation and validation started - this may last up to several hours depending on the number and size of the training compounds."
redirect url_for('/models')
# TODO: check for empty model