diff options
-rw-r--r-- | application.rb | 8 | ||||
-rw-r--r-- | helper.rb | 6 | ||||
-rw-r--r-- | model.rb | 2 | ||||
-rw-r--r-- | views/create.haml | 4 | ||||
-rw-r--r-- | views/model.haml | 3 |
5 files changed, 17 insertions, 6 deletions
diff --git a/application.rb b/application.rb index 3b2fa74..50aee72 100644 --- a/application.rb +++ b/application.rb @@ -280,6 +280,8 @@ post '/models' do # create a new model else 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 @@ -289,8 +291,12 @@ 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 error "Too few compounds to create a prediction model. Did you provide compounds in SMILES format and classification activities as described in the #{link_to "instructions", "/help"}? As a rule of thumb you will need at least 100 training compounds for nongeneric datasets. A lower number could be sufficient for congeneric datasets." @@ -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 @@ -134,7 +134,7 @@ helpers do end def endpoint_selection() - out = "<span id='endpoint_label'></span><input type='button' id='endpoint_list_button' value='select endpoint' /> \n + out = "<span id='endpoint_label'></span><input type='button' id='endpoint_list_button' value='Select endpoint' /> \n <div id='div_endpoint'>\n" out += "<b>Please select:</b>\n" out += endpoint_level @@ -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/create.haml b/views/create.haml index acfa098..a26ae05 100644 --- a/views/create.haml +++ b/views/create.haml @@ -15,11 +15,11 @@ $("#endpoint_list_button").click(function() { if ($("div#div_endpoint").is(":hidden")) { $("div#div_endpoint").slideDown("slow"); - $("input#endpoint_list_button").val("OK"); + $("input#endpoint_list_button").val("Hide"); $("input#endpoint_list_button").toggleClass("ok_button", true); } else { $("div#div_endpoint").slideUp("slow"); - $("input#endpoint_list_button").val("select endpoint"); + $("input#endpoint_list_button").val("Select endpoint"); $("input#endpoint_list_button").toggleClass("ok_button", false); } }); 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 |