From bd12f728d1bf144c6e7a8e9a213703920765ead9 Mon Sep 17 00:00:00 2001 From: niklases Date: Sat, 19 Oct 2024 18:52:30 +0200 Subject: [PATCH] Update Qt window (grey-out buttons) --- gui/qt_window.py | 13 ++++++++++++- pypef/dca/gremlin_inference.py | 5 +++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gui/qt_window.py b/gui/qt_window.py index 3c8c542..e2272e7 100644 --- a/gui/qt_window.py +++ b/gui/qt_window.py @@ -124,6 +124,17 @@ def __init__( self.process.readyReadStandardOutput.connect(self.on_readyReadStandardOutput) self.process.started.connect(lambda: self.button_mklsts.setEnabled(False)) self.process.finished.connect(lambda: self.button_mklsts.setEnabled(True)) + self.process.started.connect(lambda: self.button_dca_inference_gremlin.setEnabled(False)) + self.process.finished.connect(lambda: self.button_dca_inference_gremlin.setEnabled(True)) + self.process.started.connect(lambda: self.button_dca_test_gremlin.setEnabled(False)) + self.process.finished.connect(lambda: self.button_dca_test_gremlin.setEnabled(True)) + self.process.started.connect(lambda: self.button_dca_predict_gremlin.setEnabled(False)) + self.process.finished.connect(lambda: self.button_dca_predict_gremlin.setEnabled(True)) + self.process.started.connect(lambda: self.button_supervised_train_gremlin.setEnabled(False)) + self.process.finished.connect(lambda: self.button_supervised_train_gremlin.setEnabled(True)) + self.process.started.connect(lambda: self.button_supervised_train_test_gremlin.setEnabled(False)) + self.process.finished.connect(lambda: self.button_supervised_train_test_gremlin.setEnabled(True)) + def on_readyReadStandardOutput(self): text = self.process.readAllStandardOutput().data().decode() @@ -132,7 +143,7 @@ def on_readyReadStandardOutput(self): @QtCore.Slot() def pypef_mklsts(self): - self.text.setText("Running MKLSTS...") + self.version_text.setText("Running MKLSTS...") wt_fasta_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select WT FASTA File")[0] csv_variant_file = QtWidgets.QFileDialog.getOpenFileName(self, "Select variant CSV File")[0] self.exec_pypef(f'mklsts --wt {wt_fasta_file} --input {csv_variant_file}') diff --git a/pypef/dca/gremlin_inference.py b/pypef/dca/gremlin_inference.py index dfff281..2d786f5 100644 --- a/pypef/dca/gremlin_inference.py +++ b/pypef/dca/gremlin_inference.py @@ -47,7 +47,8 @@ import logging logger = logging.getLogger('pypef.dca.params_inference') -from os import mkdir, PathLike, environ +import os +from os import mkdir, PathLike import pickle import numpy as np import matplotlib.pyplot as plt @@ -706,7 +707,6 @@ def save_gremlin_as_pickle(alignment: str, wt_seq: str, opt_iter: int = 100): except FileExistsError: pass - logger.info(f'Saving GREMLIN model as Pickle file...') pickle.dump( { 'model': gremlin, @@ -718,6 +718,7 @@ def save_gremlin_as_pickle(alignment: str, wt_seq: str, opt_iter: int = 100): }, open('Pickles/GREMLIN', 'wb') ) + logger.info(f"Saved GREMLIN model as Pickle file ({os.path.abspath('Pickles/GREMLIN')})...") return gremlin