-- cgit v1.2.3 From e89f8b15f6125c91e847c11c7c257285a6d3e1d4 Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 4 Jul 2011 17:17:40 +0200 Subject: split compound tests --- compound.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/compound.rb b/compound.rb index ef87845..048e012 100644 --- a/compound.rb +++ b/compound.rb @@ -4,26 +4,39 @@ require 'test/unit' class CompoundTest < Test::Unit::TestCase - def test_compound - + def test_compound_from_smiles_0 c = OpenTox::Compound.from_smiles "F[B-](F)(F)F.[Na+]" assert_equal "InChI=1S/BF4.Na/c2-1(3,4)5;/q-1;+1", c.inchi #assert_equal "[Na+].F[B-](F)(F)F", c.smiles # still does not work on 64bit machines + end + + def test_compound_from_smiles_1 c = OpenTox::Compound.from_smiles "CC(=O)CC(C)C#N" assert_equal "InChI=1S/C6H9NO/c1-5(4-7)3-6(2)8/h5H,3H2,1-2H3", c.inchi assert_equal "CC(CC(=O)C)C#N", c.to_smiles + end + + def test_compound_from_name c = OpenTox::Compound.from_name "Benzene" assert_equal "InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H", c.inchi assert_equal "c1ccccc1", c.to_smiles + end + + def test_compound_from_smiles_2 c = OpenTox::Compound.from_smiles "N#[N+]C1=CC=CC=C1.F[B-](F)(F)F" assert_equal "InChI=1S/C6H5N2.BF4/c7-8-6-4-2-1-3-5-6;2-1(3,4)5/h1-5H;/q+1;-1", c.inchi assert_equal "N#[N+]c1ccccc1.F[B-](F)(F)F", c.to_smiles + end + + def test_compound_from_inchi c = OpenTox::Compound.from_inchi "InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H" assert_equal "c1ccccc1", c.to_smiles + end + + def test_compound_ambit c = OpenTox::Compound.new "http://apps.ideaconsult.net:8080/ambit2/compound/144036" assert_equal "InChI=1S/C6H11NO2/c1-3-5-6(4-2)7(8)9/h5H,3-4H2,1-2H3", c.inchi assert_equal "CCC=C(CC)N(=O)=O", c.to_smiles end - end -- cgit v1.2.3 From e4ba76a3dab8bf9fc099524588ecc6f99c5e5e50 Mon Sep 17 00:00:00 2001 From: Andreas Maunz Date: Wed, 6 Jul 2011 14:55:47 +0200 Subject: Fixed lazar test according to MR's hints --- lazar.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lazar.rb b/lazar.rb index 62a512b..b038619 100644 --- a/lazar.rb +++ b/lazar.rb @@ -65,7 +65,7 @@ class LazarTest < Test::Unit::TestCase def test_create_regression_model create_model :dataset_uri => @@regression_training_dataset.uri predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") - assert_equal 0.421.round_to(3), @predictions.first.value(@compounds.first).round_to(3) + assert_equal 0.421.round_to(2), @predictions.first.value(@compounds.first).round_to(2) assert_equal 0.262.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3) assert_equal 123, @predictions.first.neighbors(@compounds.first).size cleanup @@ -80,16 +80,6 @@ class LazarTest < Test::Unit::TestCase cleanup end - def test_create_regression_prop_mlr_model - create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop" - predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN") - assert_equal 0.262.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3) - assert_equal 123, @predictions.first.neighbors(@compounds.first).size - assert_equal 131, @model.features.size - assert_equal 0.374.round_to(3), @predictions.first.value(@compounds.first).round_to(3) - cleanup - end - def test_classification_model create_model :dataset_uri => @@classification_training_dataset.uri puts @model.uri -- cgit v1.2.3 From 54eb829e260162636d9ec770e9175c9cafc012c0 Mon Sep 17 00:00:00 2001 From: Andreas Maunz Date: Thu, 7 Jul 2011 15:06:27 +0200 Subject: Adjusted Lazar test --- fminer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fminer.rb b/fminer.rb index 4927af2..07a6023 100644 --- a/fminer.rb +++ b/fminer.rb @@ -302,14 +302,14 @@ end if c.to_s.scan('feature/bbrc/92').size > 0 assert_equal e['http://www.opentox.org/api/1.1#effect'], "2" assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 0.99 - assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#6&a]:[#6&a](:[#6&a])(:[#6&a]:[#6&a]:[#6&a]:[#6&a]-[#16&A])" + assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#7&A]-[#6&a](:[#6&a]:[#6&a]:[#6&a])(:[#6&a]:[#6&a]-[#16&A])" end } @dataset.features.each { |c,e| if c.to_s.scan('feature/bbrc/42').size > 0 assert_equal e['http://www.opentox.org/api/1.1#effect'], "0" assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 0.99 - assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#6&a]:[#6&a](:[#7&a]:[#6&a])(:[#6&a]:[#6&a])" + assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#6&a]:[#6&a]:[#6&a]:[#6&a]:[#6&a]:[#7&a]:[#6&a]" end } cleanup -- cgit v1.2.3 From 1262d20d7f9f8ffe8e5dee9c2f6a5da3a6748808 Mon Sep 17 00:00:00 2001 From: Andreas Maunz Date: Tue, 12 Jul 2011 15:06:15 +0200 Subject: Fixed effects --- fminer.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fminer.rb b/fminer.rb index 4927af2..c8cece6 100644 --- a/fminer.rb +++ b/fminer.rb @@ -56,7 +56,7 @@ class FminerTest < Test::Unit::TestCase # assert some values @dataset.features.each { |c,e| if c.to_s.scan('feature/bbrc/31').size > 0 - assert_equal e['http://www.opentox.org/api/1.1#effect'], "false" + assert_equal e['http://www.opentox.org/api/1.1#effect'], 2 assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 0.97 assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#6&a]-[#6&a]:[#6&a]:[#6&a]:[#6&a]-[#7&A]" end @@ -132,7 +132,7 @@ class FminerTest < Test::Unit::TestCase # assert some values @dataset.features.each { |c,e| if c.to_s.scan('feature/last/3').size > 0 - assert_equal e['http://www.opentox.org/api/1.1#effect'], "true" + assert_equal e['http://www.opentox.org/api/1.1#effect'], 2 assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 0.99 assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#8&A]=[#6&A]-[#6&A]-[#6&A]" end @@ -213,7 +213,7 @@ end # assert some values @dataset.features.each { |c,e| if c.to_s.scan('feature/bbrc/31').size > 0 - assert_equal e['http://www.opentox.org/api/1.1#effect'], "false" + assert_equal e['http://www.opentox.org/api/1.1#effect'], 2 assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 0.97 assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#6&a]-[#6&a]:[#6&a]:[#6&a]:[#6&a]-[#7&A]" end @@ -256,7 +256,7 @@ end # assert some values @dataset.features.each { |c,e| if c.to_s.scan('feature/bbrc/31').size > 0 - assert_equal e['http://www.opentox.org/api/1.1#effect'], "false" + assert_equal e['http://www.opentox.org/api/1.1#effect'], 2 assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 0.99 assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#8&A]-[#6&A]-[#7&A]-[#7&A]=[#8&A]" end @@ -293,23 +293,23 @@ end # assert some values @dataset.features.each { |c,e| if c.to_s.scan('feature/bbrc/0').size > 0 - assert_equal e['http://www.opentox.org/api/1.1#effect'], "1" + assert_equal e['http://www.opentox.org/api/1.1#effect'], 2 assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 1.00 assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#6&A]-[#6&A](=[#6&A])(-[#6&A])" end } @dataset.features.each { |c,e| if c.to_s.scan('feature/bbrc/92').size > 0 - assert_equal e['http://www.opentox.org/api/1.1#effect'], "2" + assert_equal e['http://www.opentox.org/api/1.1#effect'], 1 assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 0.99 - assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#6&a]:[#6&a](:[#6&a])(:[#6&a]:[#6&a]:[#6&a]:[#6&a]-[#16&A])" + assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#7&A]-[#6&a](:[#6&a]:[#6&a]:[#6&a])(:[#6&a]:[#6&a]-[#16&A])" end } @dataset.features.each { |c,e| if c.to_s.scan('feature/bbrc/42').size > 0 - assert_equal e['http://www.opentox.org/api/1.1#effect'], "0" + assert_equal e['http://www.opentox.org/api/1.1#effect'], 3 assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 0.99 - assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#6&a]:[#6&a](:[#7&a]:[#6&a])(:[#6&a]:[#6&a])" + assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#6&a]:[#6&a]:[#6&a]:[#6&a]:[#6&a]:[#7&a]:[#6&a]" end } cleanup @@ -343,14 +343,14 @@ end # assert some values @dataset.features.each { |c,e| if c.to_s.scan('feature/last/54').size > 0 - assert_equal e['http://www.opentox.org/api/1.1#effect'], "0" + assert_equal e['http://www.opentox.org/api/1.1#effect'], 1 assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 0.99 assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#7&A;$([#7&A](=[#8&A])=[#8&A]),$([#7&A](-[#6&a])=[#8&A])](~*)=[#8&A]" end } @dataset.features.each { |c,e| if c.to_s.scan('feature/last/48').size > 0 - assert_equal e['http://www.opentox.org/api/1.1#effect'], "1" + assert_equal e['http://www.opentox.org/api/1.1#effect'], 2 assert_equal e['http://www.opentox.org/api/1.1#pValue'].to_f.round_to(2), 0.99 assert_equal e['http://www.opentox.org/api/1.1#smarts'], "[#6&A]=[#6&A](-[#6&A])-[#6&A]" end -- cgit v1.2.3