From 0bd64d3c52d52f538160a9713e50efc2260d5f6d Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Wed, 20 Nov 2024 16:21:06 -0800 Subject: [PATCH] phylogenetic: Add config option `ancestral_root_seq` Allow users to define an optional `--root-sequence` for `augur ancestral`. This commit only adds the new config option to the CI config. It is not used in the default Nextstrain builds because it's not clear whether it's needed. --- phylogenetic/build-configs/ci/config.yaml | 1 + phylogenetic/rules/annotate_phylogeny.smk | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/phylogenetic/build-configs/ci/config.yaml b/phylogenetic/build-configs/ci/config.yaml index f58e32f..1bfdef7 100644 --- a/phylogenetic/build-configs/ci/config.yaml +++ b/phylogenetic/build-configs/ci/config.yaml @@ -2,6 +2,7 @@ custom_rules: - build-configs/ci/copy_example_data.smk reference: "defaults/reference.fasta" +ancestral_root_seq: "defaults/reference.fasta" genome_annotation: "defaults/genome_annotation.gff3" genbank_reference: "defaults/reference.gb" include: "defaults/hmpxv1/include.txt" diff --git a/phylogenetic/rules/annotate_phylogeny.smk b/phylogenetic/rules/annotate_phylogeny.smk index 9dea6a3..ccb2414 100644 --- a/phylogenetic/rules/annotate_phylogeny.smk +++ b/phylogenetic/rules/annotate_phylogeny.smk @@ -31,13 +31,19 @@ rule ancestral: node_data=build_dir + "/{build_name}/nt_muts.json", params: inference="joint", + root_sequence=lambda w: ( + f"--root-sequence {config['ancestral_root_seq']!r}" + if config.get("ancestral_root_seq") + else "" + ), shell: """ augur ancestral \ --tree {input.tree} \ --alignment {input.alignment} \ --output-node-data {output.node_data} \ - --inference {params.inference} + --inference {params.inference} \ + {params.root_sequence} """