Conditional Snakemake
Today’s problem was how to write a Snakefile that would apply a user-created mask if one was created when automatic masking was unsuccessful. Snakemake is very python-y under the hood so in a way this should be obvious but it took me some time to figure out.
The inputs to a rule can be a python function instead of a static list of files so we can write a Snakefile like the following: