-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathSnakefile
79 lines (51 loc) · 1.96 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
from snakemake.utils import min_version
min_version(
"7.7.0"
) # Snakemake 7.7.0 introduced `retries` directive used in fetch-sequences
# Use default configuration values. Override with Snakemake's --configfile/--config options.
configfile: "defaults/config.yaml"
send_slack_notifications = config.get("send_slack_notifications", False)
def _get_all_targets(wildcards):
# Default targets are the metadata TSV and sequences FASTA files
all_targets = ["results/sequences.fasta", "results/metadata.tsv"]
# Add additional targets based on upload config
upload_config = config.get("upload", {})
for target, params in upload_config.items():
files_to_upload = params.get("files_to_upload", {})
if not params.get("dst"):
print(
f"Skipping file upload for {target!r} because the destination was not defined."
)
else:
all_targets.extend(
expand(
[f"data/upload/{target}/{{remote_file_name}}.done"],
zip,
remote_file_name=files_to_upload.keys(),
)
)
# Add additional targets for Nextstrain's internal Slack notifications
if send_slack_notifications:
all_targets.extend(
[
"data/notify/genbank-record-change.done",
"data/notify/metadata-diff.done",
]
)
if config.get("trigger_rebuild", False):
all_targets.append("data/trigger/rebuild.done")
return all_targets
rule all:
input:
_get_all_targets,
include: "rules/fetch_from_ncbi.smk"
include: "rules/curate.smk"
if config.get("upload", False):
include: "rules/upload.smk"
if send_slack_notifications:
include: "rules/slack_notifications.smk"
if config.get("trigger_rebuild", False):
include: "rules/trigger_rebuild.smk"
if "custom_rules" in config:
for rule_file in config["custom_rules"]:
include: rule_file