Skip to content

Commit

Permalink
Merge pull request #1000 from nextstrain/new-augur-clades
Browse files Browse the repository at this point in the history
Update workflow for new augur clades version
  • Loading branch information
jameshadfield authored May 17, 2023
2 parents 69f91c5 + 7b5312e commit fcac1d1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 103 deletions.
4 changes: 4 additions & 0 deletions docs/src/reference/change_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ We also use this change log to document new features that maintain backward comp

## New features since last version update

## v13 (16 May 2022)

- 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 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.

- 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)
Expand Down
63 changes: 0 additions & 63 deletions scripts/add_branch_labels.py

This file was deleted.

2 changes: 1 addition & 1 deletion workflow/envs/nextstrain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
- bioconda
- defaults
dependencies:
- augur=21.1.0
- augur=22.0.1
- epiweeks=2.1.2
- iqtree=2.2.0.3
- nextalign=2.13.1
Expand Down
44 changes: 5 additions & 39 deletions workflow/snakemake_rules/main_workflow.smk
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ rule emerging_lineages:
emerging_lineages = config["files"]["emerging_lineages"],
clades = config["files"]["clades"]
output:
clade_data = "results/{build_name}/temp_emerging_lineages.json"
clade_data = "results/{build_name}/emerging_lineages.json"
log:
"logs/emerging_lineages_{build_name}.txt"
benchmark:
Expand All @@ -1089,27 +1089,11 @@ rule emerging_lineages:
augur clades --tree {input.tree} \
--mutations {input.nuc_muts} {input.aa_muts} \
--clades {input.emerging_lineages} \
--membership-name emerging_lineage \
--label-name emerging_lineage \
--output-node-data {output.clade_data} 2>&1 | tee {log}
"""

rule rename_emerging_lineages:
input:
node_data = rules.emerging_lineages.output.clade_data
output:
clade_data = "results/{build_name}/emerging_lineages.json"
benchmark:
"benchmarks/rename_emerging_lineages_{build_name}.txt"
run:
import json
with open(input.node_data, 'r', encoding='utf-8') as fh:
d = json.load(fh)
new_data = {}
for k,v in d['nodes'].items():
if "clade_membership" in v:
new_data[k] = {"emerging_lineage": v["clade_membership"]}
with open(output.clade_data, "w") as fh:
json.dump({"nodes": new_data}, fh, indent=2)

rule colors:
message: "Constructing colors file"
input:
Expand Down Expand Up @@ -1366,8 +1350,8 @@ def _get_node_data_by_wildcards(wildcards):
rules.refine.output.node_data,
rules.ancestral.output.node_data,
rules.translate.output.node_data,
rules.rename_emerging_lineages.output.clade_data,
rules.clades.output.clade_data,
rules.emerging_lineages.output.clade_data,
rules.recency.output.node_data,
rules.traits.output.node_data,
rules.logistic_growth.output.node_data,
Expand Down Expand Up @@ -1462,28 +1446,10 @@ rule export:
--output {output.auspice_json} 2>&1 | tee {log}
"""

rule add_branch_labels:
message: "Adding custom branch labels to the Auspice JSON"
input:
auspice_json = rules.export.output.auspice_json,
emerging_clades = rules.emerging_lineages.output.clade_data
output:
auspice_json = "results/{build_name}/ncov_with_branch_labels.json"
log:
"logs/add_branch_labels{build_name}.txt"
conda: config["conda_environment"]
shell:
"""
python3 ./scripts/add_branch_labels.py \
--input {input.auspice_json} \
--emerging-clades {input.emerging_clades} \
--output {output.auspice_json}
"""

rule include_hcov19_prefix:
message: "Rename strains to include hCoV-19/ prefix"
input:
auspice_json = rules.add_branch_labels.output.auspice_json,
auspice_json = rules.export.output.auspice_json,
tip_frequencies = rules.tip_frequencies.output.tip_frequencies_json
output:
auspice_json = "results/{build_name}/ncov_with_hcov19_prefix.json",
Expand Down

0 comments on commit fcac1d1

Please sign in to comment.