summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-05-04 19:24:42 +0200
committerChristoph Helma <helma@in-silico.ch>2016-05-04 19:24:42 +0200
commit05386e748270c337c66f6f379317ea4b25905236 (patch)
tree4b62f1c9449dded9cd7670715a5735f5bc93dd2e /scripts
parent79238bddb59607aa9f759caa9e3c8db176709703 (diff)
first reasonable results for nanoparticle crossvalidation
Diffstat (limited to 'scripts')
-rw-r--r--scripts/import-enm.rb6
-rw-r--r--scripts/mg2mmol.rb17
-rw-r--r--scripts/mmol2-log10.rb17
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