From 2911ebe2c818a33513d263654f3a0c609e631404 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Thu, 6 May 2010 17:18:15 +0200 Subject: adding ch's test service to yaml --- lib/dataset.rb | 6 ++++-- lib/model.rb | 2 +- lib/task.rb | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/dataset.rb b/lib/dataset.rb index ff07a6f..9304eec 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -15,7 +15,7 @@ module OpenTox def self.find(uri, accept_header=nil) unless accept_header - if uri.match(@@config[:services]["opentox-dataset"]) + if uri.match(@@config[:services]["opentox-dataset"]) || uri=~ /188.40.32.88/ accept_header = 'text/x-yaml' else accept_header = "application/rdf+xml" @@ -51,6 +51,8 @@ module OpenTox # returns uri of new dataset def create_new_dataset( new_compounds, new_features, new_title, new_creator ) + raise "no new compounds selected" unless new_compounds and new_compounds.size>0 + # load require features if ((defined? @dirty_features) && (@dirty_features - new_features).size > 0) (@dirty_features - new_features).each{|f| load_feature_values(f)} @@ -62,7 +64,7 @@ module OpenTox dataset.features = new_features dataset.compounds = new_compounds - # Ccopy dataset data for compounds and features + # Copy dataset data for compounds and features # PENDING: why storing feature values in an array? new_compounds.each do |c| data_c = [] diff --git a/lib/model.rb b/lib/model.rb index 684873b..74bb598 100644 --- a/lib/model.rb +++ b/lib/model.rb @@ -76,7 +76,7 @@ module OpenTox elsif @uri =~/ambit2/ and @title =~ /pKa/ return false elsif @uri =~/majority/ - return @uri =~ /class/ + return (@uri =~ /class/) != nil else raise "unknown model, uri:'"+@uri.to_s+"' title:'"+@title.to_s+"'" end diff --git a/lib/task.rb b/lib/task.rb index 9cfba88..181b895 100644 --- a/lib/task.rb +++ b/lib/task.rb @@ -160,7 +160,7 @@ module OpenTox task.completed(result) rescue => ex LOGGER.error "task failed: "+ex.message - #LOGGER.error ": "+ex.backtrace.join("\n") + LOGGER.error ": "+ex.backtrace.join("\n") task.error(ex.message) end end -- cgit v1.2.3