From b8bb12c8a163c238d7d4387c1914e2100bb660df Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Thu, 12 May 2016 15:23:01 +0200 Subject: enm study import fixed --- scripts/mmol2-log10.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/mmol2-log10.rb b/scripts/mmol2-log10.rb index f28ff8f..ec0fdf5 100755 --- a/scripts/mmol2-log10.rb +++ b/scripts/mmol2-log10.rb @@ -3,18 +3,21 @@ require_relative '../lib/lazar' include OpenTox newfile = ARGV[0].sub(/.csv/,"_log10.csv") p newfile -i = 1 CSV.open(newfile, "wb") do |csv| + i = 1 CSV.read(ARGV[0]).each do |line| smi,mmol = line - if mmol.numeric? - c = Compound.from_smiles smi - mmol = -Math.log10(mmol.to_f) - csv << [smi, mmol] + if i == 1 + csv << [smi, "-log10(#{mmol})"] else - #csv << [smi, "-log10(#{mmol})"] - p "Line #{i}: '#{mmol}' is not a numeric value." - csv << [smi, ""] + if mmol.numeric? + c = Compound.from_smiles smi + mmol = -Math.log10(mmol.to_f) + csv << [smi, mmol] + else + p "Line #{i}: '#{mmol}' is not a numeric value." + #csv << [smi, ""] + end end i += 1 end -- cgit v1.2.3