-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnakefile
65 lines (59 loc) · 2.13 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
59
60
61
62
63
64
65
rule fetch_and_rename:
input:
"config/{lineage}_old_to_new.json"
output:
"auspice/{prefix}renamed_{lineage}_{resolution}_{segment}.json"
params:
key = "renamed_clade"
shell:
"""
python3 scripts/rename_old_clades.py --lineage {wildcards.lineage} \
--resolution {wildcards.resolution} \
--segment {wildcards.segment} \
--clade-map {input} \
--key {params.key} \
--output {output}
"""
rule suggest_new_clades:
input:
renamed_auspice = "auspice/{prefix}renamed_{lineage}_{resolution}_{segment}.json",
clade_map = "config/{lineage}_old_to_new.json",
weights = "config/weights.json",
output:
"auspice/{prefix}suggested_{lineage}_{resolution}_{segment}.json"
params:
old_key = "renamed_clade",
new_key = "new_clade",
add_to_existing = lambda w:"" if w.segment=='na' else "--add-to-existing"
shell:
"""
python3 scripts/add_new_clades.py --input {input.renamed_auspice} \
--clade-map {input.clade_map} \
--weights {input.weights} \
--segment {wildcards.segment} \
--lineage {wildcards.lineage} \
{params.add_to_existing} \
--old-key {params.old_key} --new-key {params.new_key} \
--output {output}
"""
rule add_provenance:
input:
"auspice/{prefix}suggested_{lineage}_{resolution}_{segment}.json"
output:
"auspice/{prefix}with-provenance_{lineage}_{resolution}_{segment}.json"
params:
key = "new_clade"
shell:
"""
python3 scripts/add_provenance.py --input {input} --key {params.key}\
--output {output}
"""
from datetime import date
today = date.today().strftime('%Y-%m-%d')
rule all:
input:
expand("auspice/{prefix}suggested_{lineage}_{resolution}_{segment}.json",
prefix = [today+'_'],
lineage = ['h3n2', 'h1n1pdm', 'vic'],
resolution = ['2y', '6y'],
segment = ['ha', 'na'])