From c5553ef7b517655f7d01fa5f7f6fb873f79d4004 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Tue, 20 Feb 2024 16:26:14 +0100 Subject: [PATCH] Don't error if nextclade input sequences empty, necessary because of https://github.com/nextstrain/nextclade/issues/1422 --- workflow/snakemake_rules/nextclade.smk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/workflow/snakemake_rules/nextclade.smk b/workflow/snakemake_rules/nextclade.smk index 3d0bc127..c31077c0 100644 --- a/workflow/snakemake_rules/nextclade.smk +++ b/workflow/snakemake_rules/nextclade.smk @@ -187,6 +187,14 @@ rule run_wuhan_nextclade: ], shell: """ + # If there are no sequences to run Nextclade on, create empty output files + if [[ ! -s {input.sequences} ]]; then + touch {output.info} + touch {output.alignment} + touch {output.translations} + exit 0 + fi + ./{input.nextclade_path} run \ {input.sequences}\ --input-dataset={input.dataset} \ @@ -208,6 +216,12 @@ rule run_21L_nextclade: info=f"data/{database}/nextclade_21L_new_raw.tsv", shell: """ + # If there are no sequences to run Nextclade on, create empty output files + if [[ ! -s {input.sequences} ]]; then + touch {output.info} + exit 0 + fi + ./{input.nextclade_path} run \ {input.sequences} \ --input-dataset={input.dataset} \