Skip to content

Commit

Permalink
Add frequencies panel [#2]
Browse files Browse the repository at this point in the history
This is _largely_ copy-pasta-ed from the `measles` repo; the one
significant change is I enabled the frequencies on both the whole
genome and prM-E builds, and I set the `min_date` param to
`2017-01-01`, because virtually all of the post-1927 samples are dated
2017 and later.
  • Loading branch information
genehack committed Nov 21, 2024
1 parent e953108 commit 8bef86e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions phylogenetic/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ gene = ["genome", "prM-E"]
rule all:
input:
auspice_json=expand("auspice/yellow-fever-virus_{gene}.json", gene=gene),
tip_frequencies_json=expand("auspice/yellow-fever-virus_{gene}_tip-frequencies.json", gene=gene),


include: "rules/prepare_sequences.smk"
Expand Down
6 changes: 6 additions & 0 deletions phylogenetic/defaults/auspice_config_genome.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
"author",
"host"
],
"panels": [
"tree",
"map",
"entropy",
"frequencies"
],
"metadata_columns": [
"author"
]
Expand Down
6 changes: 6 additions & 0 deletions phylogenetic/defaults/auspice_config_prM-E.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
"author",
"host"
],
"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 @@ -33,5 +33,10 @@ ancestral:
inference: "joint"
traits:
columns: "clade region"
tip_frequencies:
min_date: "2017-01-01"
max_date: "6M"
narrow_bandwidth: 0.2
wide_bandwidth: 0.6
export:
metadata_columns: "clade region"
30 changes: 30 additions & 0 deletions phylogenetic/rules/export.smk
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,33 @@ rule export:
--description {input.description:q} \
2> {log:q}
"""


rule tip_frequencies:
"""
Estimating KDE frequencies for tips
"""
input:
tree = "results/{gene}/tree.nwk",
metadata = "data/metadata.tsv"
output:
tip_freq = "auspice/yellow-fever-virus_{gene}_tip-frequencies.json"
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"]
shell:
r"""
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}
"""

0 comments on commit 8bef86e

Please sign in to comment.