-
Notifications
You must be signed in to change notification settings - Fork 27
/
Snakefile
105 lines (85 loc) · 4.16 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import datetime
import pandas as pd
from treetime.utils import numeric_date
wildcard_constraints:
lineage = r'h1n1pdm|h3n2|vic|yam',
segment = r'pb2|pb1|pa|ha|np|na|mp|ns',
center = r'who|cdc|crick|niid|crick|vidrl',
passage = r'cell|egg',
assay = r'fra|hi',
host = r'ferret|human|mouse'
# Load distance map configuration for lineages and segments.
distance_map_config = pd.read_table("config/distance_maps.tsv")
lineage_name_by_abbreviation = {
"h3n2": "H3N2",
"h1n1pdm": "H1N1pdm",
"vic": "Vic",
"yam": "Yam",
}
clade_url_by_lineage_and_segment = {
"h1n1pdm": {
"ha": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H1N1pdm_HA/main/.auto-generated/clades.tsv",
},
"h3n2": {
"ha": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H3N2_HA/main/.auto-generated/clades.tsv",
},
"vic": {
"ha": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_B-Vic_HA/main/.auto-generated/clades.tsv",
}
}
subclade_url_by_lineage_and_segment = {
"h1n1pdm": {
"ha": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H1N1pdm_HA/main/.auto-generated/subclades.tsv",
"na": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H1N1pdm_NA/main/.auto-generated/subclades.tsv",
},
"h3n2": {
"ha": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H3N2_HA/main/.auto-generated/subclades.tsv",
"na": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H3N2_NA/main/.auto-generated/subclades.tsv",
},
"vic": {
"ha": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_B-Vic_HA/main/.auto-generated/subclades.tsv",
"na": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_B-Vic_NA/main/.auto-generated/subclades.tsv",
}
}
proposed_subclade_url_by_lineage_and_segment = {
"h1n1pdm": {
"ha": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H1N1pdm_HA/main/.auto-generated/subclade-proposals.tsv",
"na": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H1N1pdm_NA/main/.auto-generated/subclade-proposals.tsv",
},
"h3n2": {
"ha": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H3N2_HA/main/.auto-generated/subclade-proposals.tsv",
"na": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H3N2_NA/main/.auto-generated/subclade-proposals.tsv",
},
"vic": {
"ha": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_B-Vic_HA/main/.auto-generated/subclade-proposals.tsv",
"na": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_B-Vic_NA/main/.auto-generated/subclade-proposals.tsv",
}
}
if "data_source" in config and config["data_source"]=='fauna':
include: "workflow/snakemake_rules/download_from_fauna.smk"
include: "workflow/snakemake_rules/array_builds.smk"
include: "workflow/snakemake_rules/select_strains.smk"
include: "workflow/snakemake_rules/core.smk"
include: "workflow/snakemake_rules/export.smk"
include: "workflow/snakemake_rules/titer_models.smk"
include: "workflow/snakemake_rules/fitness.smk"
def _get_build_outputs():
outputs = []
for build_name, build_params in config["builds"].items():
for segment in config["segments"]:
outputs.extend([
f"auspice/{build_name}_{segment}.json",
f"auspice/{build_name}_{segment}_tip-frequencies.json",
])
if segment == "ha" and build_params.get("enable_measurements", False):
outputs.append(f"auspice/{build_name}_{segment}_measurements.json")
if build_params.get("enable_forecasts", False):
for model in config["fitness_model"]["models"]:
outputs.append(f"auspice/{build_name}_ha_{model}_forecast-tip-frequencies.json")
return outputs
if "custom_rules" in config:
for rule_file in config["custom_rules"]:
include: rule_file
rule all:
input:
_get_build_outputs()