Skip to content

Commit

Permalink
sf in XLSX output
Browse files Browse the repository at this point in the history
  • Loading branch information
sigven committed Jan 5, 2024
1 parent d250dbb commit 8b3927b
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 7 deletions.
33 changes: 26 additions & 7 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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']],
Expand Down
34 changes: 34 additions & 0 deletions data-raw/data-raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Binary file modified data/acmg.rda
Binary file not shown.
Binary file modified data/col_format_output.rda
Binary file not shown.

0 comments on commit 8b3927b

Please sign in to comment.