-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Problem description
This is an issues that we encountered when working on MOF-Search.
Snakefmt seems to be unable to parse correctly lambda functions used in the threads: section of rule definitions, due to which it then introduces line breaks in a way that invalidates the original Snakefile.
Example
Original Snakefile
rule decompress_and_run_cobs:
output: "test"
threads: lambda wildcards, input: get_number_of_COBS_threads(wildcards, input, predefined_cobs_threads, streaming)
shell:
"""
touch {output}
"""Reformated Snakefile
If I run snakefmt Snakefile, I end up with the following Snakefile:
rule decompress_and_run_cobs:
output:
"test",
threads: lambda wildcards, input: get_number_of_COBS_threads(
wildcards, input, predefined_cobs_threads, streaming
)
shell:
"""
touch {output}
"""Parsing errors
After which Snakemake fails with the following error:
$ snakemake -j1
SyntaxError in file /private/tmp/~20231128150941/Snakefile, line 5:
Unexpected keyword wildcards in rule definition (Snakefile, line 5)And Snakefmt cannot be rerun either.
$ snakefmt Snakefile
snakefmt.exceptions.InvalidParameterSyntax: 4lambda wildcards , input: get_number_of_COBS_threads(Version
$ snakefmt --version
snakefmt, version 0.8.5Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working