diff options
author | Christoph Helma <helma@in-silico.ch> | 2016-04-15 11:01:16 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2016-04-15 11:01:16 +0200 |
commit | 8aab046eb1ad39aaf10c5a8596102c35c7b2ee0b (patch) | |
tree | e3a654da5a042b7b52655be051ce70eeec2a66e7 /lib/compound.rb | |
parent | 753fcc204d93d86c76860bee6e2f7d0468c3c940 (diff) |
data_entries removed from datasets. datasets are now just containers for compounds and features, feature values have to be retrieved from substances.
Diffstat (limited to 'lib/compound.rb')
-rw-r--r-- | lib/compound.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/compound.rb b/lib/compound.rb index 55cd482..049d77b 100644 --- a/lib/compound.rb +++ b/lib/compound.rb @@ -288,8 +288,7 @@ module OpenTox training_dataset.compounds.each do |compound| candidate_fingerprint = compound.fingerprint params[:type] sim = (query_fingerprint & candidate_fingerprint).size/(query_fingerprint | candidate_fingerprint).size.to_f - feature_values = training_dataset.values(compound,prediction_feature) - neighbors << {"_id" => compound.id, "toxicities" => {prediction_feature.id.to_s => feature_values}, "tanimoto" => sim} if sim >= params[:min_sim] + neighbors << {"_id" => compound.id, "toxicities" => {prediction_feature.id.to_s => compound.toxicities[prediction_feature.id.to_s]}, "tanimoto" => sim} if sim >= params[:min_sim] end neighbors.sort!{|a,b| b["tanimoto"] <=> a["tanimoto"]} end |