diff options
author | Christoph Helma <helma@in-silico.ch> | 2011-08-04 13:55:58 +0000 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2011-08-04 13:55:58 +0000 |
commit | 304c4c484a062077bad08ca9fe3ed44d138c9416 (patch) | |
tree | 17ecb7dfa918e5c35acf2979899fd195985c45d2 /helper.rb | |
parent | 4f83500afb33612cadd7084470ab9b42dfa59cf2 (diff) |
feature highlighting and significant features fixed for generic classes and regression
Diffstat (limited to 'helper.rb')
-rw-r--r-- | helper.rb | 35 |
1 files changed, 30 insertions, 5 deletions
@@ -54,10 +54,15 @@ helpers do def sort(descriptors,value_map) features = {:activating => [], :deactivating => []} descriptors.each do |d| - if value_map[d[OT.effect]] =~ TRUE_REGEXP - features[:activating] << {:smarts => d[OT.smarts],:p_value => d[OT.pValue]} - elsif value_map[d[OT.effect]] =~ FALSE_REGEXP - features[:deactivating] << {:smarts => d[OT.smarts],:p_value => d[OT.pValue]} + if !value_map.empty? + features[:activating] << {:smarts => d[OT.smarts],:p_value => d[OT.pValue]} if d[OT.effect] == 2 + features[:deactivating] << {:smarts => d[OT.smarts],:p_value => d[OT.pValue]} if d[OT.effect] == 1 + else + if d[OT.effect] =~ TRUE_REGEXP + features[:activating] << {:smarts => d[OT.smarts],:p_value => d[OT.pValue]} + elsif d[OT.effect] =~ FALSE_REGEXP + features[:deactivating] << {:smarts => d[OT.smarts],:p_value => d[OT.pValue]} + end end end features @@ -67,7 +72,26 @@ helpers do haml :compound_image, :locals => {:compound => compound, :features => sort(descriptors,value_map)}, :layout => false end - def activity_markup(activity) + def activity_markup(activity,value_map) + if value_map and !value_map.empty? + if value_map.size == 2 + activity = value_map.index(activity) if value_map.has_value? activity + if activity.to_i == 2 + haml ".active #{value_map[activity]}", :layout => false + elsif activity.to_i == 1 + haml ".inactive #{value_map[activity]}", :layout => false + else + haml ".other #{activity.to_s}", :layout => false + end + else + haml ".other #{activity.to_s}", :layout => false + end + elsif OpenTox::Algorithm::numeric? activity + haml ".other #{sprintf('%.03g', activity.to_f)}", :layout => false + else + haml ".other #{activity.to_s}", :layout => false + end +=begin case activity.class.to_s when /Float/ haml ".other #{sprintf('%.03g', activity)}", :layout => false @@ -89,6 +113,7 @@ helpers do haml ".other #{activity.to_s}", :layout => false end end +=end end def neighbors_navigation |