diff --git a/Snakefile b/Snakefile index 3bb58589..e84a2dce 100644 --- a/Snakefile +++ b/Snakefile @@ -48,18 +48,18 @@ subclade_url_by_lineage_and_segment = { } } -emerging_subclade_url_by_lineage_and_segment = { +proposed_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", + "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/emerging/.auto-generated/subclades.tsv", - "na": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_A-H3N2_NA/main/.auto-generated/subclades.tsv", + "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/subclades.tsv", - "na": "https://raw.githubusercontent.com/influenza-clade-nomenclature/seasonal_B-Vic_NA/main/.auto-generated/subclades.tsv", + "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", } } diff --git a/config/h1n1pdm/ha/auspice_config.json b/config/h1n1pdm/ha/auspice_config.json index f581c735..fbf545b9 100644 --- a/config/h1n1pdm/ha/auspice_config.json +++ b/config/h1n1pdm/ha/auspice_config.json @@ -51,58 +51,85 @@ "scale": [ [ "C.1", - "#492AB5" + "#3F52CD" ], [ "C.1.1", - "#3F4CCB" + "#4681CA" ], [ - "C.1.2", - "#4271CE" + "C.1.8", + "#57A1AD" + ], + [ + "C.1.9", + "#70B487" + ], + [ + "D", + "#90BC65" + ], + [ + "D.1", + "#B4BD4C" ], [ - "C.1.5", - "#4C8FC0" + "D.2", + "#D3B240" ], [ - "C.1.7", - "#5AA5A8" + "D.3", + "#E59638" ], [ - "C.1.7.1", - "#6DB38A" + "D.4", + "#E4642E" + ] + ] + }, + { + "key": "proposed_subclade", + "title": "Proposed subclade", + "type": "categorical", + "scale": [ + [ + "C.1", + "#3F52CD" ], [ - "C.1.7.2", - "#85BA6F" + "C.1.1", + "#4681CA" ], [ "C.1.8", - "#A0BE59" + "#57A1AD" ], [ "C.1.9", - "#BBBC49" + "#70B487" ], [ "D", - "#D2B340" + "#90BC65" ], [ "D.1", - "#E19F3A" + "#B4BD4C" ], [ "D.2", - "#E68033" + "#D3B240" ], [ "D.3", - "#E2562B" + "#E59638" ], [ "D.4", + "#E4642E" + ], + [ + "D.5", "#DB2823" ] ] @@ -210,7 +237,8 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "clade_membership", + "color_by": "subclade", + "branch_label": "Subclade", "tip_label": "gisaid_strain" }, "filters": [ diff --git a/config/h1n1pdm/na/auspice_config.json b/config/h1n1pdm/na/auspice_config.json index f25da330..8eb3865c 100644 --- a/config/h1n1pdm/na/auspice_config.json +++ b/config/h1n1pdm/na/auspice_config.json @@ -49,41 +49,36 @@ "title": "Subclade", "type": "categorical", "scale": [ - [ - "C", - "#3E5DD0" - ], - [ - "C.3", - "#4A8CC2" - ], [ "C.4", - "#60AA9E" - ], - [ - "C.5.1.1", - "#80B974" - ], - [ - "C.5.2", - "#A6BE55" + "#4E94BD" ], [ "C.5.3", - "#CBB742" + "#81BA72" ], [ "C.5.3.1", - "#E29D39" + "#C8B944" + ] + ] + }, + { + "key": "proposed_subclade", + "title": "Proposed subclade", + "type": "categorical", + "scale": [ + [ + "C.4", + "#4E94BD" ], [ - "C.5.3.2", - "#E56A2F" + "C.5.3", + "#81BA72" ], [ - "C.5.3.3", - "#DB2823" + "C.5.3.1", + "#C8B944" ] ] }, @@ -175,7 +170,8 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "clade_membership", + "color_by": "subclade", + "branch_label": "Subclade", "tip_label": "gisaid_strain" }, "filters": [ diff --git a/config/h3n2/ha/auspice_config.json b/config/h3n2/ha/auspice_config.json index b678a4b7..bc473236 100644 --- a/config/h3n2/ha/auspice_config.json +++ b/config/h3n2/ha/auspice_config.json @@ -76,8 +76,8 @@ ] }, { - "key": "emerging_subclade", - "title": "Emerging subclade", + "key": "proposed_subclade", + "title": "Proposed subclade", "type": "categorical", "scale": [ [ @@ -227,7 +227,8 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "clade_membership", + "color_by": "subclade", + "branch_label": "Subclade", "tip_label": "gisaid_strain" }, "filters": [ diff --git a/config/h3n2/na/auspice_config.json b/config/h3n2/na/auspice_config.json index 99ea9759..19d164ac 100644 --- a/config/h3n2/na/auspice_config.json +++ b/config/h3n2/na/auspice_config.json @@ -67,6 +67,29 @@ ] ] }, + { + "key": "proposed_subclade", + "title": "Proposed subclade", + "type": "categorical", + "scale": [ + [ + "B.4", + "#4A8CC2" + ], + [ + "B.4.1", + "#71B486" + ], + [ + "B.4.2", + "#ABBD52" + ], + [ + "B.4.3", + "#DEA73C" + ] + ] + }, { "key": "haplotype", "title": "Derived haplotype", @@ -160,7 +183,8 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "clade_membership", + "color_by": "subclade", + "branch_label": "Subclade", "tip_label": "gisaid_strain" }, "filters": [ diff --git a/config/vic/ha/auspice_config.json b/config/vic/ha/auspice_config.json index 3f0c279f..ff882a89 100644 --- a/config/vic/ha/auspice_config.json +++ b/config/vic/ha/auspice_config.json @@ -44,7 +44,7 @@ "title": "Clade", "type": "categorical" }, - { + { "key": "subclade", "title": "Subclade", "type": "categorical", @@ -79,6 +79,41 @@ ] ] }, + { + "key": "proposed_subclade", + "title": "Proposed subclade", + "type": "categorical", + "scale": [ + [ + "C.2", + "#4272CE" + ], + [ + "C.3", + "#58A2AC" + ], + [ + "C.5", + "#7DB877" + ], + [ + "C.5.1", + "#AEBD50" + ], + [ + "C.5.4", + "#D8AE3E" + ], + [ + "C.5.6", + "#E67A32" + ], + [ + "C.5.7", + "#DB2823" + ] + ] + }, { "key": "cTiter", "title": "Antigenic advance (tree model)", @@ -167,7 +202,8 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "clade_membership", + "color_by": "subclade", + "branch_label": "Subclade", "tip_label": "gisaid_strain" }, "filters": [ diff --git a/config/vic/na/auspice_config.json b/config/vic/na/auspice_config.json index ce9b5490..d31f2844 100644 --- a/config/vic/na/auspice_config.json +++ b/config/vic/na/auspice_config.json @@ -51,35 +51,70 @@ "scale": [ [ "B", - "#3E5DD0" + "#4068CF" ], [ "B.3", - "#4A8CC2" + "#5098B9" ], [ "B.5", - "#60AA9E" + "#6CB28C" ], [ - "B.6", - "#80B974" + "B.7", + "#94BD62" + ], + [ + "B.7.1", + "#BFBB47" + ], + [ + "B.7.2", + "#DFA53B" + ], + [ + "B.7.3", + "#E67131" + ], + [ + "B.8", + "#DB2823" + ] + ] + }, + { + "key": "proposed_subclade", + "title": "Proposed subclade", + "type": "categorical", + "scale": [ + [ + "B", + "#4068CF" + ], + [ + "B.3", + "#5098B9" + ], + [ + "B.5", + "#6CB28C" ], [ "B.7", - "#A6BE55" + "#94BD62" ], [ "B.7.1", - "#CBB742" + "#BFBB47" ], [ "B.7.2", - "#E29D39" + "#DFA53B" ], [ "B.7.3", - "#E56A2F" + "#E67131" ], [ "B.8", @@ -160,7 +195,8 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "clade_membership", + "color_by": "subclade", + "branch_label": "Subclade", "tip_label": "gisaid_strain" }, "filters": [ diff --git a/profiles/nextflu-private-forecasts.yaml b/profiles/nextflu-private-forecasts.yaml index e79fc6b2..2975b2f7 100644 --- a/profiles/nextflu-private-forecasts.yaml +++ b/profiles/nextflu-private-forecasts.yaml @@ -33,7 +33,7 @@ array-builds: tree_exclude_sites: "config/h3n2/{{segment}}/exclude-sites.txt" clades: "config/h3n2/ha/clades.tsv" subclades: "config/h3n2/ha/subclades.tsv" - emerging_subclades: "config/h3n2/ha/emerging_subclades.tsv" + proposed_subclades: "config/h3n2/ha/proposed_subclades.tsv" auspice_config: "profiles/nextflu-private/h3n2/ha/auspice_config.json" vaccines: "config/h3n2/vaccine.json" enable_titer_models: true diff --git a/profiles/nextflu-private.yaml b/profiles/nextflu-private.yaml index 24add506..b9bc2436 100644 --- a/profiles/nextflu-private.yaml +++ b/profiles/nextflu-private.yaml @@ -32,7 +32,7 @@ builds: tree_exclude_sites: "config/h1n1pdm/{segment}/exclude-sites.txt" clades: "config/h1n1pdm/ha/clades.tsv" subclades: "config/h1n1pdm/{segment}/subclades.tsv" - emerging_subclades: "config/h1n1pdm/{segment}/emerging_subclades.tsv" + proposed_subclades: "config/h1n1pdm/{segment}/proposed_subclades.tsv" auspice_config: "profiles/nextflu-private/h1n1pdm/{segment}/auspice_config.json" min_date: "2Y" reference_min_date: "6Y" @@ -81,7 +81,7 @@ builds: tree_exclude_sites: "config/h3n2/{segment}/exclude-sites.txt" clades: "config/h3n2/ha/clades.tsv" subclades: "config/h3n2/{segment}/subclades.tsv" - emerging_subclades: "config/h3n2/{segment}/emerging_subclades.tsv" + proposed_subclades: "config/h3n2/{segment}/proposed_subclades.tsv" auspice_config: "profiles/nextflu-private/h3n2/{segment}/auspice_config.json" vaccines: "config/h3n2/vaccine.json" enable_glycosylation: true @@ -127,7 +127,7 @@ builds: tree_exclude_sites: "config/vic/{segment}/exclude-sites.txt" clades: "profiles/nextflu-private/vic/ha/clades.tsv" subclades: "config/vic/{segment}/subclades.tsv" - emerging_subclades: "config/vic/{segment}/emerging_subclades.tsv" + proposed_subclades: "config/vic/{segment}/proposed_subclades.tsv" auspice_config: "profiles/nextflu-private/vic/{segment}/auspice_config.json" min_date: "2Y" reference_min_date: "6Y" diff --git a/profiles/nextflu-private/antigenic_distances.smk b/profiles/nextflu-private/antigenic_distances.smk index 449bc100..285b9974 100644 --- a/profiles/nextflu-private/antigenic_distances.smk +++ b/profiles/nextflu-private/antigenic_distances.smk @@ -29,8 +29,8 @@ rule plot_antigenic_distances_between_strains: params: min_test_date=2024.0833, title=get_titer_collection_title, - clade_color_field="subclade_test", - auspice_config_color_field="subclade", + clade_color_field="proposed_subclade_test", + auspice_config_color_field="proposed_subclade", conda: "../../workflow/envs/nextstrain.yaml" shell: """ diff --git a/profiles/nextflu-private/h1n1pdm/ha/auspice_config.json b/profiles/nextflu-private/h1n1pdm/ha/auspice_config.json index b96ec28c..0b981595 100644 --- a/profiles/nextflu-private/h1n1pdm/ha/auspice_config.json +++ b/profiles/nextflu-private/h1n1pdm/ha/auspice_config.json @@ -73,121 +73,85 @@ "scale": [ [ "C.1", - "#492AB5" + "#3F52CD" ], [ "C.1.1", - "#3F4CCB" - ], - [ - "C.1.2", - "#4271CE" - ], - [ - "C.1.5", - "#4C8FC0" - ], - [ - "C.1.7", - "#5AA5A8" - ], - [ - "C.1.7.1", - "#6DB38A" - ], - [ - "C.1.7.2", - "#85BA6F" + "#4681CA" ], [ "C.1.8", - "#A0BE59" + "#57A1AD" ], [ "C.1.9", - "#BBBC49" + "#70B487" ], [ "D", - "#D2B340" + "#90BC65" ], [ "D.1", - "#E19F3A" + "#B4BD4C" ], [ "D.2", - "#E68033" + "#D3B240" ], [ "D.3", - "#E2562B" + "#E59638" ], [ "D.4", - "#DB2823" + "#E4642E" ] ] }, { - "key": "emerging_subclade", - "title": "Emerging subclade", + "key": "proposed_subclade", + "title": "Proposed subclade", "type": "categorical", "scale": [ [ "C.1", - "#492AB5" + "#3F52CD" ], [ "C.1.1", - "#3F4CCB" - ], - [ - "C.1.2", - "#4271CE" - ], - [ - "C.1.5", - "#4C8FC0" - ], - [ - "C.1.7", - "#5AA5A8" - ], - [ - "C.1.7.1", - "#6DB38A" - ], - [ - "C.1.7.2", - "#85BA6F" + "#4681CA" ], [ "C.1.8", - "#A0BE59" + "#57A1AD" ], [ "C.1.9", - "#BBBC49" + "#70B487" ], [ "D", - "#D2B340" + "#90BC65" ], [ "D.1", - "#E19F3A" + "#B4BD4C" ], [ "D.2", - "#E68033" + "#D3B240" ], [ "D.3", - "#E2562B" + "#E59638" ], [ "D.4", + "#E4642E" + ], + [ + "D.5", "#DB2823" ] ] @@ -435,7 +399,7 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "subclade", + "color_by": "proposed_subclade", "branch_label": "Subclade" }, "filters": [ diff --git a/profiles/nextflu-private/h1n1pdm/na/auspice_config.json b/profiles/nextflu-private/h1n1pdm/na/auspice_config.json index 15a404a4..bae95c2c 100644 --- a/profiles/nextflu-private/h1n1pdm/na/auspice_config.json +++ b/profiles/nextflu-private/h1n1pdm/na/auspice_config.json @@ -71,41 +71,36 @@ "title": "Subclade", "type": "categorical", "scale": [ - [ - "C", - "#3E5DD0" - ], - [ - "C.3", - "#4A8CC2" - ], [ "C.4", - "#60AA9E" - ], - [ - "C.5.1.1", - "#80B974" - ], - [ - "C.5.2", - "#A6BE55" + "#4E94BD" ], [ "C.5.3", - "#CBB742" + "#81BA72" ], [ "C.5.3.1", - "#E29D39" + "#C8B944" + ] + ] + }, + { + "key": "proposed_subclade", + "title": "Proposed subclade", + "type": "categorical", + "scale": [ + [ + "C.4", + "#4E94BD" ], [ - "C.5.3.2", - "#E56A2F" + "C.5.3", + "#81BA72" ], [ - "C.5.3.3", - "#DB2823" + "C.5.3.1", + "#C8B944" ] ] }, @@ -182,7 +177,7 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "subclade", + "color_by": "proposed_subclade", "branch_label": "Subclade" }, "filters": [ diff --git a/profiles/nextflu-private/h3n2/ha/auspice_config.json b/profiles/nextflu-private/h3n2/ha/auspice_config.json index d7a7af03..e4aecfdd 100644 --- a/profiles/nextflu-private/h3n2/ha/auspice_config.json +++ b/profiles/nextflu-private/h3n2/ha/auspice_config.json @@ -142,8 +142,8 @@ ] }, { - "key": "emerging_subclade", - "title": "Emerging subclade", + "key": "proposed_subclade", + "title": "Proposed subclade", "type": "categorical", "scale": [ [ @@ -563,7 +563,7 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "subclade", + "color_by": "proposed_subclade", "branch_label": "Subclade" }, "filters": [ diff --git a/profiles/nextflu-private/h3n2/na/auspice_config.json b/profiles/nextflu-private/h3n2/na/auspice_config.json index 32692d1c..e74706a1 100644 --- a/profiles/nextflu-private/h3n2/na/auspice_config.json +++ b/profiles/nextflu-private/h3n2/na/auspice_config.json @@ -133,6 +133,29 @@ ] ] }, + { + "key": "proposed_subclade", + "title": "Proposed subclade", + "type": "categorical", + "scale": [ + [ + "B.4", + "#4A8CC2" + ], + [ + "B.4.1", + "#71B486" + ], + [ + "B.4.2", + "#ABBD52" + ], + [ + "B.4.3", + "#DEA73C" + ] + ] + }, { "key": "lbi", "title": "Local branching index", @@ -216,7 +239,7 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "subclade", + "color_by": "proposed_subclade", "branch_label": "Subclade" }, "filters": [ diff --git a/profiles/nextflu-private/report.smk b/profiles/nextflu-private/report.smk index 9f8bc5d8..4862b5fc 100644 --- a/profiles/nextflu-private/report.smk +++ b/profiles/nextflu-private/report.smk @@ -102,12 +102,16 @@ rule get_derived_haplotypes: conda: "../../workflow/envs/nextstrain.yaml" params: genes=["HA1"], + clade_column="proposedSubclade", + mutations_column="founderMuts['proposedSubclade'].aaSubstitutions", shell: """ python3 scripts/add_derived_haplotypes.py \ --nextclade {input.nextclade} \ --genes {params.genes:q} \ --strip-genes \ + --clade-column {params.clade_column:q} \ + --mutations-column {params.mutations_column:q} \ --output {output.haplotypes} """ diff --git a/profiles/nextflu-private/vic/ha/auspice_config.json b/profiles/nextflu-private/vic/ha/auspice_config.json index b123d215..1658a290 100644 --- a/profiles/nextflu-private/vic/ha/auspice_config.json +++ b/profiles/nextflu-private/vic/ha/auspice_config.json @@ -80,8 +80,8 @@ ] }, { - "key": "emerging_subclade", - "title": "Emerging subclade", + "key": "proposed_subclade", + "title": "Proposed subclade", "type": "categorical", "scale": [ [ @@ -277,7 +277,7 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "subclade", + "color_by": "proposed_subclade", "branch_label": "Subclade" }, "filters": [ diff --git a/profiles/nextflu-private/vic/na/auspice_config.json b/profiles/nextflu-private/vic/na/auspice_config.json index 331c3be7..394b34e2 100644 --- a/profiles/nextflu-private/vic/na/auspice_config.json +++ b/profiles/nextflu-private/vic/na/auspice_config.json @@ -51,35 +51,70 @@ "scale": [ [ "B", - "#3E5DD0" + "#4068CF" ], [ "B.3", - "#4A8CC2" + "#5098B9" ], [ "B.5", - "#60AA9E" + "#6CB28C" ], [ - "B.6", - "#80B974" + "B.7", + "#94BD62" + ], + [ + "B.7.1", + "#BFBB47" + ], + [ + "B.7.2", + "#DFA53B" + ], + [ + "B.7.3", + "#E67131" + ], + [ + "B.8", + "#DB2823" + ] + ] + }, + { + "key": "proposed_subclade", + "title": "Proposed subclade", + "type": "categorical", + "scale": [ + [ + "B", + "#4068CF" + ], + [ + "B.3", + "#5098B9" + ], + [ + "B.5", + "#6CB28C" ], [ "B.7", - "#A6BE55" + "#94BD62" ], [ "B.7.1", - "#CBB742" + "#BFBB47" ], [ "B.7.2", - "#E29D39" + "#DFA53B" ], [ "B.7.3", - "#E56A2F" + "#E67131" ], [ "B.8", @@ -160,7 +195,7 @@ ], "display_defaults": { "map_triplicate": true, - "color_by": "subclade", + "color_by": "proposed_subclade", "branch_label": "Subclade" }, "filters": [ diff --git a/profiles/nextstrain-public.yaml b/profiles/nextstrain-public.yaml index 9f6a92f4..5e74632b 100644 --- a/profiles/nextstrain-public.yaml +++ b/profiles/nextstrain-public.yaml @@ -41,6 +41,7 @@ array-builds: tree_exclude_sites: "config/{lineage}/{{segment}}/exclude-sites.txt" clades: "config/{lineage}/ha/clades.tsv" subclades: "config/{lineage}/{{segment}}/subclades.tsv" + proposed_subclades: "config/{lineage}/{{segment}}/proposed_subclades.tsv" auspice_config: "config/{lineage}/auspice_config.json" vaccines: "config/{lineage}/vaccine.json" enable_glycosylation: true @@ -80,6 +81,7 @@ array-builds: tree_exclude_sites: "config/{lineage}/{{segment}}/exclude-sites.txt" clades: "config/{lineage}/ha/clades.tsv" subclades: "config/{lineage}/{{segment}}/subclades.tsv" + proposed_subclades: "config/{lineage}/{{segment}}/proposed_subclades.tsv" auspice_config: "config/{lineage}/{{segment}}/auspice_config.json" vaccines: "config/{lineage}/vaccine.json" enable_glycosylation: true @@ -151,6 +153,7 @@ array-builds: tree_exclude_sites: "config/{lineage}/{{segment}}/exclude-sites.txt" clades: "config/{lineage}/ha/clades.tsv" subclades: "config/{lineage}/{{segment}}/subclades.tsv" + proposed_subclades: "config/{lineage}/{{segment}}/proposed_subclades.tsv" auspice_config: "config/{lineage}/auspice_config.json" vaccines: "config/{lineage}/vaccine.json" enable_glycosylation: true @@ -181,7 +184,7 @@ array-builds: tree_exclude_sites: "config/{lineage}/{{segment}}/exclude-sites.txt" clades: "config/{lineage}/ha/clades.tsv" subclades: "config/{lineage}/{{segment}}/subclades.tsv" - emerging_subclades: "config/h3n2/{{segment}}/emerging_subclades.tsv" + proposed_subclades: "config/{lineage}/{{segment}}/proposed_subclades.tsv" auspice_config: "config/{lineage}/{{segment}}/auspice_config.json" vaccines: "config/{lineage}/vaccine.json" enable_glycosylation: true diff --git a/scripts/count_recent_tips_by_clade.py b/scripts/count_recent_tips_by_clade.py index a4b09a81..1994b9e8 100644 --- a/scripts/count_recent_tips_by_clade.py +++ b/scripts/count_recent_tips_by_clade.py @@ -31,7 +31,7 @@ clades = pd.read_csv( args.clades, sep="\t", - usecols=["seqName", "subclade"], + usecols=["seqName", "proposedSubclade"], ) @@ -40,11 +40,11 @@ count_by_clade = clades[ (clades["seqName"].isin(recent_tips)) ].groupby( - "subclade" + "proposedSubclade" )["seqName"].count().reset_index( name="count" ).rename( - columns={"subclade": "clade"}, + columns={"proposedSubclade": "clade"}, ) count_by_clade["count"] = count_by_clade["count"].astype(int) diff --git a/scripts/forecast_frequencies_to_table.py b/scripts/forecast_frequencies_to_table.py index 26e54373..27b3d7eb 100644 --- a/scripts/forecast_frequencies_to_table.py +++ b/scripts/forecast_frequencies_to_table.py @@ -12,7 +12,7 @@ def annotate_clades_for_tree(tree): # Track all clade memberships in a new attribute to properly handle nested # clades. for node in tree.find_clades(): - node.node_attrs["clades"] = set([node.node_attrs["emerging_subclade"]["value"]]) + node.node_attrs["clades"] = set([node.node_attrs["proposed_subclade"]["value"]]) if node.parent is not None: node.node_attrs["clades"].update(node.parent.node_attrs["clades"]) @@ -54,7 +54,7 @@ def annotate_clades_for_tree(tree): # Zoom into the root clade of the tree. if args.root_clade is not None: for node in tree.find_clades(terminal=False): - if node.node_attrs["emerging_subclade"]["value"] == args.root_clade: + if node.node_attrs["proposed_subclade"]["value"] == args.root_clade: tree = node print(f"Zoom into {args.root_clade} at node {node.name}") break diff --git a/scripts/get_antigenic_distances_between_strains.py b/scripts/get_antigenic_distances_between_strains.py index 14eac093..c5159b24 100644 --- a/scripts/get_antigenic_distances_between_strains.py +++ b/scripts/get_antigenic_distances_between_strains.py @@ -13,6 +13,7 @@ parser.add_argument("--tree", required=True, help="tree used to identify the given clades") parser.add_argument("--clades", required=True, help="clade annotations in a node data JSON") parser.add_argument("--subclades", required=True, help="subclade annotations in a node data JSON") + parser.add_argument("--proposed-subclades", required=True, help="proposed subclade annotations in a node data JSON") parser.add_argument("--haplotypes", required=True, help="haplotype annotations in a node data JSON") parser.add_argument("--branch-lengths", required=True, help="branch length annotations including `numdate` calculated by TreeTime") parser.add_argument("--frequencies", required=True, help="tip frequencies JSON from augur frequencies") @@ -116,6 +117,7 @@ node_data = read_node_data([ args.clades, args.subclades, + args.proposed_subclades, args.haplotypes, ]) @@ -141,6 +143,7 @@ "strain": strain, "clade": strain_data["clade_membership"], "subclade": strain_data["subclade"], + "proposed_subclade": strain_data["proposed_subclade"], "haplotype": strain_data["haplotype"], "clade_frequency": frequency_by_clade[strain_data["clade_membership"]], } diff --git a/workflow/snakemake_rules/core.smk b/workflow/snakemake_rules/core.smk index 37bec68d..92299cac 100644 --- a/workflow/snakemake_rules/core.smk +++ b/workflow/snakemake_rules/core.smk @@ -420,32 +420,32 @@ rule import_clades: --output {output.node_data} 2>&1 | tee {log} """ -rule download_emerging_subclades: +rule download_proposed_subclades: output: - subclades="config/{lineage}/{segment}/emerging_subclades.tsv", + subclades="config/{lineage}/{segment}/proposed_subclades.tsv", conda: "../envs/nextstrain.yaml" params: - url=lambda wildcards: emerging_subclade_url_by_lineage_and_segment.get(wildcards.lineage, {}).get(wildcards.segment), + url=lambda wildcards: proposed_subclade_url_by_lineage_and_segment.get(wildcards.lineage, {}).get(wildcards.segment), shell: """ curl -o {output.subclades} "{params.url}" """ -rule emerging_subclades: +rule proposed_subclades: input: tree = build_dir + "/{build_name}/{segment}/tree.nwk", muts = build_dir + "/{build_name}/{segment}/muts.json", - clades = lambda wildcards: config["builds"][wildcards.build_name].get("emerging_subclades"), + clades = lambda wildcards: config["builds"][wildcards.build_name].get("proposed_subclades"), output: - node_data = build_dir + "/{build_name}/{segment}/emerging_subclades.json", + node_data = build_dir + "/{build_name}/{segment}/proposed_subclades.json", params: - membership_name = "emerging_subclade", - label_name = "Emerging subclade", + membership_name = "proposed_subclade", + label_name = "proposed_subclade", conda: "../envs/nextstrain.yaml" benchmark: - "benchmarks/emerging_subclades_{build_name}_{segment}.txt" + "benchmarks/proposed_subclades_{build_name}_{segment}.txt" log: - "logs/emerging_subclades_{build_name}_{segment}.txt" + "logs/proposed_subclades_{build_name}_{segment}.txt" shell: """ augur clades \ diff --git a/workflow/snakemake_rules/export.smk b/workflow/snakemake_rules/export.smk index 08337bfc..6c148225 100644 --- a/workflow/snakemake_rules/export.smk +++ b/workflow/snakemake_rules/export.smk @@ -23,8 +23,8 @@ def _get_node_data_by_wildcards(wildcards): if config["builds"][wildcards.build_name].get('subclades', False): inputs.append(rules.subclades.output.node_data) - if config["builds"][wildcards.build_name].get('emerging_subclades', False): - inputs.append(rules.emerging_subclades.output.node_data) + if config["builds"][wildcards.build_name].get('proposed_subclades', False): + inputs.append(rules.proposed_subclades.output.node_data) if config["builds"][wildcards.build_name].get('enable_titer_models', False) and wildcards.segment == 'ha': for collection in config["builds"][wildcards.build_name]["titer_collections"]: diff --git a/workflow/snakemake_rules/titer_models.smk b/workflow/snakemake_rules/titer_models.smk index 9b32435e..8ea0127c 100644 --- a/workflow/snakemake_rules/titer_models.smk +++ b/workflow/snakemake_rules/titer_models.smk @@ -79,6 +79,7 @@ rule antigenic_distances_between_strains: tree="builds/{build_name}/{segment}/tree.nwk", clades="builds/{build_name}/{segment}/clades.json", subclades="builds/{build_name}/{segment}/subclades.json", + proposed_subclades="builds/{build_name}/{segment}/proposed_subclades.json", haplotypes="builds/{build_name}/{segment}/haplotypes.json", titer_model="builds/{build_name}/{segment}/titers-sub-model/{titer_collection}.json", titers="builds/{build_name}/titers/{titer_collection}.tsv", @@ -99,6 +100,7 @@ rule antigenic_distances_between_strains: --tree {input.tree} \ --clades {input.clades} \ --subclades {input.subclades} \ + --proposed-subclades {input.proposed_subclades} \ --haplotypes {input.haplotypes} \ --titer-model {input.titer_model} \ --titers {input.titers} \ @@ -120,7 +122,7 @@ rule generate_collection_config_json: "reference_strain", "reference_strain_source", "clade_reference", - "subclade_reference", + "proposed_subclade_reference", "haplotype_reference", "source", "serum" @@ -137,8 +139,8 @@ rule generate_collection_config_json: "reference_date", "clade_test", "clade_reference", - "subclade_test", - "subclade_reference", + "proposed_subclade_test", + "proposed_subclade_reference", "haplotype_test", "haplotype_reference", ], @@ -180,7 +182,7 @@ rule export_measurements: "reference_strain", "reference_strain_source", "clade_reference", - "subclade_reference", + "proposed_subclade_reference", "haplotype_reference", "source", "serum" @@ -197,8 +199,8 @@ rule export_measurements: "reference_date", "clade_test", "clade_reference", - "subclade_test", - "subclade_reference", + "proposed_subclade_test", + "proposed_subclade_reference", "haplotype_test", "haplotype_reference", ],