Snakemake wrapper to simplify the use of Nix and Guix
The Nix wrapper requires:
-
params.flaketo know which shell to use -
params.shellfor the command to execute
rule test:
input:
"flake.nix",
"flake.lock",
script="run.py"
output:
"test_{i}"
params:
flake = ".#pyshell",
shell = lambda wildcards, input, output: f"python3 {input.script} {wildcards.i} > {output}"
wrapper:
"https://github.com/Nix4Science/snakemake-wrapper/raw/0.1.0/nix"
To simplify the transition from a classical Snakefile to a Snakefile using this wrapper, we extend the params.shell to do the evaluation inside the wrapper.
If you define the string of params.shell as bytes, the wrapper will evaluate the string itself.
So the following is exactly the same as above:
# ...
params:
shell = b"python3 {input.script} {wildcards.i} > {output}"
# ...
The Guix wrapper requires:
-
input.manifestfor the manifest of the environment -
input.channelsfor the description of the channels to use -
params.shellfor the command to execute
Optional parameters:
params.containerto run the shell with the--containeroption
rule test_guix:
input:
channels="channels.scm",
manifest="manifest.scm",
script="run.py"
output:
"test_{i}"
params:
container=True,
shell = b"python3 {input.script} {wildcards.i} > {output}"
wrapper:
"https://github.com/Nix4Science/snakemake-wrapper/raw/0.1.0/guix"
To simplify the transition from a classical Snakefile to a Snakefile using this wrapper, we extend the params.shell to do the evaluation inside the wrapper.
If you define the string of params.shell as bytes, the wrapper will evaluate the string itself.
So the following is exactly the same as above:
# ...
params:
shell = b"python3 {input.script} {wildcards.i} > {output}"
# ...