@@ -7,19 +7,34 @@ sink(log, type = "output")
77
88library(tidyverse )
99
10- # Replace "" values with NA in R filter list
11- # Snakemake passes filters like: list(ERRORS = c(""))
1210empty.to.na <- function (x ) {
1311 x [x == " " ] <- NA
1412 x
1513}
14+
15+ separate_rows_if_exist <- function (df , col , sep ) {
16+ if (col %in% colnames(df )) {
17+ separate_longer_delim(df , all_of(cols ), delim = sep )
18+ } else {
19+ df
20+ }
21+ }
22+
23+ # Replace "" values with NA in R filter list
24+ # Snakemake passes filters like: list(ERRORS = c(""))
1625filter.include <- lapply(snakemake @ params $ filter_include , empty.to.na )
1726filter.exclude <- lapply(snakemake @ params $ filter_exclude , empty.to.na )
1827
1928# Process input table
2029read_tsv(snakemake @ input $ tsv ) %> %
2130 # Separate <sep>-delimited "...[*]..." columns (e.g. ANN[*].EFFECT)
22- separate_rows(contains(" [*]" ), sep = snakemake @ params $ sep , convert = TRUE ) %> %
31+ separate_rows(
32+ contains(" [*]" ),
33+ sep = snakemake @ params $ sep ,
34+ convert = TRUE
35+ ) %> %
36+ # Separate &-delimited error column (more than one error/warning/info message per row is possible)
37+ separate_rows_if_exist(" ERRORS" , sep = snakemake @ params $ sep ) %> %
2338 # Rename "...[*]..." columns using the provided lookup via Snakemake config
2439 rename(all_of(unlist(snakemake @ params $ colnames_mapping ))) %> %
2540 # Apply dynamic filters from the Snakemake config:
0 commit comments