Skip to content

Commit e1ae89c

Browse files
committed
Fix TOPP parameter handling for zero values
Changed truthiness check `if v:` to explicit `if v != "" and v is not None:` to properly handle numeric zero values (0, 0.0) which are valid parameters. Previously, setting fragment_bin_offset=0 would skip the value entirely, causing malformed command lines where the next flag was interpreted as the previous parameter's value.
1 parent e1df1a7 commit e1ae89c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/workflow/CommandExecutor.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,19 @@ def run_topp(self, tool: str, input_output: dict, custom_params: dict = {}) -> b
236236
if tool in params.keys():
237237
for k, v in params[tool].items():
238238
command += [f"-{k}"]
239-
if v: # Skip empty values (pass flag with no value)
239+
# Skip only empty strings (pass flag with no value)
240+
# Note: 0 and 0.0 are valid values, so use explicit check
241+
if v != "" and v is not None:
240242
if isinstance(v, str) and "\n" in v:
241243
command += v.split("\n")
242244
else:
243245
command += [str(v)]
244246
# Add custom parameters
245247
for k, v in custom_params.items():
246248
command += [f"-{k}"]
247-
if v:
249+
# Skip only empty strings (pass flag with no value)
250+
# Note: 0 and 0.0 are valid values, so use explicit check
251+
if v != "" and v is not None:
248252
if isinstance(v, list):
249253
command += [str(x) for x in v]
250254
else:

0 commit comments

Comments
 (0)