Exercises: rules and dependencies
Use snakemake-workshop/work-rules with .venv active after completing the walkthrough. Exercises 3.1 and 3.2 are core practice; 3.3 is an extension.
3.1 Rebuild only the table
Delete only the generated summary.tsv. Predict which rules are needed and how many generator jobs will run. Perform a dry run, execute, then check the table header and ten rows.
3.2 One target versus the collection
First ensure the default workflow is up to date. Delete results/output_6.txt, then request only that filename:
snakemake --cores 2 --scheduler greedy results/output_6.txt
Does this invocation also update summary.tsv? Immediately perform a dry run of the default target, then execute it. Explain the difference between the two plans.
Hint
A file's downstream consumers are only needed when they lie on the path to the requested target.
3.3 Extension: invalid input must fail
Create a deliberately invalid input in this exercise directory:
printf 'result: banana\n' > invalid-example.txt
python collect_results.py invalid-summary.tsv invalid-example.txt
Expect the Python command to fail. Read its error message. Why is a successful workflow-engine exit alone insufficient to guarantee a scientifically meaningful result? Explain what this collector does check and what it does not.