diff options
author | Christoph Helma <helma@in-silico.ch> | 2018-10-07 19:39:34 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2018-10-07 19:39:34 +0200 |
commit | e97f7369339b215fda7d0169b567a211db6c5c38 (patch) | |
tree | bcd1592c2684527c18f0e5b18e4b4b948f031aa1 /scripts | |
parent | ecc3b569aacdeea0c80af372a2fe70d8aea15f64 (diff) |
Rakefile instead of Makefile and scripts
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/carcinogenicity2csv.rb | 25 | ||||
-rwxr-xr-x | scripts/convert_pa.rb | 12 | ||||
-rwxr-xr-x | scripts/efsa2csv.rb | 28 | ||||
-rwxr-xr-x | scripts/import-csv.rb | 8 |
4 files changed, 0 insertions, 73 deletions
diff --git a/scripts/carcinogenicity2csv.rb b/scripts/carcinogenicity2csv.rb deleted file mode 100755 index bed0907..0000000 --- a/scripts/carcinogenicity2csv.rb +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env ruby -#require_relative '../../lazar/lib/lazar.rb' - -i = 0 -activities = [] -File.readlines(ARGV[0]).each do |line| - if i > 2 - tokens = line.split "," - p line if tokens[1].empty? - activities << [tokens[1],tokens[3]] - end - i += 1 -end - -puts "SMILES,Activity" -activities.each_slice(100) do |slice| # get SMILES in chunks - sids = slice.collect{|e| e[0]} - smiles = `curl https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/#{sids.join(",")}/property/CanonicalSMILES/TXT`.split("\n") - abort("Could not get SMILES for all SIDs from PubChem") unless sids.size == smiles.size - smiles.each_with_index do |smi,i| - act = slice[i] - puts [smi.chomp,act[1]].join(",") - end -end - diff --git a/scripts/convert_pa.rb b/scripts/convert_pa.rb deleted file mode 100755 index 779aded..0000000 --- a/scripts/convert_pa.rb +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env ruby -require_relative '../../lazar/lib/lazar.rb' - -while STDIN.gets - tokens = $_.chomp.encode("UTF-8", {:invalid => :replace, :undef => :replace}).split(";") - begin - c = OpenTox::Compound.from_smiles tokens.last - puts "#{tokens[0]},#{c.smiles}" - rescue #=> e - STDERR.puts $_ - end -end diff --git a/scripts/efsa2csv.rb b/scripts/efsa2csv.rb deleted file mode 100755 index 48d4fb8..0000000 --- a/scripts/efsa2csv.rb +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env ruby -require 'csv' -require_relative '../../lazar/lib/lazar.rb' - -i = 0 -db = {} -CSV.foreach(ARGV[0], :encoding => "UTF-8", :col_sep => "\t", :liberal_parsing => true) do |row| - #STDERR.puts i if i%100 == 0 - if i > 0 and row[11] and !row[11].empty? and row[24].match(/Salmonella/i) and ( row[25].match("TA 98") or row[25].match("TA 100") ) and row[33] - begin - c = OpenTox::Compound.from_smiles(row[11].gsub('"','')).smiles - rescue - c = OpenTox::Compound.from_inchi(row[12]).smiles # some smiles (row[11]) contain non-parseable characters - end - db[c] ||= {} - db[c][:id] ||= "efsa_#{row[2]}" - if row[33].match(/Positiv/i) - db[c][:value] = 1 # at least one positive result in TA 98 or TA 100 - elsif row[33].match(/Negativ/i) - db[c][:value] ||= 0 - end - end - i += 1 -end - -db.each do |s,v| - puts [v[:id],s,v[:value]].join "," -end diff --git a/scripts/import-csv.rb b/scripts/import-csv.rb deleted file mode 100755 index 255e342..0000000 --- a/scripts/import-csv.rb +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby -require_relative '../../lazar/lib/lazar' -include OpenTox - -dataset = Dataset.from_csv_file ARGV[0] -puts dataset.id.to_s - - |