From 6b43dc4ecb085c67ebaee5f9a64dd88188b56754 Mon Sep 17 00:00:00 2001 From: Andreas Maunz Date: Mon, 14 May 2012 13:46:24 +0200 Subject: matching service uses last-utils --- bbrc-sample | 2 +- fminer.rb | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bbrc-sample b/bbrc-sample index ad0ffc4..6110fc9 160000 --- a/bbrc-sample +++ b/bbrc-sample @@ -1 +1 @@ -Subproject commit ad0ffc43072ed9b0d0b90ea5e435241cd5d4fa35 +Subproject commit 6110fc9cf34766444e94482fba08878c19c87d39 diff --git a/fminer.rb b/fminer.rb index ae84d75..ed595f8 100644 --- a/fminer.rb +++ b/fminer.rb @@ -132,14 +132,16 @@ post '/fminer/:method/match?' do end c_dataset.compounds.each do |c| res_dataset.add_compound(c) - comp = OpenTox::Compound.new(c) - f_dataset.features.each do |f,m| - 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 + smi = [nil]; smi += c_dataset.compounds.collect { |c| OpenTox::Compound.new(c).to_smiles } + smarts = f_dataset.features.collect { |f,m| m[OT.smarts] } + params[:nr_hits] == "true" ? hit_count=true: hit_count=false + matches, counts = LU.new.match_rb(smi, smarts, hit_count) + f_dataset.features.each do |f,m| + if (matches[m[OT.smarts]] && matches[m[OT.smarts]].size>0) + matches[m[OT.smarts]].each_with_index {|id,idx| + res_dataset.add(c_dataset.compounds[id-1],f,counts[m[OT.smarts]][idx]) + } end end res_dataset.save @subjectid -- cgit v1.2.3