summaryrefslogtreecommitdiff
path: root/validation
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-02-19 11:28:29 +0100
committermguetlein <martin.guetlein@gmail.com>2011-02-19 11:28:29 +0100
commite77fd138b4de5e467ded21ef075828e2b04e7928 (patch)
treebfbf27fae3084681110e3bd32c30792f0b3df250 /validation
parent299552130b7deb821f7de544f153a9ebf00929db (diff)
add subject-id to to-html, minor changes
Diffstat (limited to 'validation')
-rwxr-xr-xvalidation/validation_application.rb22
-rwxr-xr-xvalidation/validation_test.rb67
2 files changed, 71 insertions, 18 deletions
diff --git a/validation/validation_application.rb b/validation/validation_application.rb
index 9b517cf..e07acf0 100755
--- a/validation/validation_application.rb
+++ b/validation/validation_application.rb
@@ -22,7 +22,7 @@ get '/crossvalidation/?' do
"Use the POST method to perform a crossvalidation."
post_params = [[:dataset_uri,:algorithm_uri,:prediction_feature,[:num_folds,10],[:random_seed,1],[:stratified,false],[:algorithm_params,""]]]
content_type "text/html"
- OpenTox.text_to_html uri_list,related_links,description,post_params
+ OpenTox.text_to_html uri_list,@subjectid,related_links,description,post_params
else
content_type "text/uri-list"
uri_list
@@ -101,7 +101,7 @@ get '/crossvalidation/:id' do
description =
"A crossvalidation resource."
content_type "text/html"
- OpenTox.text_to_html crossvalidation.to_yaml,related_links,description
+ OpenTox.text_to_html crossvalidation.to_yaml,@subjectid,related_links,description
when /application\/x-yaml|\*\/\*/
content_type "application/x-yaml"
crossvalidation.to_yaml
@@ -139,7 +139,7 @@ get '/crossvalidation/:id/statistics' do
description =
"The averaged statistics for the crossvalidation."
content_type "text/html"
- OpenTox.text_to_html v.to_yaml,related_links,description
+ OpenTox.text_to_html v.to_yaml,@subjectid,related_links,description
else
content_type "application/x-yaml"
v.to_yaml
@@ -196,7 +196,7 @@ get '/crossvalidation/:id/predictions' do
related_links =
"All crossvalidations: "+url_for("/crossvalidation",:full)+"\n"+
"Correspoding crossvalidation: "+url_for("/crossvalidation/"+params[:id],:full)
- OpenTox.text_to_html p, related_links, description
+ OpenTox.text_to_html p,@subjectid, related_links, description
else
content_type "text/x-yaml"
p
@@ -226,7 +226,7 @@ get '/?' do
"A validation web service for the OpenTox project ( http://opentox.org ).\n"+
"In the root directory (this is where you are now), a list of all validation resources is returned."
content_type "text/html"
- OpenTox.text_to_html uri_list,related_links,description
+ OpenTox.text_to_html uri_list,@subjectid,related_links,description
else
content_type "text/uri-list"
uri_list
@@ -274,7 +274,7 @@ get '/test_set_validation' do
"To perform a test-set-validation use the POST method."
post_params = [[:model_uri, :test_dataset_uri, [:test_target_dataset_uri,"same-as-test_dataset_uri"], [:prediction_feature, "dependent-variable-of-model"]]]
content_type "text/html"
- OpenTox.text_to_html uri_list,related_links,description,post_params
+ OpenTox.text_to_html uri_list,@subjectid,related_links,description,post_params
else
content_type "text/uri-list"
uri_list
@@ -323,7 +323,7 @@ get '/training_test_validation' do
:prediction_feature,
[:algorithm_params, ""]]]
content_type "text/html"
- OpenTox.text_to_html uri_list,related_links,description,post_params
+ OpenTox.text_to_html uri_list,@subjectid,related_links,description,post_params
else
content_type "text/uri-list"
uri_list
@@ -371,7 +371,7 @@ get '/bootstrapping' do
[:algorithm_params, ""],
[:random_seed, 1]]]
content_type "text/html"
- OpenTox.text_to_html uri_list,related_links,description,post_params
+ OpenTox.text_to_html uri_list,@subjectid,related_links,description,post_params
else
content_type "text/uri-list"
uri_list
@@ -423,7 +423,7 @@ get '/training_test_split' do
[:random_seed, 1],
[:split_ratio, 0.66]]]
content_type "text/html"
- OpenTox.text_to_html uri_list,related_links,description,post_params
+ OpenTox.text_to_html uri_list,@subjectid,related_links,description,post_params
else
content_type "text/uri-list"
uri_list
@@ -502,7 +502,7 @@ get '/:id/predictions' do
related_links =
"All validations: "+url_for("/",:full)+"\n"+
"Correspoding validation: "+url_for("/"+params[:id],:full)
- OpenTox.text_to_html p.to_array.to_yaml, related_links, description
+ OpenTox.text_to_html p.to_array.to_yaml,@subjectid, related_links, description
else
content_type "text/x-yaml"
p.to_array.to_yaml
@@ -548,7 +548,7 @@ get '/:id' do
"Get validation predictions: "+url_for("/"+params[:id]+"/predictions",:full)+"\n"+
"All validations: "+url_for("/",:full)+"\n"+
"All validation reports: "+url_for("/report/validation",:full)
- OpenTox.text_to_html validation.to_yaml,related_links,description
+ OpenTox.text_to_html validation.to_yaml,@subjectid,related_links,description
else #default is yaml
content_type "application/x-yaml"
validation.to_yaml
diff --git a/validation/validation_test.rb b/validation/validation_test.rb
index e39dbeb..3f10ca2 100755
--- a/validation/validation_test.rb
+++ b/validation/validation_test.rb
@@ -20,10 +20,10 @@ LOGGER.datetime_format = "%Y-%m-%d %H:%M:%S "
LOGGER.formatter = Logger::Formatter.new
if AA_SERVER
- #TEST_USER = "mgtest"
- #TEST_PW = "mgpasswd"
- TEST_USER = "guest"
- TEST_PW = "guest"
+ TEST_USER = "mgtest"
+ TEST_PW = "mgpasswd"
+ #TEST_USER = "guest"
+ #TEST_PW = "guest"
SUBJECTID = OpenTox::Authorization.authenticate(TEST_USER,TEST_PW)
raise "could not log in" unless SUBJECTID
puts "logged in: "+SUBJECTID.to_s
@@ -60,6 +60,10 @@ class ValidationTest < Test::Unit::TestCase
begin
$test_case = self
+# prediction_feature = "https://ambit.uni-plovdiv.bg:8443/ambit2/feature/26221"
+# puts OpenTox::Feature.find(prediction_feature).domain.inspect
+# exit
+
# begin
# #OpenTox::RestClientWrapper.get "http://local-ot/validation/runtime-error",{:accept => "application/rdf+xml"}
# puts OpenTox::RestClientWrapper.post "http://opentox.ntua.gr:4000/model/0d8a9a27-3481-4450-bca1-d420a791de9d",
@@ -151,12 +155,61 @@ class ValidationTest < Test::Unit::TestCase
# val = wait_for_task(uri)
# puts val
# get "/"+val.split("/")[-1]
-
+
+# post "/validate_datasets",{
+# :test_dataset_uri=>"http://opentox.informatik.uni-freiburg.de/dataset/409",
+# :prediction_dataset_uri=>"http://opentox.informatik.uni-freiburg.de/dataset/410",
+# :test_target_dataset_uri=>"https://ambit.uni-plovdiv.bg:8443/ambit2/dataset/R401560",
+# :prediction_feature=>"https://ambit.uni-plovdiv.bg:8443/ambit2/feature/22190",
+# :predicted_feature=>"https://ambit.uni-plovdiv.bg:8443/ambit2/feature/218304",
+# :regression=>"true",
+# :subjectid=>SUBJECTID}
+# #:model_uri=>"http://local-ot/model/31"}
+# #:regression=>"true"}
+# # :classification=>"true"}
+# uri = last_response.body
+# val = wait_for_task(uri)
+# puts val
+# #get "/"+val.split("/")[-1]
+
+
+
+ #ambit_service = "https://ambit.uni-plovdiv.bg:8443/ambit2"
+ #https%3A%2F%2Fambit.uni-plovdiv.bg%3A8443%2Fambit2
+
+# post "/validate_datasets",{
+# :test_dataset_uri=>ambit_service+"/dataset/R401577?max=50",
+# :prediction_dataset_uri=>ambit_service+"/dataset/R401577?max=50&feature_uris[]="+CGI.escape(ambit_service)+"%2Fmodel%2F35194%2Fpredicted",
+# #:test_target_dataset_uri=>ambit_service+"/dataset/R401560",
+# :prediction_feature=>ambit_service+"/feature/26221",
+# :predicted_feature=>ambit_service+"/feature/218699",
+# :classification=>"true",
+# :subjectid=>SUBJECTID}
+# #:model_uri=>"http://local-ot/model/31"}
+# #:regression=>"true"}
+# # :classification=>"true"}
+# uri = last_response.body
+# val = wait_for_task(uri)
+# puts val
+# #get "/"+val.split("/")[-1]
+
+
# d = OpenTox::Dataset.find("https://ambit.uni-plovdiv.bg:8443/ambit2/dataset/R545",SUBJECTID)
# puts d.compounds.inspect
# exit
+
+# f = File.new("data/ambit-dataset.rdf")
+# d = ValidationExamples::Util.upload_dataset(f, SUBJECTID)
+# puts d
+
+# d = OpenTox::Dataset.find("https://ambit.uni-plovdiv.bg:8443/ambit2/dataset/R401560",SUBJECTID)
+# #puts d.compounds.to_yaml
+# #puts d.features.keys.to_yaml
+# puts d.to_yaml
+# d2 = d.split(d.compounds[0..5], d.features.keys[0..1], {}, SUBJECTID)
+# puts d2.to_yaml
- run_test("21a")#,:validation_uri=>"http://local-ot/validation/253") #,"http://local-ot/validation/28")#,"http://local-ot/validation/394");
+ run_test("1b")#,:validation_uri=>"http://local-ot/validation/253") #,"http://local-ot/validation/28")#,"http://local-ot/validation/394");
#run_test("3b",:validation_uri=>"http://local-ot/validation/crossvalidation/45") #,{:dataset_uri => "http://local-ot/dataset/773", :prediction_feature => "http://local-ot/dataset/773/feature/Hamster%20Carcinogenicity"})
@@ -175,7 +228,7 @@ class ValidationTest < Test::Unit::TestCase
#puts OpenTox::Authorization.list_policy_uris(SUBJECTID).inspect
-# run_test("16b") #,{:dataset_uri => "http://local-ot/dataset/313", :prediction_feature => "http://local-ot/dataset/313/feature/repdose_classification"})
+ #run_test("19d") #,{:dataset_uri => "http://local-ot/dataset/313", :prediction_feature => "http://local-ot/dataset/313/feature/repdose_classification"})
# model = OpenTox::Model::Generic.find("http://local-ot/majority/class/model/58")
# OpenTox::QMRFReport.create(model)