From eca6889b784583bc0e9fb338d7b53d4c9b530dc4 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Mon, 22 Feb 2021 23:43:40 +0100 Subject: new scripts and files added --- scripts/lazar-cv-predictions.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 scripts/lazar-cv-predictions.rb (limited to 'scripts/lazar-cv-predictions.rb') diff --git a/scripts/lazar-cv-predictions.rb b/scripts/lazar-cv-predictions.rb new file mode 100755 index 0000000..9236bec --- /dev/null +++ b/scripts/lazar-cv-predictions.rb @@ -0,0 +1,31 @@ +#!/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 +end -- cgit v1.2.3