-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnakefile
35 lines (29 loc) · 1008 Bytes
/
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
MODELRUNS = ['bau', 'currentpolicies', 'sdg7']
rule all:
input: ["results/{modelrun}/csv/AccumulatedNewCapacity.csv".format(modelrun=x) for x in MODELRUNS]
message: "Running pipeline to generate the files '{input}'"
rule prepare_model:
output: "processed_data/{modelrun}/osemosys.txt"
params: modelrun="{modelrun}"
shell:
"bash scripts/osemosys_run.sh {params.modelrun}"
rule solve:
input: data="data/data_{modelrun}.txt", model="processed_data/{modelrun}/osemosys.txt"
output: results="results/{modelrun}.sol",csv="results/{modelrun}/csv/AccumulatedNewCapacity.csv"
log: "processed_data/{modelrun}/glpsol.log"
conda: "env/osemosys.yaml"
shell:
"glpsol -d {input.data} -m {input.model} -o {output.results} > {log}"
rule clean:
shell:
"rm -fr processed_data/* results/* *.png"
rule make_dag:
output: pipe("dag.txt")
shell:
"snakemake --dag > {output}"
rule plot_dag:
input: "dag.txt"
output: "dag.png"
conda: "env/dag.yaml"
shell:
"dot -Tpng {input} > dag.png && open dag.png"