Skip to content

Commit

Permalink
Add subclades to measurement panel outputs
Browse files Browse the repository at this point in the history
Adds support for filtering and grouping by new subclade annotations.
  • Loading branch information
huddlej committed Aug 29, 2023
1 parent d160e5c commit fe6b6f0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions scripts/get_antigenic_distances_between_strains.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
parser.add_argument("--titers", required=True, help="raw titers table with information about the source of each titer")
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("--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")
Expand Down Expand Up @@ -114,6 +115,7 @@
# Load node data (e.g., clade and haplotype).
node_data = read_node_data([
args.clades,
args.subclades,
args.haplotypes,
])

Expand All @@ -138,6 +140,7 @@
{
"strain": strain,
"clade": strain_data["clade_membership"],
"subclade": strain_data["subclade"],
"haplotype": strain_data["haplotype"],
"clade_frequency": frequency_by_clade[strain_data["clade_membership"]],
}
Expand Down
26 changes: 24 additions & 2 deletions workflow/snakemake_rules/titer_models.smk
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ rule antigenic_distances_between_strains:
input:
tree="builds/{build_name}/{segment}/tree.nwk",
clades="builds/{build_name}/{segment}/clades.json",
subclades="builds/{build_name}/{segment}/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",
Expand All @@ -97,6 +98,7 @@ rule antigenic_distances_between_strains:
python3 scripts/get_antigenic_distances_between_strains.py \
--tree {input.tree} \
--clades {input.clades} \
--subclades {input.subclades} \
--haplotypes {input.haplotypes} \
--titer-model {input.titer_model} \
--titers {input.titers} \
Expand All @@ -114,7 +116,15 @@ rule generate_collection_config_json:
config_json="builds/{build_name}/{segment}/measurements_collection_config/{titer_collection}.json",
conda: "../envs/nextstrain.yaml"
params:
groupings=["reference_strain", "reference_strain_source", "clade_reference", "haplotype_reference", "source", "serum"],
groupings=[
"reference_strain",
"reference_strain_source",
"clade_reference",
"subclade_reference",
"haplotype_reference",
"source",
"serum"
],
fields=[
"strain",
"reference_strain",
Expand All @@ -127,6 +137,8 @@ rule generate_collection_config_json:
"reference_date",
"clade_test",
"clade_reference",
"subclade_test",
"subclade_reference",
"haplotype_test",
"haplotype_reference",
],
Expand Down Expand Up @@ -164,7 +176,15 @@ rule export_measurements:
title=get_titer_collection_title,
x_axis_label="normalized log2 titer",
thresholds=[0.0, 2.0],
filters=["reference_strain", "reference_strain_source", "clade_reference", "haplotype_reference", "source", "serum"],
filters=[
"reference_strain",
"reference_strain_source",
"clade_reference",
"subclade_reference",
"haplotype_reference",
"source",
"serum"
],
include_columns=[
"test_strain",
"reference_strain",
Expand All @@ -177,6 +197,8 @@ rule export_measurements:
"reference_date",
"clade_test",
"clade_reference",
"subclade_test",
"subclade_reference",
"haplotype_test",
"haplotype_reference",
],
Expand Down

0 comments on commit fe6b6f0

Please sign in to comment.