From 418df9b8c5ef469df60306324f730ed4cb11667c Mon Sep 17 00:00:00 2001 From: David Vorgrimmler Date: Mon, 19 Sep 2011 15:32:17 +0200 Subject: Set nr_hits for regression as default. Minor modifications. --- fminer.rb | 6 +++--- lazar.rb | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/fminer.rb b/fminer.rb index e220b09..d06f7ac 100644 --- a/fminer.rb +++ b/fminer.rb @@ -193,7 +193,7 @@ post '/fminer/bbrc/?' do id_arrs.each { |id_count_hash| id=id_count_hash.keys[0].to_i count=id_count_hash.values[0].to_i - if params[:nr_hits] == "true" + if params[:nr_hits] feature_dataset.add(fminer.compounds[id], feature_uri, count) else feature_dataset.add(fminer.compounds[id], feature_uri, 1) @@ -281,7 +281,7 @@ post '/fminer/last/?' do lu = LU.new # AM LAST: uses last-utils here dom=lu.read(xml) # AM LAST: parse GraphML smarts=lu.smarts_rb(dom,'nls') # AM LAST: converts patterns to LAST-SMARTS using msa variant (see last-pm.maunz.de) - params[:nr_hits] != "true" ? hit_count=false: hit_count=true + params[:nr_hits] ? hit_count=true: hit_count=false matches, counts = lu.match_rb(fminer.smi,smarts,hit_count) # AM LAST: creates instantiations matches.each do |smarts, ids| @@ -314,7 +314,7 @@ post '/fminer/last/?' do feature_dataset.add_feature feature_uri, metadata end if !hit_count - ids.each { |id| feature_dataset.add(fminer.compounds[id], feature_uri, true)} + ids.each { |id| feature_dataset.add(fminer.compounds[id], feature_uri, 1)} else ids.each_with_index { |id,i| feature_dataset.add(fminer.compounds[id], feature_uri, counts[smarts][i])} end diff --git a/lazar.rb b/lazar.rb index 5de3790..c210f69 100644 --- a/lazar.rb +++ b/lazar.rb @@ -61,8 +61,7 @@ post '/lazar/?' do lazar = OpenTox::Model::Lazar.new lazar.min_sim = params[:min_sim].to_f if params[:min_sim] - lazar.nr_hits = true if params[:nr_hits] == "true" - + if prediction_feature.feature_type == "classification" @training_classes = training_activities.accept_values(prediction_feature.uri).sort @training_classes.each_with_index { |c,i| @@ -70,8 +69,18 @@ post '/lazar/?' do params[:value_map] = lazar.value_map } elsif prediction_feature.feature_type == "regression" + lazar.nr_hits = true lazar.prediction_algorithm = "Neighbors.local_svm_regression" end + + if params[:nr_hits] == "false" # if nr_hits is set optional to true/false it will return as String (but should be True/FalseClass) + lazar.nr_hits = false + params[:nr_hits] = false + elsif params[:nr_hits] == "true" + lazar.nr_hits = true + end + params[:nr_hits] = true if lazar.nr_hits + task.progress 10 if params[:feature_dataset_uri] -- cgit v1.2.3 From cf27624037577e5171056531b122d9c51baef9f3 Mon Sep 17 00:00:00 2001 From: David Vorgrimmler Date: Mon, 19 Sep 2011 16:42:08 +0200 Subject: Changed True/FalseClass back to String. --- fminer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fminer.rb b/fminer.rb index d06f7ac..3a2f755 100644 --- a/fminer.rb +++ b/fminer.rb @@ -193,7 +193,7 @@ post '/fminer/bbrc/?' do id_arrs.each { |id_count_hash| id=id_count_hash.keys[0].to_i count=id_count_hash.values[0].to_i - if params[:nr_hits] + if params[:nr_hits] == "true" feature_dataset.add(fminer.compounds[id], feature_uri, count) else feature_dataset.add(fminer.compounds[id], feature_uri, 1) @@ -281,7 +281,7 @@ post '/fminer/last/?' do lu = LU.new # AM LAST: uses last-utils here dom=lu.read(xml) # AM LAST: parse GraphML smarts=lu.smarts_rb(dom,'nls') # AM LAST: converts patterns to LAST-SMARTS using msa variant (see last-pm.maunz.de) - params[:nr_hits] ? hit_count=true: hit_count=false + params[:nr_hits] == "true" ? hit_count=true: hit_count=false matches, counts = lu.match_rb(fminer.smi,smarts,hit_count) # AM LAST: creates instantiations matches.each do |smarts, ids| -- cgit v1.2.3 From d6ddb236dbda13ba215e23ab8b1279874a8f380c Mon Sep 17 00:00:00 2001 From: David Vorgrimmler Date: Mon, 19 Sep 2011 16:58:38 +0200 Subject: Removed duplicate. String fix. --- lazar.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lazar.rb b/lazar.rb index c210f69..f4915a7 100644 --- a/lazar.rb +++ b/lazar.rb @@ -75,11 +75,11 @@ post '/lazar/?' do if params[:nr_hits] == "false" # if nr_hits is set optional to true/false it will return as String (but should be True/FalseClass) lazar.nr_hits = false - params[:nr_hits] = false + #params[:nr_hits] = false elsif params[:nr_hits] == "true" lazar.nr_hits = true end - params[:nr_hits] = true if lazar.nr_hits + params[:nr_hits] = "true" if lazar.nr_hits task.progress 10 -- cgit v1.2.3