-
Notifications
You must be signed in to change notification settings - Fork 2
Executing workflows
The easiest way to execute a workflow is to simply run snakemake in the workflow's main directory, which is defined as the directory containing Snakefile. Run this way, Snakemake will execute the workflow implemented in Snakefile using the current directory as working directory (i.e. all paths in rule definitions will be relative to the current directory).
When executed, Snakemake tries to generate a specific output called target, and resolve all dependencies bsaed on this target. By default, the target is the output of the first rule in Snakefile; in this case, the rule cannot contain wildcards, as they could not be resolved. Targets can also be specified in the command-line arguments with the syntax snakemake <target>, which is how we executed examples in the previous sections:
snakemake results/first_step.txt.
With this syntax, a target can be any output that can be generated by any rule in the workflow. You cannot use wildcards in targets.
By default, existing outputs are only generated again if the input of the rule that generates them is newer than them, based on file modification dates. You can force snakemake to generate a target with the following syntax: snakemake --force <target>. To force generate all outputs, use snakemake --forceall.
Sometimes, you want to test your workflow without actually running it. To do so, you can perform a dry-run by running Snakemake with the -n flag: snakemake -n <target>. Snakemake will then display all jobs required to generate the target. To obtain additional information on why a specific job is necessary, run Snakemake will the -r flag (which can be and is usually combined with -n): snakemake -n -r <target>. For each job, Snakemake will print a reason field explaining why the job was required.
- Defining rules
- Rule dependencies
- Wildcards
- Executing workflows
- The expand syntax
- Non-file rule parameters
- Executing Python code