diff options
author | Christoph Helma <helma@in-silico.ch> | 2015-09-17 14:56:25 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2015-09-17 14:56:25 +0200 |
commit | 6ac119c32cef094d4f1c2fb5c2daa4e274401f70 (patch) | |
tree | 9028a2922b68a5e2175687fe48caa1b1119e5939 /test/compound.rb | |
parent | 2fdecbed76c4db8dfe3f10f825fed9772e653197 (diff) |
neighbor calculation moved to Compound class
Diffstat (limited to 'test/compound.rb')
-rw-r--r-- | test/compound.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/compound.rb b/test/compound.rb index 6deba4e..6a3c696 100644 --- a/test/compound.rb +++ b/test/compound.rb @@ -108,4 +108,30 @@ print c.sdf assert_equal c.openbabel_fingerprint("FP4").size, c.fp4.size end end + + def test_fingerprint_neighbors + types = ["FP2", "FP3", "FP4", "MACCS"] + min_sim = 0.7 + training_dataset = Dataset.from_csv_file File.join(DATA_DIR,"EPAFHM.csv") + [ + "CC(=O)CC(C)C#N", + "CC(=O)CC(C)C", + "C(=O)CC(C)C#N", + ].each do |smi| + c = OpenTox::Compound.from_smiles smi + p c.smiles + types.each do |type| + p type + neighbors = c.fingerprint_neighbors({:type => type, :training_dataset_id => training_dataset.id, :min_sim => min_sim}) + p neighbors.collect{|n| [Compound.find(n.first).smiles,n.last]} + if type == "FP4" + fp4_neighbors = c.neighbors + neighbors.each do |n| + p [Compound.find(n.first).smiles,n.last] unless fp4_neighbors.include?(n) + assert_includes fp4_neighbors, n + end + end + end + end + end end |