How to execute Snakemake commands from a directory#

Sometimes, it can be useful to execute the Snakemake targets without Python coding from the directory of a simulation. Calling directly Snakemake can be slightly difficult so there is a Snek5000 command, snek-make, for this task. The help of this function can be obtained with (the ! is for calling a command in Jupyter):

!snek-make -h
usage: snek-make [-h] [-l] [-d] [-np NPROC] [--clean-after-fail] [rule]

Execute Snakemake rules

positional arguments:
  rule                  Snakemake rule to be executed.

optional arguments:
  -h, --help            show this help message and exit
  -l, --list-rules      List rules and exit.
  -d, --dry-run         Dry run snakemake rules without executing.
  -np NPROC, --nproc NPROC
                        Number of MPI processes.
  --clean-after-fail    Clean incomplete output files of failed jobs.

From a simulation directory, snek-make -l lists the available targets. One can do for example:

snek-make cleanall
snek-make compile
snek-make show_config
snek-make run_fg