diff options
author | Christoph Helma <helma@in-silico.ch> | 2018-08-07 20:19:17 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2018-08-07 20:19:17 +0200 |
commit | 97e65d06feba57b45f55c8b83549b8b5350d3e7a (patch) | |
tree | 209643b570a0d0a492216f84fda77459dcc5643c /scripts |
initial commit
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/efsa2csv.rb | 28 | ||||
-rwxr-xr-x | scripts/hansen2csv.rb | 10 |
2 files changed, 38 insertions, 0 deletions
diff --git a/scripts/efsa2csv.rb b/scripts/efsa2csv.rb new file mode 100755 index 0000000..56c69df --- /dev/null +++ b/scripts/efsa2csv.rb @@ -0,0 +1,28 @@ +#!/usr/bin/env ruby +require 'csv' +require_relative '../../lazar/lib/lazar.rb' + +i = 0 +db = {} +CSV.foreach(ARGV[0]) do |row| + begin + if i > 0 and row[11] + c = OpenTox::Compound.from_smiles(row[11]).smiles + if row[24].match(/Salmonella/i) + if row[25].match("TA 98") or row[25].match("TA 100") + if row[33].match(/Positiv/i) + db[c] = 1 # at least one positive result in TA 98 or TA 100 + elsif row[33].match(/Negativ/i) + db[c] ||= 0 + end + end + end + end + rescue + end + i += 1 +end + +dm.each do |s,v| + puts [s,v].join "," +end diff --git a/scripts/hansen2csv.rb b/scripts/hansen2csv.rb new file mode 100755 index 0000000..7684afd --- /dev/null +++ b/scripts/hansen2csv.rb @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby +require 'csv' +require_relative '../../lazar/lib/lazar.rb' + +i = 0 +CSV.foreach(ARGV[0]) do |row| + i == 0 ? c = "SMILES" : c = OpenTox::Compound.from_smiles(row[5]).smiles + puts [c, row[2]].join "," + i += 1 +end |