diff --git a/workflow/scripts/report/NV_description.R b/workflow/scripts/report/NV_description.R index 4d5a592..bfb6e0e 100644 --- a/workflow/scripts/report/NV_description.R +++ b/workflow/scripts/report/NV_description.R @@ -8,22 +8,6 @@ library(logger) log_threshold(INFO) -empty_vcf <- function() { - tibble( - variant = character(), - REGION = character(), - ALT_FREQ = numeric(), - GFF_FEATURE = character(), - synonimous = character(), - POS = numeric(), - ALT = character(), - NV_class = character(), - NV_colors = character(), - group = character() - ) -} - - # Import file with plots style source(snakemake@params[["design"]]) @@ -69,6 +53,18 @@ date_order <- metadata %>% pull(ID) %>% unique() +empty_vcf <- tibble( + REGION = date_order, + variant = NA, + ALT_FREQ = NA, + GFF_FEATURE = NA, + synonimous = NA, + POS = NA, + ALT = NA, + NV_class = NA, + group = NA +) + # Create SNP variable and select useful variables vcf <- vcf %>% dplyr::select( @@ -166,7 +162,7 @@ log_info("Plotting summary figure for whole genome") if (nrow(vcf) == 0) { log_warn("Whole-genome VCF has no rows") - vcf <- empty_vcf() + vcf <- empty_vcf } variants <- vcf %>% @@ -320,7 +316,7 @@ window_plot_spike <- window %>% if (nrow(vcf_spike) == 0) { log_warn("Spike VCF has no rows") - vcf_spike <- empty_vcf() + vcf_spike <- empty_vcf } variants_spike <- vcf_spike %>% @@ -389,7 +385,7 @@ figur_SNP_table <- vcf_snp %>% if (nrow(figur_SNP_table) == 0) { log_warn("Filtered SNP table has no rows") - figur_SNP_table <- empty_vcf() + figur_SNP_table <- empty_vcf } figur_SNP_time <- figur_SNP_table %>%