From a29eb3e38414cd252850c9c4fb356f8b2bef6fb4 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 12 Feb 2021 19:54:07 +0100 Subject: model.rb refactored, mp2d models updated --- bin/batch_fingerprints.rb | 10 ---------- bin/classification-summary.rb | 4 ++++ bin/classification_crossvalidation.rb | 4 ---- bin/classification_summary.rb | 4 ---- bin/crossvalidation.rb | 15 +++++++++++++++ bin/fingerprints.rb | 6 ++++++ 6 files changed, 25 insertions(+), 18 deletions(-) delete mode 100755 bin/batch_fingerprints.rb create mode 100755 bin/classification-summary.rb delete mode 100755 bin/classification_crossvalidation.rb delete mode 100755 bin/classification_summary.rb create mode 100755 bin/crossvalidation.rb create mode 100755 bin/fingerprints.rb (limited to 'bin') diff --git a/bin/batch_fingerprints.rb b/bin/batch_fingerprints.rb deleted file mode 100755 index cd46ee2..0000000 --- a/bin/batch_fingerprints.rb +++ /dev/null @@ -1,10 +0,0 @@ -#!/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/classification-summary.rb b/bin/classification-summary.rb new file mode 100755 index 0000000..a3e4172 --- /dev/null +++ b/bin/classification-summary.rb @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative "../lib/lazar" +stat = ClassificationStatistics.new ARGV[0] +stat.summary diff --git a/bin/classification_crossvalidation.rb b/bin/classification_crossvalidation.rb deleted file mode 100755 index 4bd6bc6..0000000 --- a/bin/classification_crossvalidation.rb +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -require_relative "../lib/lazar" -model = ClassificationModel.new ARGV[0] -model.crossvalidation diff --git a/bin/classification_summary.rb b/bin/classification_summary.rb deleted file mode 100755 index a3e4172..0000000 --- a/bin/classification_summary.rb +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -require_relative "../lib/lazar" -stat = ClassificationStatistics.new ARGV[0] -stat.summary diff --git a/bin/crossvalidation.rb b/bin/crossvalidation.rb new file mode 100755 index 0000000..b7cfdd7 --- /dev/null +++ b/bin/crossvalidation.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +require_relative "../lib/lazar" +dir = ARGV[0] +dependent_variable_type = File.read(File.join(dir, "dependent-variable-type")).chomp +independent_variable_type = File.read(File.join(dir, "independent-variable-type")).chomp +if dependent_variable_type == "binary" and independent_variable_type == "binary" + model = TanimotoClassificationModel.new dir +elsif dependent_variable_type == "binary" and independent_variable_type == "numeric" + model = CosineClassificationModel.new dir +elsif dependent_variable_type == "numeric" and independent_variable_type == "binary" + model = TanimotoRegressionModel.new dir +elsif dependent_variable_type == "numeric" and independent_variable_type == "numeric" + model = CosineRegressionModel.new dir +end +model.crossvalidation diff --git a/bin/fingerprints.rb b/bin/fingerprints.rb new file mode 100755 index 0000000..923be8d --- /dev/null +++ b/bin/fingerprints.rb @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +require_relative "../lib/lazar" +File.read(ARGV[0]).each_line do |smi| + c = Compound.from_smiles(smi.chomp) + puts c.fingerprint.join(",") +end -- cgit v1.2.3