summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2020-12-28 18:08:58 +0100
committerChristoph Helma <helma@in-silico.ch>2020-12-28 18:08:58 +0100
commit158e9a7ecbc467c3db77c354f203b1176b0fc3f2 (patch)
tree6bc54012c6327c740e5cc7240d476fc06607f89a
parent9b0a5f37bdb0a5b80ace7cff559c1817d6916b8a (diff)
batch processing scripts addedwithout_mongodbmutagenicity-paper
-rwxr-xr-xbin/batch_fingerprint_classification.rb13
-rwxr-xr-xbin/batch_fingerprints.rb10
-rwxr-xr-xbin/batch_padel_classification.rb20
3 files changed, 43 insertions, 0 deletions
diff --git a/bin/batch_fingerprint_classification.rb b/bin/batch_fingerprint_classification.rb
new file mode 100755
index 0000000..318fae6
--- /dev/null
+++ b/bin/batch_fingerprint_classification.rb
@@ -0,0 +1,13 @@
+#!/usr/bin/env ruby
+require_relative "../lib/lazar"
+model = ClassificationModel.new ARGV[0]
+
+File.read(ARGV[1]).each_line do |line|
+ if line.match(/SMILES/i)
+ puts "ID,SMILES,experimental,classification,probability(0),probability(1),max_similarity,nr_neighbors"
+ else
+ id,smi = line.chomp.split(",")
+ puts ([id] + model.predict_smiles(smi)).join(",")
+ end
+end
+
diff --git a/bin/batch_fingerprints.rb b/bin/batch_fingerprints.rb
new file mode 100755
index 0000000..cd46ee2
--- /dev/null
+++ b/bin/batch_fingerprints.rb
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+require_relative "../lib/lazar"
+File.read(ARGV[0]).each_line do |line|
+ unless line.match(/SMILES/i)
+ id,smi = line.chomp.split(",")
+ puts smi
+ c = Compound.from_smiles(smi)
+ puts ([c.smiles] + c.fingerprint).join(",")
+ end
+end
diff --git a/bin/batch_padel_classification.rb b/bin/batch_padel_classification.rb
new file mode 100755
index 0000000..6d05907
--- /dev/null
+++ b/bin/batch_padel_classification.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+require_relative "../lib/lazar"
+model = ClassificationModel.new ARGV[0]
+model.predict_file ARGV[1]
+=begin
+File.read(ARGV[1]).each_line do |line|
+ if line.match(/Name/i)
+ file_descriptors = line.chomp.split(";")
+ model_descriptors = File.read(File.join(ARGV[0],"independent_variable_names")).chomp.split(",").collect{|d| d.gsub('"','')}
+ common_descriptors = model_descriptors & file_descriptors
+ puts "ID,SMILES,experimental,classification,probability(0),probability(1),max_similarity,nr_neighbors"
+ else
+ descriptor_values = []
+ line.chomp.split(",")
+ descriptor_values.shift
+ puts ([id] + model.predict_smiles(smi)).join(",")
+ end
+end
+
+=end