From 339dab8df535b4e23c476382fe48b11752882600 Mon Sep 17 00:00:00 2001 From: Andreas Maunz Date: Fri, 28 Sep 2012 12:06:17 +0200 Subject: Support for structures with missing activity --- bbrc-sample | 2 +- fminer.rb | 34 +++++++++++++++++++++++++++++++--- last-utils | 2 +- libfminer | 2 +- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/bbrc-sample b/bbrc-sample index 0d1d349..1552da2 160000 --- a/bbrc-sample +++ b/bbrc-sample @@ -1 +1 @@ -Subproject commit 0d1d349ac33ae2fcc1bbdf31617ed9132c7527ca +Subproject commit 1552da28ebbcbfb2128e5561cd8aff2ef534219e diff --git a/fminer.rb b/fminer.rb index fcdeec9..2f4cb67 100644 --- a/fminer.rb +++ b/fminer.rb @@ -334,10 +334,20 @@ post '/fminer/bbrc/?' do end # Add fminer results to feature dataset along owd + all_compounds_owd = @@fminer.training_dataset.compounds.collect { |v| + times_in_fminer_compounds_owd = fminer_compounds_owd.count(v) + times_in_fminer_compounds_owd == 0 ? v : Array.new(times_in_fminer_compounds_owd,v) + }.flatten + if (params[:complete_entries] == "true") + all_compounds_owd.each { |compound| + feature_dataset.add_compound(compound) # add compounds *in order* + } + end + which_row = @@fminer.training_dataset.compounds.inject({}) { |h,id| h[id]=0; h } unused_compounds = fminer_compounds_owd - fminer_results.keys (fminer_compounds_owd - unused_compounds).each { |compound| - feature_dataset.add_compound(compound) # add compounds *in order* + feature_dataset.add_compound(compound) unless (params[:complete_entries] == "true") fminer_results[compound].each { |feature, values| feature_dataset.add( compound, feature, values[which_row[compound]] ) } @@ -617,7 +627,16 @@ post '/fminer/last/?' do matches, counts, used_compounds = lu.match_rb(@@fminer.smi,smarts,hit_count,complete_entries) # creates instantiations # Collect compounds, in order with duplicates (owd) and put in dataset - used_compounds.each { |idx| feature_dataset.add_compound(@@fminer.compounds[idx]) } + fminer_compounds_owd = used_compounds.collect { |idx| @@fminer.compounds[idx] } + if (complete_entries) + all_compounds_owd = @@fminer.training_dataset.compounds.collect { |v| + times_in_fminer_compounds_owd = fminer_compounds_owd.count(v) + times_in_fminer_compounds_owd == 0 ? v : Array.new(times_in_fminer_compounds_owd,v) + }.flatten + all_compounds_owd.each { |compound| feature_dataset.add_compound(compound) } + else + fminer_compounds_owd.each { |compound| feature_dataset.add_compound(compound) } + end matches.each do |smarts, ids| metadata = calc_metadata (smarts, ids, counts[smarts], @@last, nil, value_map, params) @@ -687,7 +706,16 @@ post '/fminer/:method/match?' do matches, counts, used_compounds = LU.new.match_rb(@@fminer.smi, smarts, hit_count, complete_entries) if smarts.size>0 # Collect compounds, in order with duplicates (owd) and put in dataset - used_compounds.each { |idx| feature_dataset.add_compound(@@fminer.compounds[idx]) } + fminer_compounds_owd = used_compounds.collect { |idx| @@fminer.compounds[idx] } + if (complete_entries) + all_compounds_owd = @@fminer.training_dataset.compounds.collect { |v| + times_in_fminer_compounds_owd = fminer_compounds_owd.count(v) + times_in_fminer_compounds_owd == 0 ? v : Array.new(times_in_fminer_compounds_owd,v) + }.flatten + all_compounds_owd.each { |compound| feature_dataset.add_compound(compound) } + else + fminer_compounds_owd.each { |compound| feature_dataset.add_compound(compound) } + end matches.each do |smarts, ids| metadata = calc_metadata (smarts, ids, counts[smarts], @@last, feature_dataset.uri, value_map, params) diff --git a/last-utils b/last-utils index efcc3f4..01b21b0 160000 --- a/last-utils +++ b/last-utils @@ -1 +1 @@ -Subproject commit efcc3f41dd9e2f590a1520dfee3bf709120b2e41 +Subproject commit 01b21b06f93b112a8f745531e38486609f5ac575 diff --git a/libfminer b/libfminer index 4577dca..a86af9e 160000 --- a/libfminer +++ b/libfminer @@ -1 +1 @@ -Subproject commit 4577dcacb352af3fdca925714dc570de9e02582c +Subproject commit a86af9e55225c5c04403efd0209f7aca800a9827 -- cgit v1.2.3