Skip to content

Commit

Permalink
Merge pull request #42 from nextstrain/frequencies
Browse files Browse the repository at this point in the history
Include frequencies for N450 build
  • Loading branch information
trvrb authored Jul 3, 2024
2 parents 03c78bf + 3818fab commit 7f2c201
Show file tree
Hide file tree
Showing 4 changed files with 43 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 @@ -26,5 +26,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/export.smk
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,32 @@ rule export:
--output {output.auspice_json} \
--description {input.description}
"""

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 = "auspice/measles_{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}
"""

0 comments on commit 7f2c201

Please sign in to comment.