-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnakefile
executable file
·58 lines (49 loc) · 1.52 KB
/
Snakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
stream = os.popen('tail -1 data/input.txt')
output = int(stream.read())
scattergather:
split=output
# keep me at the top
rule all:
input:
"results/final_output.txt"
# takes one input, produces one output
rule first_rule:
input:
"data/input.txt"
output:
"intermediate/single_output.txt"
shell:
"workflow/your_script --input {input} --output {output}"
# takes one input, expands to a directory of outputs
rule second_rule:
input:
"intermediate/single_output.txt"
output:
scatter.split("intermediate/multiple_outputs/{scatteritem}.txt")
shell:
"workflow/scatter --input {input} --output '{output}'"
# takes directory of outputs and processes each in parallel
rule third_rule:
input:
"intermediate/multiple_outputs/{scatteritem}.txt"
output:
"intermediate/processed_{scatteritem}.txt"
shell:
"workflow/parallel_processing_script --input {input} --output {output}"
# takes directory of outputs and processes each in parallel
rule fourth_rule:
input:
"intermediate/processed_{scatteritem}.txt"
output:
"intermediate/final_processed_{scatteritem}.txt"
shell:
"workflow/another_script --input {input} --output {output}"
# gathers the results
rule final_rule:
input:
gather.split("intermediate/final_processed_{scatteritem}.txt")
output:
"results/final_output.txt"
shell:
"workflow/aggregation_script --input_dir intermediate/ --output {output}"