diff --git a/R/main.R b/R/main.R index b52d28f..5ee6455 100644 --- a/R/main.R +++ b/R/main.R @@ -263,6 +263,8 @@ generate_cpsr_report <- function(yaml_fname = NULL) { dplyr::anti_join( cpg_calls, by = "VAR_ID" ) + cps_report[['content']][['snv_indel']][['variant_set']][['secondary']] <- + secondary_calls } secondary_call_stats <- pcgrr::variant_stats_report( @@ -380,7 +382,6 @@ write_cpsr_output <- function(report, if(file.exists(quarto_input)){ ## make temporary directory for quarto report rendering - stringi::stri_rand_strings(10, 1) tmp_quarto_dir <- file.path( output_dir, paste0('quarto_', stringi::stri_rand_strings(1, 15)) @@ -497,24 +498,42 @@ write_cpsr_output <- function(report, cols = 1:ncol(report$settings$conf$gene_panel$panel_genes), widths = "auto") - if(NROW(report$content$snv_indel$clin_eitem$all$any) > 0){ + if(NROW(report$content$snv_indel$variant_set$secondary) > 0){ workbook <- workbook |> openxlsx2::wb_add_data_table( - sheet = "BIOMARKER_EVIDENCE", + sheet = "SECONDARY_FINDINGS", x = dplyr::select( - report$content$snv_indel$clin_eitem$all$any, - cpsr::col_format_output[['xlsx_biomarker']]), + report$content$snv_indel$variant_set$secondary, + cpsr::col_format_output[['xlsx_secondary']]), start_row = 1, start_col = 1, col_names = TRUE, na.strings = "", table_style = "TableStyleMedium17") |> openxlsx2::wb_set_col_widths( - sheet = "BIOMARKER_EVIDENCE", - cols = 1:length(cpsr::col_format_output[['xlsx_biomarker']]), + sheet = "SECONDARY_FINDINGS", + cols = 1:length(cpsr::col_format_output[['xlsx_secondary']]), widths = "auto") } + if(NROW(report$content$snv_indel$clin_eitem$all$any) > 0){ + workbook <- workbook |> + openxlsx2::wb_add_data_table( + sheet = "BIOMARKER_EVIDENCE", + x = dplyr::select( + report$content$snv_indel$clin_eitem$all$any, + cpsr::col_format_output[['xlsx_biomarker']]), + start_row = 1, + start_col = 1, + col_names = TRUE, + na.strings = "", + table_style = "TableStyleMedium18") |> + openxlsx2::wb_set_col_widths( + sheet = "BIOMARKER_EVIDENCE", + cols = 1:length(cpsr::col_format_output[['xlsx_biomarker']]), + widths = "auto") + } + workbook <- workbook |> openxlsx2::wb_save( fnames[['xlsx']], diff --git a/data-raw/data-raw.R b/data-raw/data-raw.R index 9d6e951..28eab95 100644 --- a/data-raw/data-raw.R +++ b/data-raw/data-raw.R @@ -205,6 +205,40 @@ col_format_output[['xlsx_classification']] <- "gnomADe_AF" ) +## define tags/variables to display in output Excel +col_format_output[['xlsx_secondary']] <- + c("SAMPLE_ID", + "GENOMIC_CHANGE", + "GENOTYPE", + "GENOME_VERSION", + "VARIANT_CLASS", + "SYMBOL", + "GENENAME", + "CONSEQUENCE", + "PROTEIN_CHANGE", + "CLINVAR_CLASSIFICATION", + "CLINVAR_MSID", + "CLINVAR_VARIANT_ORIGIN", + "CLINVAR_CONFLICTED", + "CLINVAR_PHENOTYPE", + "CLINVAR_REVIEW_STATUS_STARS", + "ENSEMBL_GENE_ID", + "ENSEMBL_TRANSCRIPT_ID", + "REFSEQ_TRANSCRIPT_ID", + "PFAM_DOMAIN_NAME", + "HGVSp", + "HGVSc", + "CDS_CHANGE", + "CODING_STATUS", + "MUTATION_HOTSPOT", + "EFFECT_PREDICTIONS", + "LOSS_OF_FUNCTION", + "NULL_VARIANT", + "DBSNP", + "gnomADe_AF" + ) + + ## define tags/variables to display in output Excel col_format_output[['xlsx_biomarker']] <- c("SAMPLE_ID", diff --git a/data/acmg.rda b/data/acmg.rda index aad825d..b474327 100644 Binary files a/data/acmg.rda and b/data/acmg.rda differ diff --git a/data/col_format_output.rda b/data/col_format_output.rda index 7e002ac..09d0dda 100644 Binary files a/data/col_format_output.rda and b/data/col_format_output.rda differ