From 3818fabd51d2384af8637c017be9075587ab6076 Mon Sep 17 00:00:00 2001 From: Trevor Bedford Date: Fri, 28 Jun 2024 16:28:41 -0700 Subject: [PATCH] Move frequencies rule to export.smk --- phylogenetic/rules/annotate_phylogeny.smk | 29 ----------------------- phylogenetic/rules/export.smk | 25 ++++++++++++++++--- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/phylogenetic/rules/annotate_phylogeny.smk b/phylogenetic/rules/annotate_phylogeny.smk index d87627c..61e94b8 100644 --- a/phylogenetic/rules/annotate_phylogeny.smk +++ b/phylogenetic/rules/annotate_phylogeny.smk @@ -39,32 +39,3 @@ rule translate: --reference-sequence {input.reference} \ --output {output.node_data} \ """ - -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 = "results/{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} - """ diff --git a/phylogenetic/rules/export.smk b/phylogenetic/rules/export.smk index 32cef95..f6ba939 100644 --- a/phylogenetic/rules/export.smk +++ b/phylogenetic/rules/export.smk @@ -34,12 +34,31 @@ rule export: --output {output.auspice_json} """ -rule final_tip_frequencies: +rule tip_frequencies: + """ + Estimating KDE frequencies for tips + """ input: - tip_freq = "results/{gene}/tip-frequencies.json", + 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: """ - cp -f {input.tip_freq} {output.tip_freq} + 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} """