-
Notifications
You must be signed in to change notification settings - Fork 0
/
pheno-ranker-app.py
executable file
·643 lines (548 loc) · 29.9 KB
/
pheno-ranker-app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
import argparse
import sys
import customtkinter as ctk
import subprocess
import threading
import os
from tkinter import filedialog
from PIL import Image, ImageTk # For displaying images
# Define the version of your application
VERSION = "0.01"
# Parse command-line arguments
def parse_args():
parser = argparse.ArgumentParser(description="Pheno-Ranker App")
parser.add_argument('-v', '--version', action='store_true', help="Show program version and exit")
return parser.parse_args()
# Main application logic
def main():
# Parse arguments
args = parse_args()
# If the version flag is set, print the version and exit
if args.version:
print(f"Pheno-Ranker App Version: {VERSION}")
sys.exit(0)
# Initialize the main application window
app = ctk.CTk()
app.title("Pheno-Ranker App")
app.geometry("800x800")
app.resizable(True, True) # Allow window resizing
# Appearance
ctk.set_appearance_mode("System") # Modes: system (default), light, dark
# Create a canvas and scrollbar to make the GUI scrollable
canvas = ctk.CTkCanvas(app)
scrollbar = ctk.CTkScrollbar(app, orientation="vertical", command=canvas.yview)
scrollable_frame = ctk.CTkFrame(canvas)
scrollable_frame.bind(
"<Configure>",
lambda e: canvas.configure(
scrollregion=canvas.bbox("all")
)
)
canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")
canvas.configure(yscrollcommand=scrollbar.set)
# Load and display the logo at the top
try:
logo_img = Image.open("img/PR-logo.png")
# Maintain aspect ratio while resizing
original_width, original_height = logo_img.size
desired_width = 200 # Set your desired width here
aspect_ratio = original_height / original_width
desired_height = int(desired_width * aspect_ratio)
logo_img = logo_img.resize((desired_width, desired_height), Image.LANCZOS)
logo_photo = ImageTk.PhotoImage(logo_img)
logo_label = ctk.CTkLabel(scrollable_frame, image=logo_photo, text="")
logo_label.image = logo_photo # Keep a reference to prevent garbage collection
logo_label.grid(row=0, column=0, padx=10, pady=10)
except Exception as e:
print(f"Error loading logo image: {e}")
# List to hold reference file entries
ref_file_entries = []
# Function to update input fields based on mode
def update_mode():
try:
mode = mode_var.get()
if mode == "cohort":
# Show Reference File fields
ref_file_label.grid()
ref_files_frame.grid()
add_ref_file_button.grid()
# Hide Target File fields
target_file_label.grid_remove()
target_file_entry.grid_remove()
browse_target_button.grid_remove()
# Show heatmap_label if it exists
if heatmap_label is not None:
heatmap_label.grid()
# Hide output_text
output_text.grid_remove()
# Clear output_text to remove any residual messages
output_text.delete("1.0", ctk.END)
# Update the output label text to "Heatmap Output:"
output_label.configure(text="Heatmap Output:")
elif mode == "patient":
# Show both Reference and Target File fields
ref_file_label.grid()
ref_files_frame.grid()
add_ref_file_button.grid()
target_file_label.grid()
target_file_entry.grid()
browse_target_button.grid()
# Hide heatmap_label if it exists
if heatmap_label is not None:
heatmap_label.grid_remove()
# Show output_text
output_text.grid()
# Clear output_text to remove any residual messages
output_text.delete("1.0", ctk.END)
# Update the output label text to "Pheno-Ranker Output:"
output_label.configure(text="Pheno-Ranker Output:")
except Exception as e:
print(f"Error in update_mode: {e}")
# Function to toggle advanced options
def toggle_advanced_options():
if advanced_options_var.get():
# Show advanced options
advanced_options_frame.grid()
else:
# Hide advanced options
advanced_options_frame.grid_remove()
# Function to add a new reference file entry
def add_reference_file():
row = len(ref_file_entries) * 2 # Calculate row position
# Create a new entry and browse button
new_entry = ctk.CTkEntry(ref_files_frame, width=600)
new_entry.grid(row=row, column=0, padx=10, pady=5)
ref_file_entries.append(new_entry)
def browse_ref_file():
filename = filedialog.askopenfilename(filetypes=[("All Files", "*.*")])
if filename:
new_entry.delete(0, ctk.END)
new_entry.insert(0, filename)
output_text.insert(ctk.END, f"Reference file updated: {filename}\n")
new_browse_button = ctk.CTkButton(ref_files_frame, text="Browse", command=browse_ref_file)
new_browse_button.grid(row=row, column=1, padx=5, pady=5)
# Function to remove a reference file entry
def remove_reference_file():
if ref_file_entries:
entry = ref_file_entries.pop()
entry.grid_remove()
# Browse Button for Target File
def browse_target_file():
try:
filename = filedialog.askopenfilename(filetypes=[("All Files", "*.*")])
if filename:
target_file_entry.delete(0, ctk.END)
target_file_entry.insert(0, filename)
output_text.insert(ctk.END, f"Target file updated: {filename}\n")
except Exception as e:
output_text.insert(ctk.END, f"Error selecting target file: {e}\n")
# Enhanced File Validation Function
def validate_files():
# Validate reference files
valid = True
if not ref_file_entries:
output_text.delete("1.0", ctk.END)
output_text.insert(ctk.END, "Error: At least one reference file must be specified.\n")
valid = False
else:
for entry in ref_file_entries:
filepath = entry.get().strip()
if not os.path.isfile(filepath):
output_text.delete("1.0", ctk.END)
output_text.insert(ctk.END, f"Error: Reference file '{filepath}' does not exist or is inaccessible.\n")
valid = False
break
# Validate target file in patient mode
if mode_var.get() == "patient":
target_file = target_file_entry.get().strip()
if not os.path.isfile(target_file):
output_text.delete("1.0", ctk.END)
output_text.insert(ctk.END, "Error: Target file does not exist or is inaccessible.\n")
valid = False
return valid
# Function to run Pheno-Ranker
def run_pheno_ranker():
# Validate files first
if not validate_files():
return
# Get the inputs from the GUI
mode = mode_var.get()
reference_files = [entry.get().strip() for entry in ref_file_entries]
target_file = target_file_entry.get().strip()
output_file = output_file_entry.get().strip()
include_age = include_age_var.get()
include_hpo_ascendants = include_hpo_ascendants_var.get()
similarity_metric = similarity_metric_option.get()
sort_by_metric = sort_by_option.get()
max_out = max_out_entry.get().strip()
exclude_terms = exclude_terms_entry.get().strip()
include_terms = include_terms_entry.get().strip()
weights_file = weights_file_entry.get().strip()
config_file = config_file_entry.get().strip()
append_prefixes = append_prefixes_entry.get().strip()
alignment_output = alignment_output_var.get()
alignment_output_path = alignment_output_path_entry.get().strip()
export_output = export_output_var.get()
export_output_path = export_output_path_entry.get().strip()
cytoscape_json = cytoscape_json_var.get()
cytoscape_json_path = cytoscape_json_path_entry.get().strip()
graph_stats = graph_stats_var.get()
graph_stats_path = graph_stats_path_entry.get().strip()
max_number_var = max_number_var_entry.get().strip()
patients_of_interest = patients_of_interest_entry.get().strip()
poi_out_dir = poi_out_dir_entry.get().strip()
debug_level = debug_level_entry.get().strip()
verbose = verbose_var.get()
no_color = no_color_var.get()
log_output = log_output_var.get()
log_output_path = log_output_path_entry.get().strip()
# Add more options as needed
# Validate required inputs based on mode
if not reference_files:
output_text.delete("1.0", ctk.END)
output_text.insert(ctk.END, "Please enter at least one reference file.")
return
if mode == "patient":
if not target_file:
output_text.delete("1.0", ctk.END)
output_text.insert(ctk.END, "Please enter the target file for patient mode.")
return
# Disable the run button to prevent multiple clicks
run_button.configure(state="disabled")
output_text.delete("1.0", ctk.END)
output_text.insert(ctk.END, "Running Pheno-Ranker...\n")
# Function to execute Pheno-Ranker in a separate thread
def pheno_ranker_thread():
try:
# Construct the command for Pheno-Ranker
command = ["pheno-ranker"]
# Add reference files in the visual order they appear on the screen
reference_files = [entry.get().strip() for entry in ref_file_entries if entry.get().strip()] # Ensure no empty paths
# Add reference files in the order they appear
for ref_file in reference_files:
command.extend(["-r", ref_file])
# Add target file if in patient mode
if mode == "patient" and target_file:
command.extend(["-t", target_file])
# Add optional arguments based on user input
if output_file:
command.extend(["-o", output_file])
if advanced_options_var.get():
if include_age:
command.append("-age")
if include_hpo_ascendants:
command.append("-include-hpo-ascendants")
if similarity_metric != "hamming": # Default is hamming
command.extend(["-similarity-metric-cohort", similarity_metric])
if sort_by_metric != "hamming": # Default is hamming
command.extend(["-sort-by", sort_by_metric])
if max_out:
command.extend(["-max-out", max_out])
if exclude_terms:
command.extend(["-exclude-terms", exclude_terms])
if include_terms:
command.extend(["-include-terms", include_terms])
if weights_file:
command.extend(["-w", weights_file])
if config_file:
command.extend(["-config", config_file])
if append_prefixes:
command.extend(["-append-prefixes", append_prefixes])
if alignment_output:
if alignment_output_path:
command.extend(["-a", alignment_output_path])
else:
command.append("-a")
if export_output:
if export_output_path:
command.extend(["-e", export_output_path])
else:
command.append("-e")
if cytoscape_json:
if cytoscape_json_path:
command.extend(["-cytoscape-json", cytoscape_json_path])
else:
command.append("-cytoscape-json")
if graph_stats:
if graph_stats_path:
command.extend(["-graph-stats", graph_stats_path])
else:
command.append("-graph-stats")
if max_number_var:
command.extend(["-max-number-var", max_number_var])
if patients_of_interest:
command.extend(["-poi", patients_of_interest])
if poi_out_dir:
command.extend(["-poi-out-dir", poi_out_dir])
if debug_level:
command.extend(["-debug", debug_level])
if verbose:
command.append("-v")
if no_color:
command.append("-no-color")
if log_output:
if log_output_path:
command.extend(["-log", log_output_path])
else:
command.append("-log")
# Add more options as needed
# Run the Pheno-Ranker command
result = subprocess.run(command, capture_output=True, text=True)
# Check for errors
if result.returncode != 0:
raise Exception(result.stderr)
# In cohort mode, run the R script to generate the heatmap
if mode == "cohort":
# Run the R script
rscript_command = ["Rscript", "share/r/heatmap.R"]
if output_file: # Only add output_file if it's not None or empty
rscript_command.append(output_file)
r_result = subprocess.run(rscript_command, capture_output=True, text=True)
if r_result.returncode != 0:
raise Exception(f"R script error:\n{r_result.stderr}")
# Display the heatmap image in the GUI
display_heatmap()
else:
# In patient mode, display the output text
output_text.delete("1.0", ctk.END)
output_text.insert(ctk.END, result.stdout)
except Exception as e:
output_text.delete("1.0", ctk.END)
output_text.insert(ctk.END, f"Error:\n{str(e)}")
print(f"Error in pheno_ranker_thread: {e}")
finally:
# Re-enable the run button
run_button.configure(state="normal")
# Start the thread
threading.Thread(target=pheno_ranker_thread).start()
# Function to display the heatmap image
def display_heatmap():
nonlocal heatmap_label
try:
# Ensure previous images are cleared
if heatmap_label is not None:
heatmap_label.grid_remove()
# Remove the text output widget if it exists
output_text.grid_remove()
output_label.configure(text="Heatmap Output:")
# Load the heatmap image
img = Image.open("heatmap.png")
img = img.resize((750, 500), resample=Image.LANCZOS) # Updated line
photo = ImageTk.PhotoImage(img)
# Create a label to display the image
heatmap_label = ctk.CTkLabel(scrollable_frame, image=photo, text="")
heatmap_label.image = photo # Keep a reference to prevent garbage collection
heatmap_label.grid(row=14, column=0, padx=10, pady=5)
except FileNotFoundError:
output_text.grid()
output_text.delete("1.0", ctk.END)
output_text.insert(ctk.END, "Error: Heatmap image not found. Please check the output path.\n")
except Exception as e:
output_text.grid()
output_text.delete("1.0", ctk.END)
output_text.insert(ctk.END, f"Error displaying heatmap:\n{str(e)}")
print(f"Error in display_heatmap: {e}")
# Initialize heatmap_label
heatmap_label = None
# Define the fonts
label_font = ("Arial", 14)
# Create and place the widgets using grid
# Mode Selection
mode_var = ctk.StringVar(value="cohort")
mode_label = ctk.CTkLabel(scrollable_frame, text="Select Mode:", font=label_font)
mode_label.grid(row=1, column=0, sticky="w", padx=10, pady=(10, 0))
mode_frame = ctk.CTkFrame(scrollable_frame)
mode_frame.grid(row=2, column=0, padx=10, pady=5, sticky="w")
cohort_mode_radio = ctk.CTkRadioButton(mode_frame, text="Cohort Mode (-r)", variable=mode_var, value="cohort", command=update_mode)
cohort_mode_radio.pack(side="left", padx=5)
patient_mode_radio = ctk.CTkRadioButton(mode_frame, text="Patient Mode (-r and -t)", variable=mode_var, value="patient", command=update_mode)
patient_mode_radio.pack(side="left", padx=5)
# Reference File Entries Frame
ref_file_label = ctk.CTkLabel(scrollable_frame, text="Reference Files (-r):", font=label_font)
ref_file_label.grid(row=3, column=0, sticky="w", padx=10, pady=(10, 0))
ref_files_frame = ctk.CTkFrame(scrollable_frame)
ref_files_frame.grid(row=4, column=0, columnspan=2, padx=10, pady=5, sticky="w")
# Add initial reference file entry
add_reference_file()
# Add Reference File Button
add_ref_file_button = ctk.CTkButton(scrollable_frame, text="Add Reference File", command=add_reference_file)
add_ref_file_button.grid(row=5, column=0, padx=10, pady=5, sticky="w")
# Target File Entry
target_file_label = ctk.CTkLabel(scrollable_frame, text="Target File (-t):", font=label_font)
target_file_label.grid(row=6, column=0, sticky="w", padx=10, pady=(10, 0))
target_file_entry = ctk.CTkEntry(scrollable_frame, width=600)
target_file_entry.grid(row=7, column=0, padx=10, pady=5)
# Browse Button for Target File
browse_target_button = ctk.CTkButton(scrollable_frame, text="Browse", command=browse_target_file)
browse_target_button.grid(row=7, column=1, padx=5, pady=5)
# Initially hide the Target File fields if mode is "cohort"
if mode_var.get() == "cohort":
target_file_label.grid_remove()
target_file_entry.grid_remove()
browse_target_button.grid_remove()
# Output File Entry
output_file_label = ctk.CTkLabel(scrollable_frame, text="Output File (-o):", font=label_font)
output_file_label.grid(row=8, column=0, sticky="w", padx=10, pady=(10, 0))
output_file_entry = ctk.CTkEntry(scrollable_frame, width=600)
output_file_entry.grid(row=9, column=0, padx=10, pady=5)
# Advanced Options Checkbox
advanced_options_var = ctk.BooleanVar(value=False)
advanced_options_checkbox = ctk.CTkCheckBox(scrollable_frame, text="Show Advanced Options", variable=advanced_options_var, command=toggle_advanced_options)
advanced_options_checkbox.grid(row=10, column=0, sticky="w", padx=10, pady=5)
# Advanced Options Frame
advanced_options_frame = ctk.CTkFrame(scrollable_frame)
advanced_options_frame.grid(row=11, column=0, columnspan=2, padx=10, pady=5, sticky="w")
# Initially hide the advanced options
advanced_options_frame.grid_remove()
# Include Age Checkbox
include_age_var = ctk.BooleanVar(value=False)
include_age_checkbox = ctk.CTkCheckBox(advanced_options_frame, text="Include Age (-age)", variable=include_age_var)
include_age_checkbox.grid(row=0, column=0, sticky="w", padx=10, pady=5)
# Include HPO Ascendants Checkbox
include_hpo_ascendants_var = ctk.BooleanVar(value=False)
include_hpo_ascendants_checkbox = ctk.CTkCheckBox(advanced_options_frame, text="Include HPO Ascendants (-include-hpo-ascendants)", variable=include_hpo_ascendants_var)
include_hpo_ascendants_checkbox.grid(row=1, column=0, sticky="w", padx=10, pady=5)
# Similarity Metric Option Menu
similarity_metric_label = ctk.CTkLabel(advanced_options_frame, text="Similarity Metric (-similarity-metric-cohort):", font=label_font)
similarity_metric_label.grid(row=2, column=0, sticky="w", padx=10, pady=(10, 0))
similarity_metric_option = ctk.StringVar(value="hamming")
similarity_metric_menu = ctk.CTkOptionMenu(advanced_options_frame, variable=similarity_metric_option, values=["hamming", "jaccard"])
similarity_metric_menu.grid(row=3, column=0, padx=10, pady=5)
# Sort By Option Menu
sort_by_label = ctk.CTkLabel(advanced_options_frame, text="Sort By (-sort-by):", font=label_font)
sort_by_label.grid(row=4, column=0, sticky="w", padx=10, pady=(10, 0))
sort_by_option = ctk.StringVar(value="hamming")
sort_by_menu = ctk.CTkOptionMenu(advanced_options_frame, variable=sort_by_option, values=["hamming", "jaccard"])
sort_by_menu.grid(row=5, column=0, padx=10, pady=5)
# Max Out Entry
max_out_label = ctk.CTkLabel(advanced_options_frame, text="Max Number of Outputs (-max-out):", font=label_font)
max_out_label.grid(row=6, column=0, sticky="w", padx=10, pady=(10, 0))
max_out_entry = ctk.CTkEntry(advanced_options_frame, width=600)
max_out_entry.grid(row=7, column=0, padx=10, pady=5)
# Exclude Terms Entry
exclude_terms_label = ctk.CTkLabel(advanced_options_frame, text="Exclude Terms (-exclude-terms):", font=label_font)
exclude_terms_label.grid(row=8, column=0, sticky="w", padx=10, pady=(10, 0))
exclude_terms_entry = ctk.CTkEntry(advanced_options_frame, width=600)
exclude_terms_entry.grid(row=9, column=0, padx=10, pady=5)
# Include Terms Entry
include_terms_label = ctk.CTkLabel(advanced_options_frame, text="Include Terms (-include-terms):", font=label_font)
include_terms_label.grid(row=10, column=0, sticky="w", padx=10, pady=(10, 0))
include_terms_entry = ctk.CTkEntry(advanced_options_frame, width=600)
include_terms_entry.grid(row=11, column=0, padx=10, pady=5)
# Weights File Entry
weights_file_label = ctk.CTkLabel(advanced_options_frame, text="Weights File (-w):", font=label_font)
weights_file_label.grid(row=12, column=0, sticky="w", padx=10, pady=(10, 0))
weights_file_entry = ctk.CTkEntry(advanced_options_frame, width=600)
weights_file_entry.grid(row=13, column=0, padx=10, pady=5)
# Browse Button for Weights File
def browse_weights_file():
filename = filedialog.askopenfilename(filetypes=[("All Files", "*.*")])
if filename:
weights_file_entry.delete(0, ctk.END)
weights_file_entry.insert(0, filename)
browse_weights_button = ctk.CTkButton(advanced_options_frame, text="Browse", command=browse_weights_file)
browse_weights_button.grid(row=13, column=1, padx=5, pady=5)
# Config File Entry
config_file_label = ctk.CTkLabel(advanced_options_frame, text="Config File (-config):", font=label_font)
config_file_label.grid(row=14, column=0, sticky="w", padx=10, pady=(10, 0))
config_file_entry = ctk.CTkEntry(advanced_options_frame, width=600)
config_file_entry.grid(row=15, column=0, padx=10, pady=5)
# Browse Button for Config File
def browse_config_file():
filename = filedialog.askopenfilename(filetypes=[("All Files", "*.*")])
if filename:
config_file_entry.delete(0, ctk.END)
config_file_entry.insert(0, filename)
browse_config_button = ctk.CTkButton(advanced_options_frame, text="Browse", command=browse_config_file)
browse_config_button.grid(row=15, column=1, padx=5, pady=5)
# Append Prefixes Entry
append_prefixes_label = ctk.CTkLabel(advanced_options_frame, text="Append Prefixes (-append-prefixes):", font=label_font)
append_prefixes_label.grid(row=16, column=0, sticky="w", padx=10, pady=(10, 0))
append_prefixes_entry = ctk.CTkEntry(advanced_options_frame, width=600)
append_prefixes_entry.grid(row=17, column=0, padx=10, pady=5)
# Alignment Output Checkbox and Entry
alignment_output_var = ctk.BooleanVar(value=False)
alignment_output_checkbox = ctk.CTkCheckBox(advanced_options_frame, text="Write Alignment File (-a)", variable=alignment_output_var)
alignment_output_checkbox.grid(row=18, column=0, sticky="w", padx=10, pady=5)
alignment_output_path_label = ctk.CTkLabel(advanced_options_frame, text="Alignment Output Path:", font=label_font)
alignment_output_path_label.grid(row=19, column=0, sticky="w", padx=10, pady=(10, 0))
alignment_output_path_entry = ctk.CTkEntry(advanced_options_frame, width=600)
alignment_output_path_entry.grid(row=20, column=0, padx=10, pady=5)
# Export Output Checkbox and Entry
export_output_var = ctk.BooleanVar(value=False)
export_output_checkbox = ctk.CTkCheckBox(advanced_options_frame, text="Export Miscellaneous JSON Files (-e)", variable=export_output_var)
export_output_checkbox.grid(row=21, column=0, sticky="w", padx=10, pady=5)
export_output_path_label = ctk.CTkLabel(advanced_options_frame, text="Export Output Path:", font=label_font)
export_output_path_label.grid(row=22, column=0, sticky="w", padx=10, pady=(10, 0))
export_output_path_entry = ctk.CTkEntry(advanced_options_frame, width=600)
export_output_path_entry.grid(row=23, column=0, padx=10, pady=5)
# Cytoscape JSON Checkbox and Entry
cytoscape_json_var = ctk.BooleanVar(value=False)
cytoscape_json_checkbox = ctk.CTkCheckBox(advanced_options_frame, text="Generate Cytoscape JSON (-cytoscape-json)", variable=cytoscape_json_var)
cytoscape_json_checkbox.grid(row=24, column=0, sticky="w", padx=10, pady=5)
cytoscape_json_path_label = ctk.CTkLabel(advanced_options_frame, text="Cytoscape JSON Path:", font=label_font)
cytoscape_json_path_label.grid(row=25, column=0, sticky="w", padx=10, pady=(10, 0))
cytoscape_json_path_entry = ctk.CTkEntry(advanced_options_frame, width=600)
cytoscape_json_path_entry.grid(row=26, column=0, padx=10, pady=5)
# Graph Stats Checkbox and Entry
graph_stats_var = ctk.BooleanVar(value=False)
graph_stats_checkbox = ctk.CTkCheckBox(advanced_options_frame, text="Generate Graph Stats (-graph-stats)", variable=graph_stats_var)
graph_stats_checkbox.grid(row=27, column=0, sticky="w", padx=10, pady=5)
graph_stats_path_label = ctk.CTkLabel(advanced_options_frame, text="Graph Stats Path:", font=label_font)
graph_stats_path_label.grid(row=28, column=0, sticky="w", padx=10, pady=(10, 0))
graph_stats_path_entry = ctk.CTkEntry(advanced_options_frame, width=600)
graph_stats_path_entry.grid(row=29, column=0, padx=10, pady=5)
# Max Number Var Entry
max_number_var_label = ctk.CTkLabel(advanced_options_frame, text="Max Number of Variables (-max-number-var):", font=label_font)
max_number_var_label.grid(row=30, column=0, sticky="w", padx=10, pady=(10, 0))
max_number_var_entry = ctk.CTkEntry(advanced_options_frame, width=600)
max_number_var_entry.grid(row=31, column=0, padx=10, pady=5)
# Patients of Interest Entry
patients_of_interest_label = ctk.CTkLabel(advanced_options_frame, text="Patients of Interest (-poi):", font=label_font)
patients_of_interest_label.grid(row=32, column=0, sticky="w", padx=10, pady=(10, 0))
patients_of_interest_entry = ctk.CTkEntry(advanced_options_frame, width=600)
patients_of_interest_entry.grid(row=33, column=0, padx=10, pady=5)
# POI Output Directory Entry
poi_out_dir_label = ctk.CTkLabel(advanced_options_frame, text="POI Output Directory (-poi-out-dir):", font=label_font)
poi_out_dir_label.grid(row=34, column=0, sticky="w", padx=10, pady=(10, 0))
poi_out_dir_entry = ctk.CTkEntry(advanced_options_frame, width=600)
poi_out_dir_entry.grid(row=35, column=0, padx=10, pady=5)
# Debug Level Entry
debug_level_label = ctk.CTkLabel(advanced_options_frame, text="Debug Level (-debug):", font=label_font)
debug_level_label.grid(row=36, column=0, sticky="w", padx=10, pady=(10, 0))
debug_level_entry = ctk.CTkEntry(advanced_options_frame, width=600)
debug_level_entry.grid(row=37, column=0, padx=10, pady=5)
# Verbose Checkbox
verbose_var = ctk.BooleanVar(value=False)
verbose_checkbox = ctk.CTkCheckBox(advanced_options_frame, text="Verbose Output (-v)", variable=verbose_var)
verbose_checkbox.grid(row=38, column=0, sticky="w", padx=10, pady=5)
# No Color Checkbox
no_color_var = ctk.BooleanVar(value=True)
no_color_checkbox = ctk.CTkCheckBox(advanced_options_frame, text="No Color Output (-no-color)", variable=no_color_var)
no_color_checkbox.grid(row=39, column=0, sticky="w", padx=10, pady=5)
# Log Output Checkbox and Entry
log_output_var = ctk.BooleanVar(value=False)
log_output_checkbox = ctk.CTkCheckBox(advanced_options_frame, text="Save Log File (-log)", variable=log_output_var)
log_output_checkbox.grid(row=40, column=0, sticky="w", padx=10, pady=5)
log_output_path_label = ctk.CTkLabel(advanced_options_frame, text="Log Output Path:", font=label_font)
log_output_path_label.grid(row=41, column=0, sticky="w", padx=10, pady=(10, 0))
log_output_path_entry = ctk.CTkEntry(advanced_options_frame, width=600)
log_output_path_entry.grid(row=42, column=0, padx=10, pady=5)
# Run Button
run_button = ctk.CTkButton(scrollable_frame, text="Run Pheno-Ranker", command=run_pheno_ranker)
run_button.grid(row=12, column=0, padx=10, pady=15)
# Output Label
output_label = ctk.CTkLabel(scrollable_frame, text="Pheno-Ranker Output:", font=label_font)
output_label.grid(row=13, column=0, sticky="w", padx=10, pady=(20, 5))
# Output Text Box
output_text = ctk.CTkTextbox(scrollable_frame, height=250, width=750)
output_text.grid(row=14, column=0, padx=10, pady=5)
# Place the canvas and scrollbar in the main window
canvas.pack(side="left", fill="both", expand=True)
scrollbar.pack(side="right", fill="y")
# Set initial mode
update_mode()
# Start the application's event loop
app.mainloop()
if __name__ == '__main__':
main()