From 05386e748270c337c66f6f379317ea4b25905236 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Wed, 4 May 2016 19:24:42 +0200 Subject: first reasonable results for nanoparticle crossvalidation --- scripts/mg2mmol.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 scripts/mg2mmol.rb (limited to 'scripts/mg2mmol.rb') diff --git a/scripts/mg2mmol.rb b/scripts/mg2mmol.rb new file mode 100644 index 0000000..dc6b953 --- /dev/null +++ b/scripts/mg2mmol.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +require_relative '../lazar/lib/lazar' +include OpenTox +newfile = ARGV[0].sub(/.csv/,"_mmol.csv") +p newfile +CSV.open(newfile, "wb") do |csv| + CSV.read(ARGV[0]).each do |line| + smi,mg = line + if mg.numeric? + c = Compound.from_smiles smi + mmol = c.mg_to_mmol mg.to_f + csv << [smi, mmol] + else + csv << [smi, mg.gsub(/mg/,'mmol')] + end + end +end -- cgit v1.2.3