summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-04-28 11:05:05 +0200
committerChristoph Helma <helma@in-silico.ch>2016-04-28 11:05:05 +0200
commitacf19c81e345ceccde834653a0f0edce27827958 (patch)
tree058ae154e0f167991518f486913067f4bc648725 /test
parent32d767ee7cfcc19337892551906950621f348174 (diff)
compound classification fixed
Diffstat (limited to 'test')
-rw-r--r--test/classification.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/classification.rb b/test/classification.rb
index 7412714..99fde3b 100644
--- a/test/classification.rb
+++ b/test/classification.rb
@@ -4,7 +4,7 @@ class LazarClassificationTest < MiniTest::Test
def test_lazar_classification
training_dataset = Dataset.from_csv_file File.join(DATA_DIR,"hamster_carcinogenicity.csv")
- model = Model::LazarClassification.create training_dataset
+ model = Model::LazarClassification.create training_dataset.features.first, training_dataset
[ {
:compound => OpenTox::Compound.from_inchi("InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H"),
@@ -25,8 +25,8 @@ class LazarClassificationTest < MiniTest::Test
compound = Compound.from_smiles "CCO"
prediction = model.predict compound
- assert_equal ["false"], prediction[:database_activities]
assert_equal "true", prediction[:value]
+ assert_equal ["false"], prediction[:database_activities]
# make a dataset prediction
compound_dataset = OpenTox::Dataset.from_csv_file File.join(DATA_DIR,"EPAFHM.mini.csv")
@@ -35,7 +35,10 @@ class LazarClassificationTest < MiniTest::Test
cid = prediction_dataset.compounds[7].id.to_s
assert_equal "Could not find similar compounds with experimental data in the training dataset.", prediction_dataset.predictions[cid][:warning]
- cid = prediction_dataset.compounds[9].id.to_s
+ prediction_dataset.predictions.each do |cid,pred|
+ assert_equal "Could not find similar compounds with experimental data in the training dataset.", pred[:warning] if pred[:value].nil?
+ end
+ cid = Compound.from_smiles("CCOC(=O)N").id.to_s
assert_equal "1 compounds have been removed from neighbors, because they have the same structure as the query compound.", prediction_dataset.predictions[cid][:warning]
# cleanup
[training_dataset,model,compound_dataset,prediction_dataset].each{|o| o.delete}