summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2011-07-12 15:07:05 +0200
committerAndreas Maunz <andreas@maunz.de>2011-07-12 15:07:05 +0200
commitf76b716e5becb71f9fca65c229edcd703daf58ca (patch)
tree33b484c249aaca2615478a0dc47e5e88240ddd7a
parent89790a00002069c8a6d5ea2a064cbc69f4681124 (diff)
parent1262d20d7f9f8ffe8e5dee9c2f6a5da3a6748808 (diff)
Merge branch 'release/v2.1.0' into development
-rw-r--r--compound.rb19
-rw-r--r--fminer.rb22
-rw-r--r--lazar.rb12
3 files changed, 28 insertions, 25 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
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
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