Skip to content

Commit

Permalink
Include frequencies for N450 build
Browse files Browse the repository at this point in the history
This commit produces tip-frequencies JSON files for both N450 and genome analyses, but only displays frequencies panel for N450.

Start date of 2000 and end date of –6 months were chosen based on data availability. I increased bandwidth by about 2.5x to account for data quantity relative to temporal spread (compared to the 2y flu-like defaults).
  • Loading branch information
trvrb committed Jun 28, 2024
1 parent 957fc74 commit f20d4a1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
5 changes: 3 additions & 2 deletions phylogenetic/Snakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
genes = ['N450', 'genome']

configfile: "defaults/config.yaml"
configfile: "defaults/config.yaml"

rule all:
input:
auspice_json = expand("auspice/measles_{gene}.json", gene=genes)
auspice_json = expand("auspice/measles_{gene}.json", gene=genes),
tip_frequencies_json = expand("auspice/measles_{gene}_tip-frequencies.json", gene=genes)

include: "rules/prepare_sequences.smk"
include: "rules/prepare_sequences_N450.smk"
Expand Down
6 changes: 6 additions & 0 deletions phylogenetic/defaults/auspice_config_N450.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
"country",
"author"
],
"panels": [
"tree",
"map",
"entropy",
"frequencies"
],
"metadata_columns": [
"author"
]
Expand Down
5 changes: 5 additions & 0 deletions phylogenetic/defaults/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ refine:
clock_filter_iqd: 4
ancestral:
inference: "joint"
tip_frequencies:
min_date: "2000-01-01"
max_date: "6M"
narrow_bandwidth: 0.2
wide_bandwidth: 0.6
export:
metadata_columns: "strain division location"
29 changes: 29 additions & 0 deletions phylogenetic/rules/annotate_phylogeny.smk
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,32 @@ rule translate:
--reference-sequence {input.reference} \
--output {output.node_data} \
"""

rule tip_frequencies:
"""
Estimating KDE frequencies for tips
"""
input:
tree = "results/{gene}/tree.nwk",
metadata = "data/metadata.tsv"
params:
strain_id = config["strain_id_field"],
min_date = config["tip_frequencies"]["min_date"],
max_date = config["tip_frequencies"]["max_date"],
narrow_bandwidth = config["tip_frequencies"]["narrow_bandwidth"],
wide_bandwidth = config["tip_frequencies"]["wide_bandwidth"]
output:
tip_freq = "results/{gene}/tip-frequencies.json"
shell:
"""
augur frequencies \
--method kde \
--tree {input.tree} \
--metadata {input.metadata} \
--metadata-id-columns {params.strain_id} \
--min-date {params.min_date} \
--max-date {params.max_date} \
--narrow-bandwidth {params.narrow_bandwidth} \
--wide-bandwidth {params.wide_bandwidth} \
--output {output.tip_freq}
"""
10 changes: 10 additions & 0 deletions phylogenetic/rules/export.smk
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,13 @@ rule export:
--include-root-sequence-inline \
--output {output.auspice_json}
"""

rule final_tip_frequencies:
input:
tip_freq = "results/{gene}/tip-frequencies.json",
output:
tip_freq = "auspice/measles_{gene}_tip-frequencies.json"
shell:
"""
cp -f {input.tip_freq} {output.tip_freq}
"""

0 comments on commit f20d4a1

Please sign in to comment.