diff options
author | Christoph Helma <helma@in-silico.ch> | 2016-05-12 15:23:01 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2016-05-12 15:23:01 +0200 |
commit | b8bb12c8a163c238d7d4387c1914e2100bb660df (patch) | |
tree | 791d1524e2294d8a3a38658607a644d7576784ae /scripts/mmol2-log10.rb | |
parent | 937bfbaf058aea5973927cb3bf6b51028b312ed9 (diff) |
enm study import fixed
Diffstat (limited to 'scripts/mmol2-log10.rb')
-rwxr-xr-x | scripts/mmol2-log10.rb | 19 |
1 files changed, 11 insertions, 8 deletions
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 |