Skip to content

Commit

Permalink
Include sample IDs in empty VCF template
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmig committed Apr 16, 2024
1 parent 470b61b commit 3704c2a
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions workflow/scripts/report/NV_description.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"]])

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 %>%
Expand Down Expand Up @@ -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 %>%
Expand Down Expand Up @@ -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 %>%
Expand Down

0 comments on commit 3704c2a

Please sign in to comment.