From e51c7428b8f3344c97fb21ce8ae9088836ae96a5 Mon Sep 17 00:00:00 2001 From: David Laehnemann Date: Mon, 17 May 2021 13:42:44 +0200 Subject: [PATCH] plot-bootstrap.R: fix script to handle an empty genes of interest list in config.yaml (#44) * plot-bootstrap.R: fix script to handle an empty genes of interest list in config.yaml * add missing parenthesis --- workflow/scripts/plot-bootstrap.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/workflow/scripts/plot-bootstrap.R b/workflow/scripts/plot-bootstrap.R index 573c78f0..23c0da45 100644 --- a/workflow/scripts/plot-bootstrap.R +++ b/workflow/scripts/plot-bootstrap.R @@ -18,8 +18,14 @@ top_genes <- results %>% drop_na() %>% distinct(ext_gene) -genes_of_interest <- tibble( ext_gene = snakemake@params[["genes"]]) %>% + +if ( !is.null(snakemake@params[["genes"]]) ) { + genes_of_interest <- tibble( ext_gene = snakemake@params[["genes"]]) %>% distinct(ext_gene) +} else { + # "genes" is null, if the list provided in config.yaml is empty + genes_of_interest <- tibble( ext_gene = character() ) +} genes <- full_join(top_genes, genes_of_interest, by = 'ext_gene') %>% add_row(ext_gene = "Custom") %>%