-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_biogitom.py
36 lines (28 loc) · 1.13 KB
/
run_biogitom.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
import os
import argparse
def execute_task_script(task_name):
"""
Executes a task-specific script with the given arguments.
Args:
task_name (str): Name of the task folder (e.g., 'omim2ordo').
src_ent (str): Source ontology name (e.g., 'omim').
tgt_ent (str): Target ontology name (e.g., 'ordo').
"""
script_path = f"Tasks/{task_name}/{task_name}.py"
if not os.path.exists(script_path):
raise FileNotFoundError(f"Task script '{script_path}' not found.")
# print the task name and path
print(f"Executing task '{task_name}' from '{script_path}'...")
# Build the script as a string with argument injection
with open(script_path, "r") as script_file:
script_content = script_file.read()
# Inject variables
exec_globals = {
"task": task_name,
}
exec(script_content, exec_globals)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Run BioGITOM tasks")
parser.add_argument("--task", type=str, required=True, help="Task name (e.g., 'omim2ordo')")
args = parser.parse_args()
execute_task_script(args.task)