Skip to content

Commit 2d6af9e

Browse files
committed
Fill empty ANN values with NA to ensure a correct extraction
1 parent 3c97af8 commit 2d6af9e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

workflow/rules/vaf.smk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ rule extract_vcf_fields:
160160
log:
161161
LOGDIR / "tsv_to_vcf" / "{sample}.log.txt"
162162
shell:
163-
'SnpSift extractFields -s {params.sep:q} {input.vcf:q} {params.extract_columns} >{output.tsv:q} 2>{log:q}'
163+
"SnpSift extractFields -e 'NA' -s {params.sep:q} {input.vcf:q} {params.extract_columns} >{output.tsv:q} 2>{log:q}"
164164

165165

166166
rule format_vcf_fields_longer:

workflow/scripts/format_vcf_fields_longer.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ filter.exclude <- lapply(snakemake@params$filter_exclude, empty.to.na)
1919
# Process input table
2020
read_tsv(snakemake@input$tsv) %>%
2121
# Separate <sep>-delimited "...[*]..." columns (e.g. ANN[*].EFFECT)
22-
separate_longer_delim(contains("[*]"), delim = snakemake@params$sep) %>%
23-
# Replace empty ("") fields with NA
24-
mutate(across(contains("[*]"), ~ na_if(., ""))) %>%
22+
separate_rows(contains("[*]"), sep = snakemake@params$sep, convert = TRUE) %>%
2523
# Rename "...[*]..." columns using the provided lookup via Snakemake config
2624
rename(all_of(unlist(snakemake@params$colnames_mapping))) %>%
2725
# Apply dynamic filters from the Snakemake config:

0 commit comments

Comments
 (0)