Skip to content

Commit

Permalink
Add frequencies panels
Browse files Browse the repository at this point in the history
  • Loading branch information
j23414 committed Dec 20, 2024
1 parent 4acba65 commit 65520e5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions phylogenetic/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ wildcard_constraints:
rule all:
input:
auspice_json = expand("auspice/dengue_{serotype}_{gene}.json", serotype=serotypes, gene=genes),
tip_frequencies_json= expand("auspice/dengue_{serotype}_{gene}_tip-frequencies.json", serotype=serotypes, gene=genes)

include: "rules/prepare_sequences.smk"
include: "rules/prepare_sequences_E.smk"
Expand Down
6 changes: 6 additions & 0 deletions phylogenetic/defaults/config_dengue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,11 @@ clades:
denv3: 'defaults/clades_genotypes.tsv'
denv4: 'defaults/clades_genotypes.tsv'

tip_frequencies:
min_date: "1980-01-01"
max_date: "6M"
narrow_bandwidth: 0.2
wide_bandwidth: 0.6

export:
description: "defaults/description.md"
35 changes: 35 additions & 0 deletions phylogenetic/rules/export.smk
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ rule prepare_auspice_config:
"region",
"author"
],
"panels": [
"tree",
"map",
"entropy",
"frequencies"
],
"metadata_columns": [
"accession",
"url"
Expand Down Expand Up @@ -179,3 +185,32 @@ rule final_strain_name:
--display-strain-name {params.display_strain_field} \
--output {output.auspice_json}
"""

rule tip_frequencies:
"""
Estimating KDE frequencies for tips
"""
input:
tree = "results/{gene}/tree_{serotype}.nwk",
metadata = "data/metadata_{serotype}.tsv",
output:
tip_freq = "auspice/dengue_{serotype}_{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 65520e5

Please sign in to comment.