diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-05-18 15:39:25 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-05-18 15:39:25 +0200 |
commit | 47d6c0af5e110a23eca9f24c56b9891cfe8680a0 (patch) | |
tree | dc56efb9681a7b684d44c49896e5390c228a9dc8 | |
parent | 1c1a2ca0ae50e2f69b9e5cc50077a3fadb0e5f2f (diff) | |
parent | ea199e2a75e3ce5f9dab07f29d6f55fdef6b860d (diff) |
Merge branch 'development' of github.com:opentox/test into development
-rw-r--r-- | authorization.rb | 9 | ||||
-rw-r--r-- | lazar.rb | 28 |
2 files changed, 35 insertions, 2 deletions
diff --git a/authorization.rb b/authorization.rb index 3772638..1d9b676 100644 --- a/authorization.rb +++ b/authorization.rb @@ -3,6 +3,10 @@ require "opentox-ruby" require "test/unit" TEST_URI = "http://only_a_test/test/" + rand(1000000).to_s +unless AA_SERVER #overwrite turned off A&A server for testing + AA_SERVER = "https://opensso.in-silico.ch" + @@subjectid = OpenTox::Authorization.authenticate(TEST_USER,TEST_PW) +end class TestOpenToxAuthorizationBasic < Test::Unit::TestCase @@ -40,7 +44,7 @@ class TestOpenToxAuthorizationLDAP < Test::Unit::TestCase end def test_02_list_user_groups - assert_kind_of Array, OpenTox::Authorization.list_groups(@@subjectid) + assert_kind_of Array, OpenTox::Authorization.list_user_groups(TEST_USER, @@subjectid) end def test_03_get_user @@ -60,6 +64,7 @@ class TestOpenToxAuthorizationLDAP < Test::Unit::TestCase policies.each do |policy| assert OpenTox::Authorization.delete_policy(policy, @@subjectid) end + assert_equal false, OpenTox::Authorization.uri_has_policy(TEST_URI, @@subjectid) end def test_02_check_policy_rules @@ -104,4 +109,4 @@ end def login OpenTox::Authorization.authenticate(TEST_USER,TEST_PW) -end
\ No newline at end of file +end @@ -72,6 +72,34 @@ class LazarTest < Test::Unit::TestCase assert_equal prediction.measured_activities(compound).first, true end + def test_classification_svm_model + + # create model + model_uri = OpenTox::Algorithm::Lazar.new.run({:dataset_uri => @@classification_training_dataset.uri, :subjectid => @@subjectid, :prediction_algorithm => "local_svm_classification"}).to_s + lazar = OpenTox::Model::Lazar.find model_uri, @@subjectid + @models << lazar + assert_equal lazar.features.size, 53 + + # single prediction + compound = OpenTox::Compound.from_smiles("c1ccccc1NN") + prediction_uri = lazar.run(:compound_uri => compound.uri, :subjectid => @@subjectid) + prediction = OpenTox::LazarPrediction.find(prediction_uri, @@subjectid) + @predictions << prediction + assert_equal prediction.value(compound), false + assert_equal prediction.confidence(compound).round_to(4), 0.4131.round_to(4) + assert_equal prediction.neighbors(compound).size, 14 + + # dataset prediction + test_dataset = OpenTox::Dataset.create_from_csv_file("data/multicolumn.csv", @@subjectid) + prediction = OpenTox::LazarPrediction.find lazar.run(:dataset_uri => test_dataset.uri, :subjectid => @@subjectid), @@subjectid + @predictions << prediction + assert_equal prediction.compounds.size, 4 + compound = OpenTox::Compound.from_smiles "CC(=Nc1ccc2c(c1)Cc1ccccc21)O" + assert_equal prediction.value(compound), nil + assert_equal prediction.measured_activities(compound).first, true + + end + def test_ambit_classification_model # create model |