From 680b552ce6d135a1730f83eb23da44ae244c2aa8 Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 11 Oct 2011 12:37:14 +0200 Subject: endpoint for external dataset --- application.rb | 6 ++++++ helper.rb | 4 ++-- model.rb | 2 ++ views/model.haml | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/application.rb b/application.rb index a75c6c0..50aee72 100644 --- a/application.rb +++ b/application.rb @@ -281,6 +281,7 @@ post '/models' do # create a new model raise "#{params[:file][:filename]} has an unsupported file type." end @dataset.features[@dataset.features.keys.first][OWL.sameAs] = params[:endpoint].split(',').first if params[:endpoint] + @model.update :endpoint_uri => params[:endpoint].split(',').first, :endpoint => params[:endpoint].split(',')[1..99].to_s.gsub(/^"(.*?)"$/,'\1') if params[:endpoint] @dataset.save(@subjectid) rescue => e error "Dataset creation failed '#{e.message}'",e @@ -290,6 +291,11 @@ post '/models' do # create a new model else @prediction_feature = OpenTox::Feature.find(@dataset.features.keys.first,@subjectid) end + #else + # test when external dataset is enabled: + #if @dataset.features[@dataset.features.keys.first][OWL.sameAs] + # @model.update :endpoint_uri => @dataset.features[@dataset.features.keys.first][OWL.sameAs], :endpoint => OpenTox::Ontology::Echa.get_endpoint_name(@dataset.features[@dataset.features.keys.first][OWL.sameAs]) + #end end task.progress(10) if @dataset.compounds.size < 10 diff --git a/helper.rb b/helper.rb index 0bcde74..f45e349 100644 --- a/helper.rb +++ b/helper.rb @@ -98,7 +98,7 @@ helpers do def endpoint_option_list(max_time=3600) out = "" - tmpfile = File.join(TMP_DIR, "endpoint_option_list") + tmpfile = File.join(TMP_DIR, 'endpoint_option_list') if File.exists? tmpfile if Time.now-File.mtime(tmpfile) <= max_time f = File.open(tmpfile, 'r+') @@ -110,7 +110,7 @@ helpers do end result = endpoint_selection() if result.lines.count > 3 - f = File.new(tmpfile,"w") + f = File.new(tmpfile,'w') f.print result f.close end diff --git a/model.rb b/model.rb index bab5bde..05075f8 100644 --- a/model.rb +++ b/model.rb @@ -19,6 +19,8 @@ class ToxCreateModel < Ohm::Model attribute :training_dataset attribute :feature_dataset + attribute :endpoint_uri + attribute :endpoint #attributey :validation_task_uri attribute :validation_uri diff --git a/views/model.haml b/views/model.haml index 356ec65..fb264ca 100644 --- a/views/model.haml +++ b/views/model.haml @@ -40,6 +40,9 @@ - if model.nr_compounds %dt Training compounds: %dd= model.nr_compounds + - if model.endpoint + %dt Endpoint: + %dd= model.endpoint - if model.error_messages %dt Errors: %dd= model.error_messages -- cgit v1.2.3