In snakemake I would like to access keys from the config
from within the shell:
directive. I can use {input.foo}
, {output.bar}
, and {params.baz}
, but {config.quux}
is not supported. Is there a way to achieve this?
rule do_something:
input: "source.txt"
output: "target.txt"
params:
# access config[] here. parameter tracking is a side effect
tmpdir = config['tmpdir']
shell:
# using {config.tmpdir} or {config['tmpdir']} here breaks the build
"./scripts/do.sh --tmpdir {params.tmpdir} {input} > {output}; "
I could assign the parts of the config I want to a key under params
, and then use a {param.x}
replacement, but this has unwanted side effects (e.g. the parameter is saved in the snakemake metadata (i.e. .snakemake/params_tracking
). Using run:
instead of shell:
would be another workaround, but accessing {config.tmpdir}
directly from the shell
block, would be most desirable.