summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2011-11-22 15:05:23 +0100
committerAndreas Maunz <andreas@maunz.de>2011-11-22 15:05:23 +0100
commite84c9779d91c200beb846742c3478aafa18fdfee (patch)
tree974bd0afe1812ac0d3d2d1f73da7094fdacaa18a
parentb687279988fb32de7b6aca45f60ba5f25607600c (diff)
Added tests for PC
-rw-r--r--algorithm.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/algorithm.rb b/algorithm.rb
index 9f56387..3bdc6de 100644
--- a/algorithm.rb
+++ b/algorithm.rb
@@ -136,6 +136,19 @@ class AlgorithmTest < Test::Unit::TestCase
assert_in_delta res1, 1.4958008960423, 10E-06
assert_equal res1, res2
end
+
+ def test_pc_descriptors
+ ds = OpenTox::Algorithm::Neighbors.get_props_pc({ :neighbors => [ {:compound => "http://toxcreate3.in-silico.ch:8082/compound/InChI=1S/C5H8O2/c1-4(2)5(6)7-3/h1H2,2-3H3"}, {:compound => "http://toxcreate3.in-silico.ch:8082/compound/InChI=1S/C4H8O/c1-4(2)3-5/h3-4H,1-2H3"} ], :compound => "http://toxcreate3.in-silico.ch:8082/compound/InChI=1S/C12H12N2O3/c1-2-12(8-6-4-3-5-7-8)9(15)13-11(17)14-10(12)16/h3-7H,2H2,1H3,(H2,13,14,15,16,17)", :pc_group => "constitutional" } )
+ ds[0][0].each_with_index {|v,i|
+ assert_in_delta v, [1.78999996185303, 0.0, 1.0, 13.0, nil, 3.0, 4.0, 2.0, 0.0, 5.0, 0.0, 0.541899979114532, 0.0, 0.879999995231628, 0.293655604124069, 21.380500793457][i], 0.0001
+ }
+ ds[0][1].each_with_index {|v,i|
+ assert_in_delta v, [1.78999996185303, 0.0, 2.0, 15.0, nil, 3.0, 6.0, 5.0, 0.0, 7.0, 0.0, 1.16509997844696, 0.0, 0.71399998664856, 1.35745799541473, 26.4176006317139][i], 0.0001
+ }
+ ds[1].each_with_index {|v,i|
+ assert_in_delta v, [2.23000001907349, 0.0, 2.0, 29.0, nil, 2.0, 18.0, 8.0, 6.0, 2.0, 6.0, -1.12360000610352, 2.0, 3.76099991798401, 1.26247692108154, 34.4664001464844][i], 0.0001
+ }
+ end