Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added dummy.txt
Binary file not shown.
9 changes: 9 additions & 0 deletions outputs/run_log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
2026-03-26 02:58:55.197801 - Need pathway list file for heatmap
2026-03-26 03:00:19.381438 - Need pathway list file for heatmap
2026-03-26 03:06:26.609750 - Parameters: {'data': 'dummy.txt', 'heatmap': 'T', 'tsne': False, 'kaplan': False, 'pathway_list': None, 'output': 'output', 'compound': None}
2026-03-26 03:06:26.611719 - MP-BioPath execution started
2026-03-26 03:06:26.612742 - Need pathway list file for heatmap
2026-03-26 03:14:03.942724 - MP-BioPath execution started
2026-03-26 03:14:03.943771 - Parameters: {'data': 'dummy.txt', 'heatmap': 'T', 'tsne': False, 'kaplan': False, 'pathway_list': None, 'output': 'output', 'compound': None}
2026-03-26 03:14:03.944770 - Need pathway list file for heatmap
2026-03-26 03:14:03.946767 - Execution stopped: pathway list missing
36 changes: 32 additions & 4 deletions sandbox/make_output_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@
#################################################################################

import sys, argparse, subprocess
import os
from datetime import datetime

def log_message(message):
if not os.path.exists("outputs"):
os.makedirs("outputs")

with open("outputs/run_log.txt", "a") as f:
f.write(f"{datetime.now()} - {message}\n")


parser = argparse.ArgumentParser(description='Creates output visuals from MP-BioPath output data file')
parser.add_argument("data", help="output file from MP-BioPath")
parser.add_argument("-m", "--heatmap", help="default is 'T' to make heatmap, else specify 'F' for no heatmap",
Expand All @@ -45,9 +55,24 @@
parser.add_argument("-c", "--compound", help="specify compound name")

args = parser.parse_args()

log_message("MP-BioPath execution started")

params = {
"data": args.data,
"heatmap": args.heatmap,
"tsne": args.tsne,
"kaplan": args.kaplan,
"pathway_list": args.pathway_list,
"output": args.output,
"compound": args.compound
}

log_message(f"Parameters: {params}")
if args.pathway_list is None:
print("Need pathway list file for heatmap")
log_message("Need pathway list file for heatmap")
log_message("Execution stopped: pathway list missing")
print("Need pathway list file for heatmap")
sys.exit()
else:
pathway_color_map = {}
with open(args.pathway_list, 'r') as p:
Expand Down Expand Up @@ -81,8 +106,9 @@
output_string = output_string[:-2]
colour_string = colour_string[:-2]

if args.heatmap is "F":
print("heatmap script is not executed")
if args.heatmap == "F":
log_message("Heatmap script is not executed")
print("Heatmap script is not executed")

command = "Rscript" # --vanilla --slave < "
path2script = "sandbox/create_visuals.R"
Expand All @@ -101,5 +127,7 @@

#calls and executes Rscript (create_visuals.R) by passing in arguments
cmd = [command, path2script, args.data, colour_column_string, args.output, output_string, colour_string, switch]#, args.compound]
log_message(f"Running command: {cmd}")
print(cmd)
subprocess.call(cmd, universal_newlines = True)
log_message("MP-BioPath execution completed")