diff options
author | Andreas Maunz <andreas@maunz.de> | 2011-07-21 12:29:33 +0200 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2011-07-21 12:29:33 +0200 |
commit | aa3cde05ee8467a280dfc648a7b98e736704a770 (patch) | |
tree | 6a9578909a8b66f5ef583abcbde5324176a63539 | |
parent | 3733dbfadf1872ee63ff689bedc1681366474612 (diff) |
Enabled nr_hits for get_props
-rw-r--r-- | lib/algorithm.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/algorithm.rb b/lib/algorithm.rb index c655c4b..199c4d8 100644 --- a/lib/algorithm.rb +++ b/lib/algorithm.rb @@ -564,7 +564,7 @@ module OpenTox row = [] params[:features].each do |f| if ! params[:fingerprints][n].nil? - row << (params[:fingerprints][n].include?(f) ? params[:p_values][f] : 0.0) + row << (params[:fingerprints][n].include?(f) ? (params[:p_values][f] * params[:fingerprints][n][f]) : 0.0) else row << 0.0 end @@ -573,7 +573,12 @@ module OpenTox end row = [] params[:features].each do |f| - row << (params[:compound].match([f]).size == 0 ? 0.0 : params[:p_values][f]) + if params[:nr_hits] + compound_feature_hits = params[:compound].match_hits([f]) + row << (compound_feature_hits.size == 0 ? 0.0 : (params[:p_values][f] * compound_feature_hits[f])) + else + row << (params[:compound].match([f]).size == 0 ? 0.0 : params[:p_values][f]) + end end rescue Exception => e LOGGER.debug "get_props failed with '" + $! + "'" |