Skip to content

Commit 5fcf317

Browse files
committed
Improve snakemake mindset
1 parent 2ff9d95 commit 5fcf317

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

episodes/02_snakemake_mindset.md

+26-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ teaching: 10
88
- What are the parts of a snakemake workflow?
99
- What is a snakemake rule?
1010
- How does snakemake combine rules into jobs to run?
11+
- How is a Snakemake Rule different from a Snakemake Job?
1112

1213
::::::::::::::::::::::::::::::::::::::::::::::::
1314
::::::::::::::::::::::::::::::::::::: objectives
@@ -25,9 +26,6 @@ teaching: 10
2526
- Provides support for specifying containers for each rule
2627
- Provides support for many HPC Clusters including SLURM
2728

28-
TODO
29-
Explain DAG
30-
3129
## What is a Snakemake Rule?
3230

3331
Main parts of a Snakemake Rule used in this workshop
@@ -51,6 +49,31 @@ rule <name>:
5149
```
5250

5351
## How Snakemake combines rules
52+
### Example workflow
53+
54+
Create checksums for each image and zip up the results
55+
```
56+
fish1.jpg
57+
fish2.jpg
58+
```
59+
rule checksum1:
60+
input: "fish1.jpg"
61+
output: "fish1.checksum"
62+
...
63+
64+
rule checksum2:
65+
input: "fish2.jpg"
66+
output: "fish2.checksum"
67+
...
68+
69+
rule zip:
70+
input: "fish1.jpg", "fish1.checksum", "fish2.jpg", "fish2.checksum"
71+
ouput: "result.zip"
72+
...
73+
```
74+
75+
Explain DAG
76+
DAG (directed acyclic graph)
5477
5578
Rules vs Jobs
5679
Job is running a rule to create a specific set of output files.

episodes/12_run_on_slurm.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Create a script name `run-workflow.sh` to run snakemake in the background.
5555
#SBATCH --time=00:30:00
5656
. Scripts/setup_env.sh
5757
JOBS=10
58-
snakemake --jobs $JOBS --use-singularity --profile slurm/ "$@"
58+
snakemake --jobs $JOBS --use-singularity --profile slurm/
5959
```
6060

6161
## Delete All Outputs
@@ -66,7 +66,7 @@ snakemake c1 --delete-all-output
6666
## Run Background job and monitor progress
6767
Run snakemake in the background scaling up
6868
```bash
69-
sbatch run-workflow.sh -c10
69+
sbatch run-workflow.sh
7070
```
7171

7272
## Monitor job
@@ -78,6 +78,5 @@ squeue -u $LOGNAME
7878

7979
Where did my logs go?
8080
```bash
81-
ls logs
8281
ls logs/
8382
```

0 commit comments

Comments
 (0)