Skip to content

Commit 69bd417

Browse files
authored
Merge pull request #17 from nextstrain/fix-clock-rate
phylo: Add fixed clock rate for default builds
2 parents 2b93302 + 9059c59 commit 69bd417

File tree

8 files changed

+57
-148
lines changed

8 files changed

+57
-148
lines changed

.github/ci.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/fetch-and-ingest.yaml

Lines changed: 0 additions & 85 deletions
This file was deleted.

.github/rebuild.yaml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/phylogenetic.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ on:
2525
description: 'Specific container image to use for phylogenetic workflow (will override the default of "nextstrain build")'
2626
required: false
2727
type: string
28+
trial_name:
29+
description: |
30+
Trial name for deploying builds.
31+
If not set, builds will overwrite existing builds at s3://nextstrain-data/hmpv*
32+
If set, builds will be deployed to s3://nextstrain-staging/hmpv_trials_<trial_name>_*
33+
required: false
34+
type: string
2835

2936
jobs:
3037
check-new-data:
@@ -90,11 +97,19 @@ jobs:
9097
runtime: docker
9198
env: |
9299
NEXTSTRAIN_DOCKER_IMAGE: ${{ inputs.image }}
100+
TRIAL_NAME: ${{ inputs.trial_name }}
93101
run: |
102+
declare -a config
103+
104+
if [[ "$TRIAL_NAME" ]]; then
105+
config+=("deploy_url=s3://nextstrain-staging/hmpv_trials_${TRIAL_NAME}_")
106+
fi
107+
94108
nextstrain build \
95109
phylogenetic \
96110
deploy \
97-
--configfile defaults/config.yaml
111+
--configfile defaults/config.yaml \
112+
--config "${config[@]}"
98113
# Specifying artifact name to differentiate ingest build outputs from
99114
# the phylogenetic build outputs
100115
artifact-name: phylogenetic-build-output

phylogenetic/defaults/config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,29 @@ filter:
3838
all: 'subtypes'
3939

4040
files:
41+
exclude: "defaults/exclude.txt"
4142
color_schemes: "defaults/colors.tsv"
4243
auspice_config: "defaults/auspice_config.json"
4344

4445
refine:
4546
coalescent: "opt"
4647
date_inference: "marginal"
4748
clock_filter_iqd: 4
49+
# Estimated clock rates from successful hmpv/a builds as of 2025-11-05:
50+
# https://nextstrain.org/hmpv/a/genome@2025-11-05?l=clock
51+
clock_rate:
52+
a:
53+
genome: 0.000833
54+
G: 0.00278
55+
F: 0.000763
56+
b:
57+
genome: 0.000833
58+
G: 0.00278
59+
F: 0.000763
60+
all:
61+
genome: 0.000833
62+
G: 0.00278
63+
F: 0.000763
4864

4965
ancestral:
5066
inference: "joint"

phylogenetic/defaults/exclude.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PP_0049YFJ # This was causing all tree to not be rooted properly
2+
PP_0049ZYG # This was causing all tree to not be rooted properly

phylogenetic/rules/construct_phylogeny.smk

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ rule tree:
3131
--output {output.tree}
3232
"""
3333

34+
def _clock_rate_params(wildcards):
35+
"""
36+
Generate the clock rate parameters for augur refine based on
37+
wildcard subtype and build values are in the config file
38+
"""
39+
clock_rate = (config['refine']
40+
.get('clock_rate', {})
41+
.get(wildcards.subtype, {})
42+
.get(wildcards.build, None))
43+
44+
if clock_rate is not None:
45+
return f'--clock-rate {clock_rate!r}'
46+
else:
47+
return ""
48+
49+
3450
rule refine:
3551
"""
3652
Refining tree
@@ -50,6 +66,7 @@ rule refine:
5066
coalescent = config["refine"]["coalescent"],
5167
date_inference = config["refine"]["date_inference"],
5268
clock_filter_iqd = config["refine"]["clock_filter_iqd"],
69+
clock_rate = _clock_rate_params,
5370
strain_id = config.get("strain_id_field", "strain"),
5471

5572
shell:
@@ -65,5 +82,6 @@ rule refine:
6582
--coalescent {params.coalescent} \
6683
--date-confidence \
6784
--date-inference {params.date_inference} \
85+
{params.clock_rate} \
6886
--clock-filter-iqd {params.clock_filter_iqd}
69-
"""
87+
"""

phylogenetic/rules/prepare_sequences.smk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ rule filter:
5252
"""
5353
input:
5454
sequences = "data/sequences.fasta",
55-
metadata = "data/metadata.tsv"
55+
metadata = "data/metadata.tsv",
56+
exclude = config["files"]["exclude"],
5657
output:
5758
sequences = "results/{subtype}/{build}/filtered.fasta",
5859
metadata = "results/{subtype}/{build}/metadata.tsv",
@@ -76,7 +77,8 @@ rule filter:
7677
--output-metadata {output.metadata} \
7778
--group-by {params.group_by} \
7879
--subsample-max-sequences {params.subsample_max_sequences} \
79-
--min-date {params.min_date}
80+
--min-date {params.min_date} \
81+
--exclude {input.exclude}
8082
"""
8183

8284
rule align:

0 commit comments

Comments
 (0)