summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2012-09-28 12:06:17 +0200
committerAndreas Maunz <andreas@maunz.de>2012-09-28 12:07:14 +0200
commit339dab8df535b4e23c476382fe48b11752882600 (patch)
tree7f89b99644900140e53090ab41e3d0beabd9cf33
parent3a46dbf6687771a246f935b77522a50042e2c80d (diff)
Support for structures with missing activity
m---------bbrc-sample0
-rw-r--r--fminer.rb34
m---------last-utils0
m---------libfminer0
4 files changed, 31 insertions, 3 deletions
diff --git a/bbrc-sample b/bbrc-sample
-Subproject 0d1d349ac33ae2fcc1bbdf31617ed9132c7527c
+Subproject 1552da28ebbcbfb2128e5561cd8aff2ef534219
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
-Subproject efcc3f41dd9e2f590a1520dfee3bf709120b2e4
+Subproject 01b21b06f93b112a8f745531e38486609f5ac57
diff --git a/libfminer b/libfminer
-Subproject 4577dcacb352af3fdca925714dc570de9e02582
+Subproject a86af9e55225c5c04403efd0209f7aca800a982