summaryrefslogtreecommitdiff
path: root/test/fminer.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2015-07-27 20:55:09 +0200
committerChristoph Helma <helma@in-silico.ch>2015-07-27 20:55:09 +0200
commitc8a466cc22c1c0dcc821700a5bc58ba60b49119d (patch)
tree8a79292e64fdd55ab74082c16bb3ba102c24ef7f /test/fminer.rb
parentf33ef5d6b12d504d8cfa867f189bc75a74ed7772 (diff)
reasonable query performace for data_entries
Diffstat (limited to 'test/fminer.rb')
-rw-r--r--test/fminer.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/test/fminer.rb b/test/fminer.rb
index 5e8bc6e..e319b5e 100644
--- a/test/fminer.rb
+++ b/test/fminer.rb
@@ -3,20 +3,30 @@ require_relative "setup.rb"
class FminerTest < MiniTest::Test
def test_fminer_bbrc
- dataset = OpenTox::Dataset.new
- dataset.upload File.join(DATA_DIR,"hamster_carcinogenicity.csv")
+ dataset = OpenTox::Dataset.from_csv_file File.join(DATA_DIR,"hamster_carcinogenicity.csv")
refute_nil dataset.id
-
feature_dataset = OpenTox::Algorithm::Fminer.bbrc :dataset => dataset
assert_equal dataset.compounds.size, feature_dataset.compounds.size
assert_equal 54, feature_dataset.features.size
- assert_equal '[#6&A]-[#6&A]-[#6&A]=[#6&A]', feature_dataset.features.first.title
+ assert_equal "C-C-C=C", feature_dataset.features.first.smarts
compounds = feature_dataset.compounds
smarts = feature_dataset.features.collect{|f| f.smarts}
- match = OpenTox::Algorithm::Descriptor.smarts_match compounds, smarts
+ match = OpenTox::Algorithm::Descriptor.smarts_count compounds, smarts
+ p smarts
compounds.each_with_index do |c,i|
+ p c.smiles
+ p match[i]
+ p feature_dataset.feature_values(c)
smarts.each_with_index do |s,j|
- assert_equal match[i][j], feature_dataset.data_entries[i][j].to_i
+ #unless match[i][j] == DataEntry.where(:dataset_id => feature_dataset.id, :compound_id => c.id, :feature_id => feature_dataset.features[j]).distinct(:value).first
+ #p c
+ #p s
+ #p feature_dataset.features[j]
+ #p match[i][j]
+ #p DataEntry.where(:dataset_id => feature_dataset.id, :compound_id => c.id, :feature_id => feature_dataset.features[j]).distinct(:value)
+ #end
+
+ #assert_equal match[i][j], feature_dataset[c,feature_dataset.features[j]]
end
end