diff options
author | Christoph Helma <helma@in-silico.ch> | 2021-02-22 23:43:40 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2021-02-22 23:43:40 +0100 |
commit | eca6889b784583bc0e9fb338d7b53d4c9b530dc4 (patch) | |
tree | fbb7c6d42ac61964c2f4e70f23e081d691b7d50c /scripts/tensorflow-cv-predictions.rb | |
parent | ed83d4c5347ebf43b2de55782b290b66bada4561 (diff) |
new scripts and files added
Diffstat (limited to 'scripts/tensorflow-cv-predictions.rb')
-rwxr-xr-x | scripts/tensorflow-cv-predictions.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/tensorflow-cv-predictions.rb b/scripts/tensorflow-cv-predictions.rb new file mode 100755 index 0000000..370a299 --- /dev/null +++ b/scripts/tensorflow-cv-predictions.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby + +predictions = {} +lines = File.readlines(ARGV[0]) +lines.shift +lines.each do |line| + smi,prob = line.chomp.split(",") + prob.to_f < 0.5 ? predictions[smi] = 0 : predictions[smi] = 1 +end +lines = File.readlines(File.join("mutagenicity","mutagenicity.csv")) +lines.shift +lines.each do |line| + smi,exp = line.chomp.split(",") + if predictions[smi] == 1 and exp == "1" + puts [smi,"TP"].join(",") + elsif predictions[smi] == 0 and exp == "0" + puts [smi,"TN"].join(",") + elsif predictions[smi] == 1 and exp == "0" + puts [smi,"FP"].join(",") + elsif predictions[smi] == 0 and exp == "1" + puts [smi,"FN"].join(",") + else + puts [smi,"NA"].join(",") + end +end |