diff options
author | Andreas Maunz <andreas@maunz.de> | 2012-05-14 13:46:24 +0200 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2012-05-14 13:46:24 +0200 |
commit | 6b43dc4ecb085c67ebaee5f9a64dd88188b56754 (patch) | |
tree | 460577f4f7f0f2acff988971af6331af045d0d30 | |
parent | d0ddfd6e685bc8050b12644b628beb7f232fa266 (diff) |
matching service uses last-utils
m--------- | bbrc-sample | 0 | ||||
-rw-r--r-- | fminer.rb | 18 |
2 files changed, 10 insertions, 8 deletions
diff --git a/bbrc-sample b/bbrc-sample -Subproject ad0ffc43072ed9b0d0b90ea5e435241cd5d4fa3 +Subproject 6110fc9cf34766444e94482fba08878c19c87d3 @@ -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 |