diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-02-14 17:46:14 +0100 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-02-14 17:46:14 +0100 |
commit | ebaeedc374729ffb737fdc9bd5b1166548678036 (patch) | |
tree | ef2983d8f9c0df713f7ae84a54f9af859fda486f | |
parent | 6a720662721f3c7b67d41189cb8966929b30a048 (diff) |
set cookie in reports, hack for ambit, new examples
-rwxr-xr-x | EXAMPLES | 34 | ||||
-rwxr-xr-x | lib/ot_predictions.rb | 7 | ||||
-rwxr-xr-x | report/report_application.rb | 3 | ||||
-rwxr-xr-x | validation/validation_service.rb | 22 |
4 files changed, 36 insertions, 30 deletions
@@ -17,7 +17,7 @@ get list of available validations >>> curl <validation_service> -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -31,7 +31,7 @@ get validation >>> curl <validation_service>/<validation_id> -supported accept-headers: "text/x-yaml" and "application/rdf-xml" +supported accept-headers: "text/x-yaml" and "application/rdf+xml" validate model on test-dateset @@ -45,7 +45,7 @@ validate model on test-dateset optional params: test_target_dataset_uri, default is test_dataset_uri -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -67,7 +67,7 @@ optional params: algorithm_params, default is empty test_target_dataset_uri, default is test_dataset_uri -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -90,7 +90,7 @@ algorithm_params, default is empty split_ratio, default is 0.67 random_seed, default is 1 -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -111,7 +111,7 @@ optional params: algorithm_params, default is empty random_seed, default is 1 -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -123,7 +123,7 @@ get list of available crossvalidations >>> curl <validation_service>/crossvalidation -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -137,7 +137,7 @@ get crossvalidation >>> curl <validation_service>/crossvalidation/<crossvalidation_id> -supported accept-headers: "text/x-yaml" and "application/rdf-xml" +supported accept-headers: "text/x-yaml" and "application/rdf+xml" validate an algorithm on a dataset via crossvalidation @@ -159,7 +159,7 @@ num_folds, default is 10 random_seed, default is 1 stratified, default is false -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -176,7 +176,7 @@ get list of available report types >>> curl <validation_service>/report -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -190,7 +190,7 @@ get list of available reports of type validation >>> curl <validation_service>/report/validation -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -219,7 +219,7 @@ create validation report from validation >>> curl -X POST -d validation_uris="<validation_service>/<validation_id>" \ <validation_service>/report/validation -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -231,7 +231,7 @@ get list of available reports of type crossvalidation >>> curl <validation_service>/report/crossvalidation -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -260,7 +260,7 @@ create crossvalidation report from crossvalidation >>> curl -X POST -d validation_uris="<validation_service>/crossvalidation/<crossvalidation_id>" \ <validation_service>/report/crossvalidation -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -275,7 +275,7 @@ manually format html report This explicity invokes the report convertion to html, with css-style-sheet as parameter. -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -319,7 +319,7 @@ get list of available qmrf report >>> curl <validation_service>/reach_report/qmrf -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) @@ -334,7 +334,7 @@ create a QMRF from a model >>> curl -X POST -d model_uri="<model_uri>" \ <validation_service>/reach_report/qmrf -result example (accept-header: application/rdf-xml) +result example (accept-header: application/rdf+xml) <<< not yet supported result example (accept-header: text/uri-list) diff --git a/lib/ot_predictions.rb b/lib/ot_predictions.rb index 537f0b8..9b1ee51 100755 --- a/lib/ot_predictions.rb +++ b/lib/ot_predictions.rb @@ -55,7 +55,7 @@ module Lib @compounds = test_dataset.compounds LOGGER.debug "test dataset size: "+@compounds.size.to_s raise "test dataset is empty "+test_dataset_uri.to_s unless @compounds.size>0 - class_values = feature_type=="classification" ? OpenTox::Feature.new(prediction_feature).domain : nil + class_values = feature_type=="classification" ? OpenTox::Feature.find(prediction_feature, subjectid).domain : nil actual_values = [] @compounds.each do |c| @@ -147,12 +147,13 @@ module Lib def classification_value(dataset, compound, feature, class_values) v = value(dataset, compound, feature) i = class_values.index(v) - raise "illegal class_value of predicted value "+v.to_s+" class: "+v.class.to_s unless v==nil or i!=nil + raise "illegal class_value of prediction (value is '"+v.to_s+"', class is '"+v.class.to_s+"'), possible values are "+ + class_values.inspect unless v==nil or i!=nil i end def value(dataset, compound, feature) - + return nil if dataset.data_entries[compound]==nil if feature==nil v = dataset.data_entries[compound].values[0] else diff --git a/report/report_application.rb b/report/report_application.rb index 1a4504d..ab3d91b 100755 --- a/report/report_application.rb +++ b/report/report_application.rb @@ -76,7 +76,6 @@ end get '/report/:type/:id' do - perform do |rs| accept_header = request.env['HTTP_ACCEPT'] @@ -90,6 +89,8 @@ get '/report/:type/:id' do result = body(File.new(report)) end end + + response.set_cookie("subjectid", @subjectid) end #OpenTox::Authorization.whitelist( Regexp.new("/report/.*/[0-9]+/.*"),"GET") diff --git a/validation/validation_service.rb b/validation/validation_service.rb index 944bed6..d917a96 100755 --- a/validation/validation_service.rb +++ b/validation/validation_service.rb @@ -138,16 +138,20 @@ module Validation self.algorithm_uri = model.metadata[OT.algorithm] end - dependentVariables = model.metadata[OT.dependentVariables] - if self.prediction_feature - raise OpenTox::NotFoundError.new "error validating model: model.dependent_variable != validation.prediction_feature ("+ - dependentVariables.to_s+" != "+self.prediction_feature+"), model-metadata is "+model.metadata.inspect if self.prediction_feature!=dependentVariables + if self.prediction_feature and model.uri=~/ambit2\/model/ + LOGGER.warn "REMOVE AMBIT HACK TO __NOT__ RELY ON DEPENDENT VARIABLE" else - raise OpenTox::NotFoundError.new "model has no dependentVariables specified, please give prediction feature for model validation" unless dependentVariables - #self.attributes = { :prediction_feature => model.dependentVariables } - #self.save! - #self.update :prediction_feature => model.dependentVariables - self.prediction_feature = model.metadata[OT.dependentVariables] + dependentVariables = model.metadata[OT.dependentVariables] + if self.prediction_feature + raise OpenTox::NotFoundError.new "error validating model: model.dependent_variable != validation.prediction_feature ("+ + dependentVariables.to_s+" != "+self.prediction_feature+"), model-metadata is "+model.metadata.inspect if self.prediction_feature!=dependentVariables + else + raise OpenTox::NotFoundError.new "model has no dependentVariables specified, please give prediction feature for model validation" unless dependentVariables + #self.attributes = { :prediction_feature => model.dependentVariables } + #self.save! + #self.update :prediction_feature => model.dependentVariables + self.prediction_feature = model.metadata[OT.dependentVariables] + end end prediction_dataset_uri = "" |