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