diff options
author | mguetlein <martin.guetlein@gmail.com> | 2012-01-31 11:59:41 +0100 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2012-01-31 11:59:41 +0100 |
commit | 78cdd02862630c09878c5d3365b2651f9d388f41 (patch) | |
tree | 4e6365dffb3b91613710610978b5307d5e552ca9 | |
parent | 01e296c18ed62e81d442a67aca6b2893fd35e12e (diff) |
extend fminer test for nr_hits match
-rw-r--r-- | fminer.rb | 35 |
1 files changed, 27 insertions, 8 deletions
@@ -369,14 +369,33 @@ end feature_dataset_uri = OpenTox::Algorithm::Fminer::BBRC.new.run({ :dataset_uri => @@classification_training_dataset.uri, :prediction_feature => feature, :subjectid => @@subjectid}).to_s feature_dataset = OpenTox::Dataset.find(feature_dataset_uri,@@subjectid) - matched_dataset_uri = OpenTox::RestClientWrapper.post(File.join(CONFIG[:services]["opentox-algorithm"],"fminer","bbrc","match"), - {:feature_dataset_uri => feature_dataset_uri, :dataset_uri => @@multinomial_training_dataset.uri, :subjectid => @@subjectid}).to_s - matched_dataset = OpenTox::Dataset.find(matched_dataset_uri,@@subjectid) - # matched dataset should have same features as feature dataset - assert_equal feature_dataset.features.keys.sort,matched_dataset.features.keys.sort - # matched datset should have same compounds as input dataset for matching - assert_equal matched_dataset.compounds.sort,@@multinomial_training_dataset.compounds.sort - [feature_dataset_uri, matched_dataset_uri].each{|uri| OpenTox::RestClientWrapper.delete(uri,{:subjectid=>@@subjectid})} + tmp_resources = [ feature_dataset_uri ] + [true,false].each do |hits| + matched_dataset_uri = OpenTox::RestClientWrapper.post(File.join(CONFIG[:services]["opentox-algorithm"],"fminer","bbrc","match"), + {:feature_dataset_uri => feature_dataset_uri, :dataset_uri => @@multinomial_training_dataset.uri, + :nr_hits => hits, :subjectid => @@subjectid}).to_s + tmp_resources << matched_dataset_uri + matched_dataset = OpenTox::Dataset.find(matched_dataset_uri,@@subjectid) + # matched dataset should have same features as feature dataset + assert_equal feature_dataset.features.keys.sort,matched_dataset.features.keys.sort + # matched datset should have same compounds as input dataset for matching + assert_equal matched_dataset.compounds.sort,@@multinomial_training_dataset.compounds.sort + matched_dataset.compounds.each do |c| + matched_dataset.features.keys.each do |f| + if matched_dataset.data_entries[c] and matched_dataset.data_entries[c][f] + v = matched_dataset.data_entries[c][f] + if hits + assert_equal v.size,1 + assert v[0].is_a?(Integer) + assert v[0]>0 + else + assert_equal v,[1] + end + end + end + end + end + tmp_resources.each{|uri| OpenTox::RestClientWrapper.delete(uri,{:subjectid=>@@subjectid})} end end |