Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RBD level coloring and filter #1094

Merged
merged 6 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/src/reference/change_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ We also use this change log to document new features that maintain backward comp

## New features since last version update

- 30 January 2024: Fix RBD-level coloring by updating clade label and clade parsing. [PR 1094](https://github.com/nextstrain/ncov/pull/1094)

- 14 Dec 2023: Use `nextclade2` binary that makes the version explicit [PR 1089](https://github.com/nextstrain/ncov/pull/1089)

- 17 June 2023: Update subsampling strategy for `nextstrain_profiles` to better equilibrate per-capita sampling rates across geographic regions. Primarily this update breaks out China and India as separate subsampling targets because of their large population sizes. It also fine tunes the per-region sampling targets. After this update, URL structure (ie https://nextstrain.org/ncov/gisaid/global/6m) is unchanged. [PR 1074](https://github.com/nextstrain/ncov/pull/1074)

## v13 (16 May 2023)
Expand Down
8 changes: 4 additions & 4 deletions scripts/assign_rbd_levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
def find_matching_nodes(clades_fname, basal_clade_label, tree_fname):
basal_node_name = None
with open(clades_fname) as fh:
for name, node_data in json.load(fh)['nodes'].items():
if node_data.get('clade_annotation', '') == basal_clade_label:
for name, node_data in json.load(fh)['branches'].items():
if node_data.get('labels', {}).get('clade', '') == basal_clade_label:
basal_node_name = name
break
if not basal_node_name:
print(f"WARNING: no node found with a clade_annotation of {basal_clade_label}. This script will proceed, but no levels will be exported.")
print(f"WARNING: no branch found with a clade of {basal_clade_label}. This script will proceed, but no levels will be exported.")
return set()
print(f"Node representing {basal_clade_label}: {basal_node_name}")
T = Phylo.read(tree_fname, 'newick')
Expand Down Expand Up @@ -92,4 +92,4 @@ def classify_into_levels(spike_seq, rbd_mutations):
node_data['rbd_level_details'][name] = ", ".join([f"S:{x[0][1]}{x[1]} ({x[2]})" for x in zip(rbd_mutations, codons, calls)])

with open(args.output_node_data, 'w') as fh:
json.dump(node_data, fh, indent=2)
json.dump(node_data, fh, indent=2)
1 change: 0 additions & 1 deletion workflow/snakemake_rules/export_for_nextstrain.smk
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ rule auspice_config:
"pango_lineage",
"Nextclade_pango",
"region",
"level",
"country",
"division",
location_filter,
Expand Down
6 changes: 4 additions & 2 deletions workflow/snakemake_rules/main_workflow.smk
Original file line number Diff line number Diff line change
Expand Up @@ -1304,11 +1304,13 @@ rule assign_rbd_levels:
tree = "results/{build_name}/tree.nwk",
params:
config=config["files"]["rbd_level_definitions"],
basal_clade_label="21L (Omicron)"
basal_clade_label="21L (BA.2)"
joverlee521 marked this conversation as resolved.
Show resolved Hide resolved
output:
node_data="results/{build_name}/rbd_levels.json",
log:
"logs/assign_rbd_levels_{build_name}.txt"
benchmark:
"benchmarks/assign_levels_{build_name}.txt",
"benchmarks/assign_rbd_levels_{build_name}.txt",
conda:
config["conda_environment"],
shell:
Expand Down
Loading