summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2011-10-11 12:37:14 +0200
committermr <mr@mrautenberg.de>2011-10-11 12:37:14 +0200
commit680b552ce6d135a1730f83eb23da44ae244c2aa8 (patch)
treed4a4f5b9edce67794d3fd4ef7155425a9d24d5e9
parent99a50ecb6c6cbff678048c2f60eafcfe476c1b64 (diff)
endpoint for external dataset
-rw-r--r--application.rb6
-rw-r--r--helper.rb4
-rw-r--r--model.rb2
-rw-r--r--views/model.haml3
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