summaryrefslogtreecommitdiff
path: root/fminer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'fminer.rb')
-rw-r--r--fminer.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/fminer.rb b/fminer.rb
index 36e242e..620e147 100644
--- a/fminer.rb
+++ b/fminer.rb
@@ -87,6 +87,7 @@ end
# Creates same features for dataset <dataset_uri> that have been created
# with fminer in dataset <feature_dataset_uri>
+# accept params[:nr_hits] as used in other fminer methods
post '/fminer/:method/match?' do
raise OpenTox::BadRequestError.new "feature_dataset_uri not given" unless params[:feature_dataset_uri]
raise OpenTox::BadRequestError.new "dataset_uri not given" unless params[:dataset_uri]
@@ -101,7 +102,12 @@ post '/fminer/:method/match?' do
res_dataset.add_compound(c)
comp = OpenTox::Compound.new(c)
f_dataset.features.each do |f,m|
- res_dataset.add(c,f,1) if comp.match?(m[OT.smarts])
+ if params[:nr_hits] == "true"
+ hits = comp.match_hits([m[OT.smarts]])
+ res_dataset.add(c,f,hits[m[OT.smarts]]) if hits[m[OT.smarts]]
+ else
+ res_dataset.add(c,f,1) if comp.match?(m[OT.smarts])
+ end
end
end
res_dataset.save