From 7bbe4c444523f281d07f79aa8d0a4719668c3c80 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Sat, 20 Mar 2021 00:14:10 +0100 Subject: manuscript update --- scripts/lazar-cv-predictions.rb | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) (limited to 'scripts/lazar-cv-predictions.rb') diff --git a/scripts/lazar-cv-predictions.rb b/scripts/lazar-cv-predictions.rb index 9236bec..9f94776 100755 --- a/scripts/lazar-cv-predictions.rb +++ b/scripts/lazar-cv-predictions.rb @@ -1,31 +1,8 @@ #!/usr/bin/env ruby -predictions = {} -minsim = ARGV[1].to_f -minsim ||= 0 -Dir[File.join(ARGV[0],"crossvalidation","*","test","predictions")].each do |pred| - File.readlines(pred).each_with_index do |l,i| - smi,m,pred,pa,pi,maxsim,n = l.split(",") - predictions[smi] = [pred,maxsim.to_f] - end -end -lines = File.readlines(File.join("mutagenicity","mutagenicity.csv")) -lines.shift -lines.each do |line| - smi,exp = line.chomp.split(",") - if predictions[smi] - if predictions[smi].first == "1" and exp == "1" and predictions[smi].last >= minsim - puts [smi,"TP"].join(",") - elsif predictions[smi].first == "0" and exp == "0" and predictions[smi].last >= minsim - puts [smi,"TN"].join(",") - elsif predictions[smi].first == "1" and exp == "0" and predictions[smi].last >= minsim - puts [smi,"FP"].join(",") - elsif predictions[smi].first == "0" and exp == "1" and predictions[smi].last >= minsim - puts [smi,"FN"].join(",") - else - puts [smi,"NA"].join(",") - end - else - puts [smi,"NA"].join(",") - end +thresh = ARGV[1].to_f +thresh ||= 0 +File.readlines(ARGV[0]).each do |pred| + smi,c,maxsim = pred.split(",") + puts [smi,c].join(",") if maxsim.to_f > thresh end -- cgit v1.2.3