summaryrefslogtreecommitdiff
path: root/test/compound.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-10-05 14:10:25 +0200
committerChristoph Helma <helma@in-silico.ch>2016-10-05 14:10:25 +0200
commit016403f7db0dedf8237f29af41312b5ff2720c30 (patch)
treeb276ad7bbb11ff73049b9c7cfeda15c140846436 /test/compound.rb
parent5d4e5e463c2b87241bbb56e4658e1e26c0ed084f (diff)
compound and descriptor tests fixed
Diffstat (limited to 'test/compound.rb')
-rw-r--r--test/compound.rb21
1 files changed, 16 insertions, 5 deletions
diff --git a/test/compound.rb b/test/compound.rb
index c9faa21..c78acb1 100644
--- a/test/compound.rb
+++ b/test/compound.rb
@@ -85,7 +85,13 @@ print c.sdf
refute_nil c.fingerprint("MP2D")
end
c = d.compounds[371]
- n = c.fingerprint_neighbors({:type => "FP4", :min_sim => 0.7, :dataset_id => d.id, :prediction_feature_id => d.features.first.id })
+ n = c.neighbors(
+ descriptors: {:method => "fingerprint", :type => "FP4"},
+ similarity: {:method => "Algorithm::Similarity.tanimoto", :min => 0.7},
+ dataset_id: d.id,
+ prediction_feature_id: d.features.first.id
+ )
+
assert n.size >= 8, "Neighbors size (#{n.size}) should be larger than 7"
end
@@ -118,7 +124,12 @@ print c.sdf
].each do |smi|
c = OpenTox::Compound.from_smiles smi
types.each do |type|
- neighbors = c.fingerprint_neighbors({:type => type, :dataset_id => training_dataset.id, :min_sim => min_sim, :prediction_feature_id => training_dataset.features.first.id})
+ neighbors = c.fingerprint_neighbors(
+ descriptors: {:method => "fingerprint",:type => type},
+ dataset_id: training_dataset.id,
+ similarity: {:method => "Algorithm::Similarity.tanimoto", :min => min_sim},
+ prediction_feature_id: training_dataset.features.first.id
+ )
unless type == "FP2" and smi == "CC(=O)CC(C)C#N" or smi == "C(=O)CC(C)C#N" and (type == "FP2" or type == "MACCS")
refute_empty neighbors
end
@@ -197,8 +208,8 @@ print c.sdf
def test_physchem
c = OpenTox::Compound.from_smiles "CC(=O)CC(C)C"
- assert_equal PhysChem::OBDESCRIPTORS.size, c.physchem.size
- assert_equal PhysChem::OBDESCRIPTORS.size, c.physchem(PhysChem.openbabel_descriptors).size
- assert_equal PhysChem::unique_descriptors.size, c.physchem(PhysChem.unique_descriptors).size
+ assert_equal PhysChem::OBDESCRIPTORS.size, c.calculated_physchem.size
+ assert_equal PhysChem::OBDESCRIPTORS.size, c.calculated_physchem(PhysChem.openbabel_descriptors).size
+ assert_equal PhysChem::unique_descriptors.size, c.calculated_physchem(PhysChem.unique_descriptors).size
end
end