Skip to content

Commit fcac1d1

Browse files
Merge pull request #1000 from nextstrain/new-augur-clades
Update workflow for new augur clades version
2 parents 69f91c5 + 7b5312e commit fcac1d1

File tree

4 files changed

+10
-103
lines changed

4 files changed

+10
-103
lines changed

docs/src/reference/change_log.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ We also use this change log to document new features that maintain backward comp
55

66
## New features since last version update
77

8+
## v13 (16 May 2022)
9+
10+
- 16 May 2023: Update workflow to support [Augur v22](https://github.com/nextstrain/augur/releases/tag/22.0.0) which updates the `augur clades` interface and structure of the output files to allow specifying the clade label & coloring keys. Because we use custom scripts to parse these files this worflow also needed updating. This change results in a simplifying of the nCoV pipeline (PR [1000](https://github.com/nextstrain/ncov/pull/1000)).
11+
812
- 11 April 2023: Elevate XBB.1.16 as new clade 23B. See [PR 1059](https://github.com/nextstrain/ncov/pull/1059) for the rationale behind this clade update.
913

1014
- 6 April 2023: Update conda environment dependencies: augur 19.2.0 -> 21.1.0, nextalign/nextclade 2.9.1 -> 2.13.1, iqtree 2.2.0_beta -> 2.2.0.3. [PR 1056](https://github.com/nextstrain/ncov/pull/1056)

scripts/add_branch_labels.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

workflow/envs/nextstrain.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
- bioconda
55
- defaults
66
dependencies:
7-
- augur=21.1.0
7+
- augur=22.0.1
88
- epiweeks=2.1.2
99
- iqtree=2.2.0.3
1010
- nextalign=2.13.1

workflow/snakemake_rules/main_workflow.smk

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ rule emerging_lineages:
10751075
emerging_lineages = config["files"]["emerging_lineages"],
10761076
clades = config["files"]["clades"]
10771077
output:
1078-
clade_data = "results/{build_name}/temp_emerging_lineages.json"
1078+
clade_data = "results/{build_name}/emerging_lineages.json"
10791079
log:
10801080
"logs/emerging_lineages_{build_name}.txt"
10811081
benchmark:
@@ -1089,27 +1089,11 @@ rule emerging_lineages:
10891089
augur clades --tree {input.tree} \
10901090
--mutations {input.nuc_muts} {input.aa_muts} \
10911091
--clades {input.emerging_lineages} \
1092+
--membership-name emerging_lineage \
1093+
--label-name emerging_lineage \
10921094
--output-node-data {output.clade_data} 2>&1 | tee {log}
10931095
"""
10941096

1095-
rule rename_emerging_lineages:
1096-
input:
1097-
node_data = rules.emerging_lineages.output.clade_data
1098-
output:
1099-
clade_data = "results/{build_name}/emerging_lineages.json"
1100-
benchmark:
1101-
"benchmarks/rename_emerging_lineages_{build_name}.txt"
1102-
run:
1103-
import json
1104-
with open(input.node_data, 'r', encoding='utf-8') as fh:
1105-
d = json.load(fh)
1106-
new_data = {}
1107-
for k,v in d['nodes'].items():
1108-
if "clade_membership" in v:
1109-
new_data[k] = {"emerging_lineage": v["clade_membership"]}
1110-
with open(output.clade_data, "w") as fh:
1111-
json.dump({"nodes": new_data}, fh, indent=2)
1112-
11131097
rule colors:
11141098
message: "Constructing colors file"
11151099
input:
@@ -1366,8 +1350,8 @@ def _get_node_data_by_wildcards(wildcards):
13661350
rules.refine.output.node_data,
13671351
rules.ancestral.output.node_data,
13681352
rules.translate.output.node_data,
1369-
rules.rename_emerging_lineages.output.clade_data,
13701353
rules.clades.output.clade_data,
1354+
rules.emerging_lineages.output.clade_data,
13711355
rules.recency.output.node_data,
13721356
rules.traits.output.node_data,
13731357
rules.logistic_growth.output.node_data,
@@ -1462,28 +1446,10 @@ rule export:
14621446
--output {output.auspice_json} 2>&1 | tee {log}
14631447
"""
14641448

1465-
rule add_branch_labels:
1466-
message: "Adding custom branch labels to the Auspice JSON"
1467-
input:
1468-
auspice_json = rules.export.output.auspice_json,
1469-
emerging_clades = rules.emerging_lineages.output.clade_data
1470-
output:
1471-
auspice_json = "results/{build_name}/ncov_with_branch_labels.json"
1472-
log:
1473-
"logs/add_branch_labels{build_name}.txt"
1474-
conda: config["conda_environment"]
1475-
shell:
1476-
"""
1477-
python3 ./scripts/add_branch_labels.py \
1478-
--input {input.auspice_json} \
1479-
--emerging-clades {input.emerging_clades} \
1480-
--output {output.auspice_json}
1481-
"""
1482-
14831449
rule include_hcov19_prefix:
14841450
message: "Rename strains to include hCoV-19/ prefix"
14851451
input:
1486-
auspice_json = rules.add_branch_labels.output.auspice_json,
1452+
auspice_json = rules.export.output.auspice_json,
14871453
tip_frequencies = rules.tip_frequencies.output.tip_frequencies_json
14881454
output:
14891455
auspice_json = "results/{build_name}/ncov_with_hcov19_prefix.json",

0 commit comments

Comments
 (0)