diff options
author | Christoph Helma <helma@in-silico.ch> | 2010-06-28 18:44:37 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2010-06-28 18:44:37 +0200 |
commit | 1b7aa1e22b972f8d297b479319bc586033ee7385 (patch) | |
tree | dfa55aa255cac4417d08c7471a03049ccbd03f18 /lib/dataset.rb | |
parent | d505f1b33bb823be23728178175c799d2f30fcca (diff) | |
parent | 6fb9ec6db40d25d2892d4d1bb9de33e56979a945 (diff) |
Merge branch 'master' into development
Diffstat (limited to 'lib/dataset.rb')
-rw-r--r-- | lib/dataset.rb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/dataset.rb b/lib/dataset.rb index 17f0997..1254992 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -22,7 +22,6 @@ module OpenTox accept_header = "application/rdf+xml" end end - case accept_header when "application/x-yaml" d = YAML.load RestClientWrapper.get(uri.to_s.strip, :accept => 'application/x-yaml').to_s @@ -52,6 +51,7 @@ module OpenTox # returns uri of new dataset def create_new_dataset( new_compounds, new_features, new_title, new_creator ) + LOGGER.debug "create new dataset with "+new_compounds.size.to_s+"/"+compounds.size.to_s+" compounds" raise "no new compounds selected" unless new_compounds and new_compounds.size>0 # load require features @@ -69,6 +69,7 @@ module OpenTox # PENDING: why storing feature values in an array? new_compounds.each do |c| data_c = [] + raise "no data for compound '"+c.to_s+"'" if @data[c]==nil @data[c].each do |d| m = {} new_features.each do |f| @@ -76,7 +77,6 @@ module OpenTox end data_c << m end - dataset.data[c] = data_c end return dataset.save @@ -91,15 +91,16 @@ module OpenTox else return "no classification key" end - else - raise "predicted class value is not a hash\n"+ + elsif v.is_a?(Array) + raise "predicted class value is an array\n"+ "value "+v.to_s+"\n"+ "value-class "+v.class.to_s+"\n"+ "dataset "+@uri.to_s+"\n"+ "compound "+compound.to_s+"\n"+ "feature "+feature.to_s+"\n" + else + return v end - end # returns prediction confidence if available @@ -113,12 +114,14 @@ module OpenTox raise "no confidence key" end else - raise "prediction confidence value is not a hash value\n"+ - "value "+v.to_s+"\n"+ - "value-class "+v.class.to_s+"\n"+ - "dataset "+@uri.to_s+"\n"+ - "compound "+compound.to_s+"\n"+ - "feature "+feature.to_s+"\n" + LOGGER.warn "no confidence for compound: "+compound.to_s+", feature: "+feature.to_s + return 1 +# raise "prediction confidence value is not a hash value\n"+ +# "value "+v.to_s+"\n"+ +# "value-class "+v.class.to_s+"\n"+ +# "dataset "+@uri.to_s+"\n"+ +# "compound "+compound.to_s+"\n"+ +# "feature "+feature.to_s+"\n" end end @@ -173,7 +176,7 @@ module OpenTox @features.uniq! @compounds.uniq! - OpenTox::RestClientWrapper.post(@@config[:services]["opentox-dataset"],{:content_type => "application/x-yaml"},self.to_yaml).strip + OpenTox::RestClientWrapper.post(@@config[:services]["opentox-dataset"],{:content_type => "application/x-yaml"},self.to_yaml).strip end def init_dirty_features(owl) |