From c91b45a07f46bbf6eddb1459a101f667aff739ce Mon Sep 17 00:00:00 2001 From: Simon Guest Date: Tue, 8 Oct 2024 11:27:33 +1300 Subject: [PATCH] Didn't need rule order, just a carefully written branch --- workflow/playpen.smk | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/workflow/playpen.smk b/workflow/playpen.smk index 13395af..7ca4d33 100644 --- a/workflow/playpen.smk +++ b/workflow/playpen.smk @@ -8,20 +8,18 @@ rule a2b: output: "{path}.b" shell: "sed -e 's/a/b/g' {wildcards.path}.a >{wildcards.path}.b" -def wildcard_path_endswith_gz(wildcards): - return wildcards["path"].endswith(".gz") - rule gunzip: input: - branch(wildcard_path_endswith_gz, - then=[], - otherwise="{path}.gz") + branch(lambda wildcards: not wildcards["path"].endswith(".gz"), + then="{path}.gz", + otherwise="/N/A") output: "{path}" shell: "gunzip -k {wildcards.path}.gz" rule gzip: - input: "{path}" + input: + branch(lambda wildcards: not wildcards["path"].endswith(".gz"), + then="{path}", + otherwise="/N/A") output: "{path}.gz" shell: "gzip -k {wildcards.path}" - -ruleorder: a2b > gzip > gunzip