From f40db2f0d57d4dbb664ba914882e4aa4928e28c8 Mon Sep 17 00:00:00 2001 From: james hadfield Date: Mon, 21 Oct 2024 11:03:29 +1300 Subject: [PATCH] [cattle-flu] show timetree for genome build Resolves #94 --- Snakefile | 24 ++++++++++++++++++- .../auspice_config_h5n1-cattle-outbreak.json | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Snakefile b/Snakefile index bcc91af..63e4e60 100755 --- a/Snakefile +++ b/Snakefile @@ -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 @@ -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" diff --git a/config/h5n1-cattle-outbreak/auspice_config_h5n1-cattle-outbreak.json b/config/h5n1-cattle-outbreak/auspice_config_h5n1-cattle-outbreak.json index 7a1d362..09ac49e 100755 --- a/config/h5n1-cattle-outbreak/auspice_config_h5n1-cattle-outbreak.json +++ b/config/h5n1-cattle-outbreak/auspice_config_h5n1-cattle-outbreak.json @@ -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",