Skip to content

Commit

Permalink
minor bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
sigven committed Mar 12, 2024
1 parent fe7edb8 commit 3be31a6
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 27 deletions.
4 changes: 2 additions & 2 deletions R/classification.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ assign_classification <- function(var_calls) {

pcgrr::log4r_info(paste0(
"Assigning five-tier classifications (P, LP, VUS, LB, B) based on ",
"aggregated scores from ACMG criteria"))
"aggregated ACMG points"))

path_cols <- c(
"CPSR_CLASSIFICATION",
Expand Down Expand Up @@ -203,7 +203,7 @@ assign_pathogenicity_evidence <- function(var_calls, settings, ref_data) {
#pcgrr::validate_settings(settings)

pcgrr::log4r_info(
"Assigning pathogenicity codes according to enhanced ACMG criteria/guidelines")
"Assigning variant classification codes according to refined ACMG criteria")
classification_settings <-
settings$conf$variant_classification

Expand Down
46 changes: 27 additions & 19 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,53 +116,61 @@ generate_cpsr_report <- function(yaml_fname = NULL) {
callset_all <- list()
callset_all[['variant']] <-
cps_report$content$snv_indel[['callset']]$variant$all
cps_report$content$snv_indel$v_stat <-
pcgrr::variant_stats_report(
callset = callset_all,
name = "v_stat")$v_stat
if(NROW(callset_all[['variant']]) > 0){
cps_report$content$snv_indel$v_stat <-
pcgrr::variant_stats_report(
callset = callset_all,
name = "v_stat")$v_stat
}

## get overall call statistics (cpg targets only)
callset_cpg <- list()
callset_cpg[['variant']] <-
cps_report$content$snv_indel[['callset']]$variant$cpg_non_sf
cps_report$content$snv_indel$v_stat_cpg <-
pcgrr::variant_stats_report(
callset = callset_cpg,
name = "v_stat_cpg")$v_stat_cpg
if(NROW(callset_cpg[['variant']]) > 0){
cps_report$content$snv_indel$v_stat_cpg <-
pcgrr::variant_stats_report(
callset = callset_cpg,
name = "v_stat_cpg")$v_stat_cpg
}

## get overall call statistics (sf targets only)
callset_sf <- list()
callset_sf[['variant']] <-
cps_report$content$snv_indel[['callset']]$variant$sf
cps_report$content$snv_indel$v_stat_sf <-
pcgrr::variant_stats_report(
callset = callset_sf,
name = "v_stat_sf")$v_stat_sf
if(NROW(callset_sf[['variant']]) > 0){
cps_report$content$snv_indel$v_stat_sf <-
pcgrr::variant_stats_report(
callset = callset_sf,
name = "v_stat_sf")$v_stat_sf
}

callset_bm <- list()
callset_bm[['variant']] <-
cps_report$content$snv_indel[['callset']]$variant$bm
cps_report$content$snv_indel$v_stat_bm <-
pcgrr::variant_stats_report(
callset = callset_bm,
name = "v_stat_bm")$v_stat_bm
if(NROW(callset_bm[['variant']]) > 0){
cps_report$content$snv_indel$v_stat_bm <-
pcgrr::variant_stats_report(
callset = callset_bm,
name = "v_stat_bm")$v_stat_bm
}

pcgrr::log4r_info(
paste0(
"Total number of variants in target cancer predisposition genes: ",
cps_report$content$snv_indel[["v_stat_cpg"]][["n"]]
"N = ", cps_report$content$snv_indel[["v_stat_cpg"]][["n"]]
)
)
pcgrr::log4r_info(
paste0(
"Number of coding variants in target cancer predisposition genes: ",
cps_report$content$snv_indel[["v_stat_cpg"]][["n_coding"]]
"N = ", cps_report$content$snv_indel[["v_stat_cpg"]][["n_coding"]]
)
)
pcgrr::log4r_info(
paste0(
"Number of non-coding variants in cancer predisposition genes: ",
cps_report$content$snv_indel[["v_stat_cpg"]][["n_noncoding"]]
"N = ", cps_report$content$snv_indel[["v_stat_cpg"]][["n_noncoding"]]
)
)

Expand Down
6 changes: 5 additions & 1 deletion inst/templates/quarto/cpsr_biomarkers.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ for (etype in c("Predictive","Diagnostic","Predisposing","Prognostic")) {
show_germline_filters[[tolower(etype)]] <- F
missing_germline_items[[tolower(etype)]] <- T
if(NROW(cps_report[["content"]][["snv_indel"]]$callset$variant_display$bm) == 0){
next
}
etype_set[[tolower(etype)]] <-
cps_report[["content"]][["snv_indel"]]$callset$variant_display$bm |>
dplyr::filter(.data$BM_EVIDENCE_TYPE == etype)
Expand Down Expand Up @@ -49,7 +53,7 @@ The same genetic variant may match with multiple evidence items, pending on the
```{r biomarker_note}
#| echo: false
#| output: asis
#| include: !expr biomarker_present
#| include: true
cat("\n::: {.callout-note}\n Biomarkers registered in CIViC/CGI are provided at different _resolutions_ (i.e. filter <b>Biomarker resolution</b>). The accuracy of a match between a variant in the sample and a clinical evidence item (biomarker) will vary accordingly (highlighted by gene symbols with different color backgrounds):\n\n")
Expand Down
2 changes: 1 addition & 1 deletion inst/templates/quarto/cpsr_classification.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ htmltools::br()
<br>

* A total of n = __`r tot_variants[['class2']][['ClinVar']]`__ variants are recorded with a <i>Likely Benign</i> clinical significance in the [ClinVar](https://www.ncbi.nlm.nih.gov/clinvar/) database.
* A total of n = __`r tot_variants[['class2']][['CPSR_ACMG']]`__ <i><b>Other</b></i> variants (i.e. not submitted to/recorded in ClinVar) are classified with a <i>Likely Benign</i> clinical significance by CPSR (refined ACMG criteria - based on population frequency and variant effect).
* A total of n = __`r tot_variants[['class2']][['CPSR_ACMG']]`__ <i><b>non-ClinVar</b></i> variants (i.e. not submitted to/recorded in ClinVar) are classified with a <i>Likely Benign</i> clinical significance by CPSR (refined ACMG criteria - based on population frequency and variant effect).

::: {.callout-note}
Variants displayed here constitute the top 2000 variants for each of the ClinVar and non-ClinVar variant sets (due to display limitations with client-side tables)
Expand Down
2 changes: 1 addition & 1 deletion inst/templates/quarto/cpsr_summary.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ bslib::layout_column_wrap(
value = paste0(
"N = ",
cps_report$content$snv_indel$v_stat_cpg$n_p +
cps_report$content$snv_indel$v_stat_cpg$n_p),
cps_report$content$snv_indel$v_stat_cpg$n_lp),
showcase = bsicons::bs_icon("bullseye"),
theme = bslib::value_box_theme(
bg = color_lp, fg = "#fff"),
Expand Down
4 changes: 1 addition & 3 deletions inst/templates/quarto/cpsr_virtual_panel.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ tiles_html <- cpsr::plot_virtual_panels(
<br>

::: {.callout-note}
CPSR does not perform any interrogation of _which genes
that were subject to sequencing_, it merely checks potential overlap of input variants
within the user-defined __virtual__ gene panel.
For the sample in question, `r cps_report$settings$sample_id`, CPSR does **not** perform any interrogation of _which genes that were subject to sequencing_. CPSR classifies only input variants (i.e. as found in the query VCF) within the user-defined __virtual__ gene panel.
:::

<br>

0 comments on commit 3be31a6

Please sign in to comment.