diff --git a/workflow/rules/common.smk b/workflow/rules/common.smk index f4ca591..26cadc2 100644 --- a/workflow/rules/common.smk +++ b/workflow/rules/common.smk @@ -29,7 +29,7 @@ def get_repo_version(base_dir: str, default: str, warn=False) -> str: """ try: last_tag_description = subprocess.check_output( - f"git --git-dir={base_dir}/.git describe --always", + f"git --git-dir={base_dir}/.git describe --tags --always", shell=True, stderr=subprocess.DEVNULL ).strip().decode("utf-8") diff --git a/workflow/rules/context.smk b/workflow/rules/context.smk index 9f8fa05..a6c5c9f 100644 --- a/workflow/rules/context.smk +++ b/workflow/rules/context.smk @@ -28,6 +28,7 @@ rule download_context: duplicate_accids = OUTDIR/"context"/"duplicate_accession_ids.txt" log: LOGDIR / "download_context" / "log.txt" + retries: 2 script: "../scripts/download_context.R" diff --git a/workflow/scripts/format_vcf_fields_longer.R b/workflow/scripts/format_vcf_fields_longer.R index a1584f3..135a300 100644 --- a/workflow/scripts/format_vcf_fields_longer.R +++ b/workflow/scripts/format_vcf_fields_longer.R @@ -45,6 +45,9 @@ read_tsv( # Rename "...[*]..." columns using the provided lookup via Snakemake config rename(all_of(unlist(snakemake@params$colnames_mapping))) %>% + # Ensure missing values are properly encoded + mutate(across(where(is.character), ~ na_if(.x, "NA"))) %>% + # Separate &-delimited error column (more than one error/warning/info message per row is possible) mutate(split_errors = strsplit(ERRORS, "&")) %>% # Keep rows with none of the excluded ERRORS terms, if any diff --git a/workflow/scripts/report/pairwise_trajectory_correlation_data.R b/workflow/scripts/report/pairwise_trajectory_correlation_data.R index dc51c85..8ca4cf1 100644 --- a/workflow/scripts/report/pairwise_trajectory_correlation_data.R +++ b/workflow/scripts/report/pairwise_trajectory_correlation_data.R @@ -25,7 +25,7 @@ date_order <- read_csv(snakemake@input[["metadata"]]) %>% log_info("Formatting variants") all_variants_wider <- variants %>% - select(SAMPLE, VARIANT_NAME, ALT_FREQ) %>% + distinct(SAMPLE, VARIANT_NAME, ALT_FREQ) %>% pivot_wider( names_from = VARIANT_NAME, values_from = ALT_FREQ