summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@ot-dev.in-silico.ch>2011-03-03 12:36:10 +0000
committerroot <root@ot-dev.in-silico.ch>2011-03-03 12:36:10 +0000
commitd0dbdc711cddff823db456136a2604ab1912ee53 (patch)
tree1675dbc426fb09a3b2a4d67d0ad88664d52f94be
parent6e9d20a1417ad2f4548194d226f6b3f2b3c47036 (diff)
remaining merge conflicts removed
-rwxr-xr-xapplication.rb8
-rwxr-xr-xdb/migrate/000_drop_validations.rb13
-rwxr-xr-xdb/migrate/001_init_validation.rb65
-rwxr-xr-xdb/migrate/002_init_reports.rb36
-rwxr-xr-xexample.rb39
-rwxr-xr-xreport/report_test.rb2
-rwxr-xr-xtest/test_examples.rb8
-rwxr-xr-xtest/test_examples_util.rb8
8 files changed, 9 insertions, 170 deletions
diff --git a/application.rb b/application.rb
index f543167..ad9653a 100755
--- a/application.rb
+++ b/application.rb
@@ -3,6 +3,14 @@ gem "opentox-ruby", "~> 0"
[ 'sinatra', 'sinatra/url_for', 'opentox-ruby' ].each do |lib|
require lib
end
+['dm-core', 'dm-serializer', 'dm-timestamps', 'dm-types', 'dm-migrations', 'dm-validations' ].each{|lib| require lib }
+DataMapper.setup(:default, {
+ :adapter => CONFIG[:database][:adapter],
+ :database => CONFIG[:database][:database],
+ :username => CONFIG[:database][:username],
+ :password => CONFIG[:database][:password],
+ :host => CONFIG[:database][:host]})
+set :lock, true
#unless(defined? LOGGER)
#LOGGER = Logger.new(STDOUT)
diff --git a/db/migrate/000_drop_validations.rb b/db/migrate/000_drop_validations.rb
deleted file mode 100755
index fb70967..0000000
--- a/db/migrate/000_drop_validations.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-
-class DropValidations < ActiveRecord::Migration
- def self.up
- # drop_table :validations if table_exists? :validations
- # drop_table :crossvalidations if table_exists? :crossvalidations
- end
-
- def self.down
- #drop_table :validations if table_exists? :validations
- #drop_table :crossvalidations if table_exists? :crossvalidations
- end
-end
-
diff --git a/db/migrate/001_init_validation.rb b/db/migrate/001_init_validation.rb
deleted file mode 100755
index 2189568..0000000
--- a/db/migrate/001_init_validation.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-
-class InitValidation < ActiveRecord::Migration
- def self.up
-
- create_table :crossvalidations do |t|
-
- [:algorithm_uri,
- :dataset_uri ].each do |p|
- t.column p, :string, :limit => 255
- end
-
- [:created_at ].each do |p|
- t.column p, :datetime
- end
-
- [:num_folds,
- :random_seed ].each do |p|
- t.column p, :integer, :null => false
- end
-
- [ :stratified, :finished ].each do |p|
- t.column p, :boolean, :null => false
- end
- end
-
- create_table :validations do |t|
-
- [:validation_type,
- :model_uri,
- :algorithm_uri,
- :training_dataset_uri,
- :test_target_dataset_uri,
- :test_dataset_uri,
- :prediction_dataset_uri,
- :prediction_feature].each do |p|
- t.column p, :string, :limit => 255
- end
-
- [:created_at ].each do |p|
- t.column p, :datetime
- end
-
- [:real_runtime, :num_instances, :num_without_class, :num_unpredicted, :crossvalidation_id, :crossvalidation_fold ].each do |p|
- t.column p, :integer
- end
-
- [:real_runtime, :percent_without_class, :percent_unpredicted ].each do |p|
- t.column p, :float
- end
-
- [:classification_statistics, :regression_statistics].each do |p|
- t.column(p, :text, :limit => 16320)
- end
-
- [ :finished ].each do |p|
- t.column p, :boolean, :null => false
- end
- end
- end
-
- def self.down
- drop_table :validations if table_exists? :validations
- drop_table :crossvalidations if table_exists? :crossvalidations
- end
-end
diff --git a/db/migrate/002_init_reports.rb b/db/migrate/002_init_reports.rb
deleted file mode 100755
index dcf44a1..0000000
--- a/db/migrate/002_init_reports.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-
-class InitReports < ActiveRecord::Migration
- def self.up
-
- create_table :report_datum do |t|
-
- [:report_uri,
- :report_type
- ].each do |p|
- t.column p, :string, :limit => 255
- end
-
- [:created_at ].each do |p|
- t.column p, :datetime
- end
-
- [:validation_uris, :crossvalidation_uris, :model_uris, :algorithm_uris].each do |p|
- t.column(p, :text, :limit => 16320)
- end
- end
- end
-
- def self.down
- drop_table :report_datum if table_exists? :report_datum
- if CONFIG[:reports] and CONFIG[:reports][:report_dir]
- ["validation", "crossvalidation", "algorithm_comparison"].each do |t|
- dir = File.join(CONFIG[:reports][:report_dir],t)
- if File.exist?(dir)
- puts "deleting dir "+dir.to_s
- FileUtils.rm_rf(dir)
- end
- end
- end
- end
-end
-
diff --git a/example.rb b/example.rb
index c691375..07151a8 100755
--- a/example.rb
+++ b/example.rb
@@ -58,44 +58,6 @@ class Example
#TODO
subjectid = nil
-<<<<<<< HEAD
- #delete_all(CONFIG[:services]["opentox-dataset"])
- log OpenTox::RestClientWrapper.delete CONFIG[:services]["opentox-dataset"]
-
- log "upload dataset"
- halt 400,"File not found: "+@@file.path.to_s unless File.exist?(@@file.path)
- data = File.read(@@file.path)
- data_uri = OpenTox::RestClientWrapper.post(CONFIG[:services]["opentox-dataset"],{:content_type => @@file_type},data).chomp("\n")
-
- log "train-test-validation"
- #delete_all(CONFIG[:services]["opentox-model"])
- OpenTox::RestClientWrapper.delete CONFIG[:services]["opentox-model"]
-
- split_params = Validation::Util.train_test_dataset_split(data_uri, URI.decode(@@feature), 0.9, 1)
- v = Validation::Validation.new :training_dataset_uri => split_params[:training_dataset_uri],
- :test_dataset_uri => split_params[:test_dataset_uri],
- :test_target_dataset_uri => data_uri,
- :prediction_feature => URI.decode(@@feature),
- :algorithm_uri => @@alg
- v.validate_algorithm( @@alg_params )
-
- log "crossvalidation"
- cv = Validation::Crossvalidation.new({ :dataset_uri => data_uri, :algorithm_uri => @@alg, :num_folds => 5, :stratified => false })
- cv.create_cv_datasets( URI.decode(@@feature) )
- cv.perform_cv( @@alg_params )
-
- log "create validation report"
- rep = Reports::ReportService.new(File.join(CONFIG[:services]["opentox-validation"],"report"))
- rep.delete_all_reports("validation")
- rep.create_report("validation",v.validation_uri)
-
- log "create crossvalidation report"
- rep.delete_all_reports("crossvalidation")
- rep.create_report("crossvalidation",cv.crossvalidation_uri)
-
- log "done"
- @@summary
-=======
task = OpenTox::Task.create("prepare examples", "n/a") do |task|
@@summary = ""
#delete validations
@@ -163,7 +125,6 @@ class Example
@@summary
end
return_task(task)
->>>>>>> mguetlein/test
end
# performs all curl calls listed in examples after ">>>", next line is added if line ends with "\"
diff --git a/report/report_test.rb b/report/report_test.rb
index 57e867b..571d6d8 100755
--- a/report/report_test.rb
+++ b/report/report_test.rb
@@ -344,4 +344,4 @@ end
#
# end
#
-#end
+#end \ No newline at end of file
diff --git a/test/test_examples.rb b/test/test_examples.rb
index 9476ed7..3c6f00e 100755
--- a/test/test_examples.rb
+++ b/test/test_examples.rb
@@ -188,11 +188,7 @@ module ValidationExamples
class LazarHamsterTrainingTest < HamsterTrainingTest
def initialize
@algorithm_uri = File.join(CONFIG[:services]["opentox-algorithm"],"lazar")
-<<<<<<< HEAD
- @algorithm_params = "feature_generation_uri="+File.join(CONFIG[:services]["opentox-algorithm"],"fminer")
-=======
@algorithm_params = "feature_generation_uri="+File.join(CONFIG[:services]["opentox-algorithm"],"fminer/bbrc")
->>>>>>> mguetlein/test
super
end
end
@@ -220,11 +216,7 @@ module ValidationExamples
class LazarHamsterCrossvalidation < HamsterCrossvalidation
def initialize
@algorithm_uri = File.join(CONFIG[:services]["opentox-algorithm"],"lazar")
-<<<<<<< HEAD
- @algorithm_params = "feature_generation_uri="+File.join(CONFIG[:services]["opentox-algorithm"],"fminer")
-=======
@algorithm_params = "feature_generation_uri="+File.join(CONFIG[:services]["opentox-algorithm"],"fminer/bbrc")
->>>>>>> mguetlein/test
super
end
end
diff --git a/test/test_examples_util.rb b/test/test_examples_util.rb
index 56bee6b..a5f2867 100755
--- a/test/test_examples_util.rb
+++ b/test/test_examples_util.rb
@@ -66,11 +66,7 @@ module ValidationExamples
$test_case.post uri,params
return wait($test_case.last_response.body)
else
-<<<<<<< HEAD
- return OpenTox::RestClientWrapper.post(File.join(CONFIG[:services]["opentox-validation"],uri),params)
-=======
return OpenTox::RestClientWrapper.post(File.join(CONFIG[:services]["opentox-validation"],uri),params,nil,waiting_task).to_s
->>>>>>> mguetlein/test
end
end
@@ -93,11 +89,7 @@ module ValidationExamples
$test_case.delete uri,{:subjectid => SUBJECTID},'HTTP_ACCEPT' => accept_header
return wait($test_case.last_response.body)
else
-<<<<<<< HEAD
- return OpenTox::RestClientWrapper.get(File.join(CONFIG[:services]["opentox-validation"],uri),{:accept => accept_header})
-=======
return OpenTox::RestClientWrapper.delete(File.join(CONFIG[:services]["opentox-validation"],uri),{:accept => accept_header,:subjectid => SUBJECTID})
->>>>>>> mguetlein/test
end
end