Add Tkinter-based GUI for protein location prediction tool
Browse files- GUI.py → gui.py +16 -13
GUI.py → gui.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
"""
|
| 2 |
-
Protein Location Predictor
|
| 3 |
This module provides a Tkinter-based GUI for loading FASTA files
|
| 4 |
and running protein location prediction tools.
|
| 5 |
"""
|
|
@@ -13,7 +13,8 @@ FASTA_FILE_PATH = None # Global or instance variable
|
|
| 13 |
|
| 14 |
def load_fasta_file():
|
| 15 |
"""
|
| 16 |
-
Opens a file dialog for the user to select a FASTA file and
|
|
|
|
| 17 |
|
| 18 |
If a file is selected, displays an information message with the file path.
|
| 19 |
If no file is selected, displays a warning message.
|
|
@@ -25,7 +26,7 @@ def load_fasta_file():
|
|
| 25 |
Global Variables:
|
| 26 |
FASTA_FILE_PATH (str): Path to the selected FASTA file.
|
| 27 |
"""
|
| 28 |
-
global FASTA_FILE_PATH # pylint: disable=global-statement
|
| 29 |
FASTA_FILE_PATH = filedialog.askopenfilename(
|
| 30 |
filetypes=[("FASTA files", "*.fasta *.fa")],
|
| 31 |
title="Select a FASTA file"
|
|
@@ -67,7 +68,7 @@ def run_esm300():
|
|
| 67 |
predict_with_esm(fasta_path = FASTA_FILE_PATH,
|
| 68 |
model = 'esmc_300m')
|
| 69 |
torch.cuda.empty_cache()
|
| 70 |
-
|
| 71 |
def run_esm600():
|
| 72 |
"""
|
| 73 |
Runs the protein location prediction process.
|
|
@@ -114,7 +115,7 @@ def menu():
|
|
| 114 |
file_menu.add_command(label='Load FASTA', command=load_fasta_file)
|
| 115 |
file_menu.add_command(label='Close', command=root.quit)
|
| 116 |
file_menu.add_separator()
|
| 117 |
-
menubar.add_cascade(label="File", menu=file_menu, underline=0)
|
| 118 |
|
| 119 |
# help menu
|
| 120 |
help_menu = Menu(menubar, tearoff=0)
|
|
@@ -122,17 +123,16 @@ def menu():
|
|
| 122 |
help_menu.add_command(label='About...')
|
| 123 |
menubar.add_cascade(label="Help", menu=help_menu, underline=0)
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
# =========================
|
| 128 |
-
|
| 129 |
-
btn_prost = tk.Button(root, text="Predict with Prost", command=run_prost) #Predict with Prost
|
| 130 |
btn_prost.pack(pady=5)
|
| 131 |
|
| 132 |
-
btn_esm300 = tk.Button(root, text="Predict with ESM C 300m",
|
|
|
|
| 133 |
btn_esm300.pack(pady=5)
|
| 134 |
|
| 135 |
-
btn_esm300 = tk.Button(root, text="Predict with ESM C 600m",
|
|
|
|
| 136 |
btn_esm300.pack(pady=5)
|
| 137 |
|
| 138 |
btn_exit = tk.Button(root, text="Exit", command=root.quit)
|
|
@@ -141,4 +141,7 @@ def menu():
|
|
| 141 |
root.mainloop()
|
| 142 |
|
| 143 |
if __name__ == "__main__":
|
| 144 |
-
menu()
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
"""
|
| 2 |
+
Protein Location Predictor GUI
|
| 3 |
This module provides a Tkinter-based GUI for loading FASTA files
|
| 4 |
and running protein location prediction tools.
|
| 5 |
"""
|
|
|
|
| 13 |
|
| 14 |
def load_fasta_file():
|
| 15 |
"""
|
| 16 |
+
Opens a file dialog for the user to select a FASTA file and
|
| 17 |
+
stores the selected file path in a global variable.
|
| 18 |
|
| 19 |
If a file is selected, displays an information message with the file path.
|
| 20 |
If no file is selected, displays a warning message.
|
|
|
|
| 26 |
Global Variables:
|
| 27 |
FASTA_FILE_PATH (str): Path to the selected FASTA file.
|
| 28 |
"""
|
| 29 |
+
global FASTA_FILE_PATH # pylint: disable=global-statement
|
| 30 |
FASTA_FILE_PATH = filedialog.askopenfilename(
|
| 31 |
filetypes=[("FASTA files", "*.fasta *.fa")],
|
| 32 |
title="Select a FASTA file"
|
|
|
|
| 68 |
predict_with_esm(fasta_path = FASTA_FILE_PATH,
|
| 69 |
model = 'esmc_300m')
|
| 70 |
torch.cuda.empty_cache()
|
| 71 |
+
|
| 72 |
def run_esm600():
|
| 73 |
"""
|
| 74 |
Runs the protein location prediction process.
|
|
|
|
| 115 |
file_menu.add_command(label='Load FASTA', command=load_fasta_file)
|
| 116 |
file_menu.add_command(label='Close', command=root.quit)
|
| 117 |
file_menu.add_separator()
|
| 118 |
+
menubar.add_cascade(label="File", menu=file_menu, underline=0)
|
| 119 |
|
| 120 |
# help menu
|
| 121 |
help_menu = Menu(menubar, tearoff=0)
|
|
|
|
| 123 |
help_menu.add_command(label='About...')
|
| 124 |
menubar.add_cascade(label="Help", menu=help_menu, underline=0)
|
| 125 |
|
| 126 |
+
btn_prost = tk.Button(root, text="Predict with Prost",
|
| 127 |
+
command=run_prost) #Predict with Prost
|
|
|
|
|
|
|
|
|
|
| 128 |
btn_prost.pack(pady=5)
|
| 129 |
|
| 130 |
+
btn_esm300 = tk.Button(root, text="Predict with ESM C 300m",
|
| 131 |
+
command = run_esm300) #Predict with ESM C 300m
|
| 132 |
btn_esm300.pack(pady=5)
|
| 133 |
|
| 134 |
+
btn_esm300 = tk.Button(root, text="Predict with ESM C 600m",
|
| 135 |
+
command = run_esm600) #Predict with ESM C 600m
|
| 136 |
btn_esm300.pack(pady=5)
|
| 137 |
|
| 138 |
btn_exit = tk.Button(root, text="Exit", command=root.quit)
|
|
|
|
| 141 |
root.mainloop()
|
| 142 |
|
| 143 |
if __name__ == "__main__":
|
| 144 |
+
menu()
|
| 145 |
+
|
| 146 |
+
# End-of-file (EOF)
|
| 147 |
+
|