Skip to content

Commit

Permalink
Add basic handling for flags
Browse files Browse the repository at this point in the history
  • Loading branch information
poshul authored May 10, 2024
1 parent e2eaad3 commit 34503ac
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/workflow/CommandExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,15 @@ def run_topp(self, tool: str, input_output: dict, custom_params: dict = {}) -> N
# Add non-default TOPP tool parameters
if tool in params.keys():
for k, v in params[tool].items():
command += [f"-{k}"]
# Handle the case where f is a flag and v is false by just skipping
if v != False:
command += [f"-{k}"]
# add the value if we aren't a flag
if isinstance(v, str) and "\n" in v:
command += v.split("\n")
# If we are a flag don't append the value
elif isinstance(v, bool):
continue
else:
command += [str(v)]
# Add custom parameters
Expand Down Expand Up @@ -265,4 +271,4 @@ def run_python(self, script_file: str, input_output: dict = {}) -> None:
# run command
self.run_command(["python", str(path), str(tmp_params_file)])
# remove tmp params file
tmp_params_file.unlink()
tmp_params_file.unlink()

0 comments on commit 34503ac

Please sign in to comment.