summaryrefslogtreecommitdiff
path: root/lib/bbrc.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2015-08-13 18:57:11 +0200
committerChristoph Helma <helma@in-silico.ch>2015-08-13 18:57:11 +0200
commitd0850e2983a219da214a67190fe881c7650f532f (patch)
treea917334a1a70823dc979a27e453b2598e98c8027 /lib/bbrc.rb
parent6ab86c253ba0eb79b9e6a20effa2d18626accf2b (diff)
majority of tests working
Diffstat (limited to 'lib/bbrc.rb')
-rw-r--r--lib/bbrc.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/bbrc.rb b/lib/bbrc.rb
index 6a2eed7..c83b9b3 100644
--- a/lib/bbrc.rb
+++ b/lib/bbrc.rb
@@ -26,6 +26,7 @@ module OpenTox
minfreq = params[:min_frequency]
else
per_mil = 5 # value from latest version
+ per_mil = 8 # as suggested below
i = training_dataset.feature_ids.index prediction_feature.id
nr_labeled_cmpds = training_dataset.data_entries.select{|de| !de[i].nil?}.size
minfreq = per_mil * nr_labeled_cmpds.to_f / 1000.0 # AM sugg. 8-10 per mil for BBRC, 50 per mil for LAST
@@ -65,9 +66,11 @@ module OpenTox
# add data
training_dataset.compounds.each_with_index do |compound,i|
- @bbrc.AddCompound(compound.smiles,i+1)
act = value2act[training_dataset.data_entries[i].first]
- @bbrc.AddActivity(act,i+1)
+ if act # TODO check if this works
+ @bbrc.AddCompound(compound.smiles,i+1)
+ @bbrc.AddActivity(act,i+1)
+ end
end
#g_median=@fminer.all_activities.values.to_scale.median
@@ -94,6 +97,9 @@ module OpenTox
end
p_value = f.shift
f.flatten!
+ compound_idxs = f.collect{|e| e.first.first-1}
+ # majority class
+ effect = compound_idxs.collect{|i| training_dataset.data_entries[i].first}.mode
=begin
if (!@bbrc.GetRegression)
@@ -122,7 +128,7 @@ module OpenTox
feature = OpenTox::FminerSmarts.find_or_create_by({
"smarts" => smarts,
"p_value" => p_value.to_f.abs.round(5),
- #"effect" => effect,
+ "effect" => effect,
"dataset_id" => feature_dataset.id
})
feature_dataset.feature_ids << feature.id