Skip to content

Commit 036de0e

Browse files
authored
Phylogenetic: Add frequencies panel #89
2 parents 34414e5 + e3505cd commit 036de0e

File tree

10 files changed

+62
-4
lines changed

10 files changed

+62
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ We use this CHANGELOG to document breaking changes, new features, bug fixes, and
44

55
## 2025
66

7+
* 24 March 2025: Add frequencies panel @j23414
78
* 21 March 2025: Migrated WA specific config to NW-PaGe [PR#90] @j23414, @DOH-LMT2303, @DOH-PNT0303
89
* 18 March 2025: Rename "global" to "all-lineages, update various auspice_config settings @j23414
910
* 14 March 2025: Pushed from staging to live @j23414

phylogenetic/Snakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ wildcard_constraints:
2121

2222
rule all:
2323
input:
24-
auspice = expand("auspice/WNV_{build}.json", build=builds)
24+
auspice = expand("auspice/WNV_{build}.json", build=builds),
25+
tip_frequencies_json= expand("auspice/WNV_{build}_tip-frequencies.json", build=builds)
2526

2627
# These rules are imported in the order that they are expected to run.
2728
# Each Snakefile will have documented inputs and outputs that should be kept as

phylogenetic/defaults/all-lineages/auspice_config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"host_genus",
4141
"host_type"
4242
],
43+
"panels": [
44+
"tree",
45+
"map",
46+
"entropy",
47+
"frequencies"
48+
],
4349
"display_defaults": {
4450
"color_by": "lineage",
4551
"map_triplicate": true,

phylogenetic/defaults/all-lineages/reference.gb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
LOCUS AF260968 11029 bp RNA linear VRL 27-AUG-2000
1+
LOCUS AF260968_REF 11029 bp RNA linear VRL 27-AUG-2000
22
DEFINITION West Nile virus strain Eg101, complete genome.
3-
ACCESSION AF260968
3+
ACCESSION AF260968_REF
44
VERSION AF260968.1
55
KEYWORDS .
66
SOURCE West Nile virus (WNV)

phylogenetic/defaults/config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ traits:
7878
'lineage',
7979
]
8080

81+
tip_frequencies:
82+
# 2000 since there is an increase in WNV at that time
83+
min_date: "2000-01-01"
84+
max_date: "6M"
85+
# Quarterly narrow_bandwidth or every 3 months (3 /12.0 = 0.25)
86+
narrow_bandwidth: 0.25
87+
proportion_wide: 0.0
88+
8189
export:
8290
description: "defaults/description.md"
8391
auspice_config: "defaults/all-lineages/auspice_config.json"

phylogenetic/defaults/include.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AF260968 # Egypt 1951 will be used as augur align reference
1+
AF260968 # Egypt 1951 all-lineages reference
22
NC_001563 # Lineage 2 reference
33
NC_009942 # Lineage 1 reference
44
HM051416 # Isreal 1953

phylogenetic/defaults/lineage-1A/auspice_config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"host_genus",
4141
"host_type"
4242
],
43+
"panels": [
44+
"tree",
45+
"map",
46+
"entropy",
47+
"frequencies"
48+
],
4349
"display_defaults": {
4450
"color_by": "lineage",
4551
"map_triplicate": true,

phylogenetic/defaults/lineage-2/auspice_config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"host_genus",
4141
"host_type"
4242
],
43+
"panels": [
44+
"tree",
45+
"map",
46+
"entropy",
47+
"frequencies"
48+
],
4349
"display_defaults": {
4450
"color_by": "lineage",
4551
"map_triplicate": true,

phylogenetic/rules/export.smk

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,32 @@ rule export:
5454
--include-root-sequence-inline \
5555
--output {output.auspice} 2>&1 | tee {log}
5656
"""
57+
58+
rule tip_frequencies:
59+
"""
60+
Estimating KDE frequencies for tips
61+
"""
62+
input:
63+
tree = "results/{build}/tree.nwk",
64+
metadata = "results/{build}/metadata_filtered.tsv",
65+
output:
66+
tip_freq = "auspice/WNV_{build}_tip-frequencies.json"
67+
params:
68+
strain_id = config["strain_id_field"],
69+
min_date = config["tip_frequencies"]["min_date"],
70+
max_date = config["tip_frequencies"]["max_date"],
71+
narrow_bandwidth = config["tip_frequencies"]["narrow_bandwidth"],
72+
proportion_wide = config["tip_frequencies"]["proportion_wide"]
73+
shell:
74+
r"""
75+
augur frequencies \
76+
--method kde \
77+
--tree {input.tree} \
78+
--metadata {input.metadata} \
79+
--metadata-id-columns {params.strain_id} \
80+
--min-date {params.min_date} \
81+
--max-date {params.max_date} \
82+
--narrow-bandwidth {params.narrow_bandwidth} \
83+
--proportion-wide {params.proportion_wide} \
84+
--output {output.tip_freq}
85+
"""

phylogenetic/rules/prepare_sequences.smk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ rule align:
3939
--output {output.alignment} \
4040
--fill-gaps \
4141
--reference-sequence {input.reference} \
42+
--remove-reference \
4243
--nthreads {threads:q} 2>&1 | tee {log}
4344
"""

0 commit comments

Comments
 (0)