I’ve developed a simple testing framework for Snakemake workflows. Each test case has some number of input/output files. Tests are run like so:
- An empty working directory is created.
- The input files are copied to the working directory (or symlinked to from it).
- Snakemake is invoked in the working directory using the CLI to generate the output files.
- The framework checks that the expected output files exist and their contents match example versions.
This mostly works, but I run into some situations where Snakemake decides that the input files are out of date and need to be recreated from scratch. I would like to prevent this from happening, so that Snakemake only runs the small set of rules that are meant to be tested. I have looked into the following solutions:
- The
--rerun-triggers
option seems like it may do what I need but the documentation isn’t very clear about what the possible values mean. There is not a “none” or “never” value, and it will not accept an empty value. - Providing a whitelist of the rules that can be run. If Snakemake can’t produce the requested files with these rules then it should fail. Unfortunately there doesn’t seem to be a way to do this. The
--omit-from
option does sort of the opposite, acting as a blacklist instead of a whitelist. - Running
--touch
on all input files first. This might work, but I’m not completely sure how this is supposed to work from the documentation (if this is tracked within the.snakemake/
directory, or if it actually works like thetouch
command and just updates themtime
of the files themselves [and if so if that works when the files are symlinks]).