Skip to content

Commit 63ecbe1

Browse files
committed
Add ./gui to ./pypef (only API usage and QThread block until now) and support for Py3.12
1 parent c965d8d commit 63ecbe1

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import os
99
from PySide6 import QtCore, QtWidgets
1010
from PySide6.QtCore import QSize, Signal, QThread
11-
pypef_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
12-
sys.path.append(pypef_root)
11+
#pypef_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
12+
#sys.path.append(pypef_root)
1313
from pypef import __version__
1414
from pypef.main import __doc__, run_main, logger, formatter
1515
from pypef.utils.helpers import get_device, get_vram, get_torch_version, get_gpu_info
@@ -18,7 +18,7 @@
1818
logger.setLevel(logging.INFO)
1919

2020

21-
EXEC_API_OR_CLI = ['cli', 'api'][0]
21+
EXEC_API_OR_CLI = ['cli', 'api'][1]
2222

2323

2424
print(sys.executable)
@@ -939,9 +939,13 @@ def process_finished(self):
939939
self.version_text.setText("Finished...")
940940

941941

942-
if __name__ == "__main__":
942+
def run_app():
943943
app = QtWidgets.QApplication([])
944944
widget = MainWindow()
945945
widget.resize(800, 600)
946946
widget.show()
947947
sys.exit(app.exec())
948+
949+
950+
if __name__ == "__main__":
951+
run_app()

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ authors = [
1010
{ name = "Alexander-Maurice Illig" }
1111
]
1212
description = "A tool for performing data-driven protein engineering by building machine learning models from protein variant fitness data."
13-
requires-python = ">=3.10, <3.13"
13+
requires-python = ">=3.10"
1414
license = { text = "CC BY-SA 4.0" }
1515
keywords = ["Pythonic Protein Engineering Framework"]
1616
classifiers = [
@@ -19,6 +19,7 @@ classifiers = [
1919
"Programming Language :: Python :: 3.10",
2020
"Programming Language :: Python :: 3.11",
2121
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
2223
"Topic :: Scientific/Engineering :: Bio-Informatics",
2324
"Topic :: Scientific/Engineering :: Artificial Intelligence"
2425
]
@@ -39,6 +40,8 @@ dependencies = [
3940
"torch",
4041
"torch-geometric"
4142
]
43+
[project.optional-dependencies]
44+
gui = ["pyside6"]
4245

4346
[tool.setuptools.dynamic]
4447
version = {attr = "pypef.__version__"}
@@ -49,6 +52,8 @@ Homepage = "https://github.com/niklases/PyPEF"
4952

5053
[project.scripts]
5154
pypef = "pypef.main:run_main"
55+
pypef-gui = "pypef.gui.PyPEFGUIQtWindow:run_app"
56+
5257

5358
[tool.setuptools.packages.find]
5459
where = ["."]

scripts/ProteinGym_runs/run_performance_tests_proteingym_hybrid_dca_llm_random_modulo_continuous_splits.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,15 @@ def compute_performances(mut_data, mut_sep=':', start_i: int = 0, already_tested
180180
continue
181181

182182
ns_y_test = [len(variants)]
183-
temp_perfs = []
183+
ds = DatasetSplitter(csv_file=csv_path, n_cv=5)
184184
for train_indices, test_indices in zip(
185185
ds.random_splits_train_indices_combined, ds.random_splits_test_indices_combined
186186
):
187187
try:
188-
ds = DatasetSplitter(csv_file=csv_path, n_cv=5)
189-
x_dca_train, x_dca_test = x_dca[train_indices], x_dca[test_indices]
190-
x_llm_train_prosst, x_llm_test_prosst = x_prosst[train_indices], x_prosst[test_indices]
191-
x_llm_train_esm, x_llm_test_esm = x_esm[train_indices], x_esm[test_indices]
192-
y_train, y_test = fitnesses[train_indices], fitnesses[test_indices]
188+
x_dca_train, x_dca_test = np.asarray(x_dca)[train_indices], np.asarray(x_dca)[test_indices]
189+
x_llm_train_prosst, x_llm_test_prosst = np.asarray(x_prosst)[train_indices], np.asarray(x_prosst)[test_indices]
190+
x_llm_train_esm, x_llm_test_esm = np.asarray(x_esm)[train_indices], np.asarray(x_esm)[test_indices]
191+
y_train, y_test = np.asarray(fitnesses)[train_indices], np.asarray(fitnesses)[test_indices]
193192
prosst_lora_model_2 = copy.deepcopy(prosst_lora_model)
194193
prosst_optimizer = torch.optim.Adam(prosst_lora_model_2.parameters(), lr=0.0001)
195194
esm_lora_model_2 = copy.deepcopy(esm_lora_model)
@@ -244,7 +243,7 @@ def compute_performances(mut_data, mut_sep=':', start_i: int = 0, already_tested
244243
}
245244
}
246245
print(f'Train: {len(np.array(y_train))} --> Test: {len(np.array(y_test))}')
247-
if len(y_test) <= 50:
246+
if len(y_test) <= 20: # TODO: 50
248247
print(f"Only {len(fitnesses)} in total, splitting the data "
249248
f"in N_Train = {len(y_train)} and N_Test = {len(y_test)} "
250249
f"results in N_Test <= 50 variants - not getting "
@@ -539,7 +538,7 @@ def plot_csv_data(csv, plot_name):
539538
if not JUST_PLOT_RESULTS:
540539
compute_performances(
541540
mut_data=combined_mut_data,
542-
start_i=start_i,
541+
start_i=11,
543542
already_tested_is=already_tested_is
544543
)
545544

0 commit comments

Comments
 (0)