Skip to content

Instantly share code, notes, and snippets.

@tsibley
Last active January 19, 2023 17:33
Show Gist options
  • Save tsibley/62c4ea5ab8b72ea6aa0fb015a868fd8e to your computer and use it in GitHub Desktop.
Save tsibley/62c4ea5ab8b72ea6aa0fb015a868fd8e to your computer and use it in GitHub Desktop.

Run as

snakemake all_c

and you'll get this:

$ tree
.
├── a
│   ├── orange
│   ├── red
│   └── yellow
├── b
│   ├── blue
│   ├── green
│   └── purple
├── c
│   ├── orange-blue
│   ├── orange-green
│   ├── orange-purple
│   ├── red-blue
│   ├── red-green
│   ├── red-purple
│   ├── yellow-blue
│   ├── yellow-green
│   └── yellow-purple
└── Snakefile

3 directories, 16 files
rule a:
output: "a/{a}"
shell: """
echo {wildcards.a:q} > {output:q}
"""
rule b:
output: "b/{b}"
shell: """
echo {wildcards.b:q} > {output:q}
"""
rule c:
input:
a="a/{a}",
b="b/{b}"
output: "c/{a}-{b}"
shell: """
cat {input.a:q} {input.b:q} > {output:q}
"""
rule all_c:
input: expand("c/{a}-{b}", a=["red", "orange", "yellow"], b=["green", "blue", "purple"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment