Skip to content

Commit

Permalink
Merge pull request #98 from nextstrain/james/dynamic-auspice-config
Browse files Browse the repository at this point in the history
[h5n1-cattle-outbreak] show timetree for genome build
  • Loading branch information
jameshadfield authored Oct 29, 2024
2 parents ee4f16e + f40db2f commit 0b5dcae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
24 changes: 23 additions & 1 deletion Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,28 @@ def additional_export_config(wildcards):

return args

rule auspice_config:
"""
Depending on the build we may make wildcard-dependent modifications to the auspice config JSON.
If we implement config overlays in augur this rule will become unnecessary.
"""
input:
auspice_config = files.auspice_config,
output:
auspice_config = "results/{subtype}/{segment}/{time}/auspice-config.json",
run:
import json
with open(input.auspice_config) as fh:
config = json.load(fh)
if wildcards.subtype == "h5n1-cattle-outbreak":
if wildcards.segment == "genome":
config['display_defaults']['distance_measure'] = "num_date"
else:
config['display_defaults']['distance_measure'] = "div"
with open(output.auspice_config, 'w') as fh:
json.dump(config, fh, indent=2)


rule export:
"""
Export the files into results/ and then use a subsequent rule to move these to the
Expand All @@ -529,7 +551,7 @@ rule export:
node_data = export_node_data_files,
colors = files.colors,
lat_longs = files.lat_longs,
auspice_config = files.auspice_config,
auspice_config = rules.auspice_config.output.auspice_config,
description = files.description
output:
auspice_json = "results/{subtype}/{segment}/{time}/auspice-dataset.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"map_triplicate": false,
"color_by": "host",
"geo_resolution": "division",
"distance_measure": "div"
"distance_measure": "__VALUE_OVERWRITTEN_BY_SNAKEMAKE_PIPELINE__"
},
"filters": [
"host",
Expand Down

0 comments on commit 0b5dcae

Please sign in to comment.