diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/import-enm.rb | 6 | ||||
-rw-r--r-- | scripts/mg2mmol.rb | 17 | ||||
-rw-r--r-- | scripts/mmol2-log10.rb | 17 |
3 files changed, 40 insertions, 0 deletions
diff --git a/scripts/import-enm.rb b/scripts/import-enm.rb new file mode 100644 index 0000000..9cbe5d4 --- /dev/null +++ b/scripts/import-enm.rb @@ -0,0 +1,6 @@ +require_relative '../lib/lazar' +include OpenTox +$mongo.database.drop +$gridfs = $mongo.database.fs # recreate GridFS indexes +Import::Enanomapper.import +`mongodump -h 127.0.0.1 -d production` 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 diff --git a/scripts/mmol2-log10.rb b/scripts/mmol2-log10.rb new file mode 100644 index 0000000..0c99a0b --- /dev/null +++ b/scripts/mmol2-log10.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +require_relative '../lib/lazar' +include OpenTox +newfile = ARGV[0].sub(/.csv/,"_log10.csv") +p newfile +CSV.open(newfile, "wb") do |csv| + 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] + else + csv << [smi, "-log10(#{mmol})"] + end + end +end |