Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "2.3.1.9001"
current_version = "2.3.1.9002"
search = "{current_version}"
replace = "{new_version}"
message = "Bump version: {current_version} → {new_version}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_conda_recipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
conda_env_yaml: conda/env/yaml
conda_env_lock: conda/env/lock
conda_org: pcgr
VERSION: '2.3.1.9001' # bump
VERSION: '2.3.1.9002' # bump
jobs:
conda_build:
# When merging to one of the branches above and the commit message matches
Expand Down
251 changes: 126 additions & 125 deletions conda/env/lock/pcgr-linux-64.lock

Large diffs are not rendered by default.

67 changes: 34 additions & 33 deletions conda/env/lock/pcgr-osx-64.lock

Large diffs are not rendered by default.

145 changes: 72 additions & 73 deletions conda/env/lock/pcgrr-linux-64.lock

Large diffs are not rendered by default.

141 changes: 70 additions & 71 deletions conda/env/lock/pcgrr-osx-64.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion conda/env/yaml/pcgr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ channels:
- bioconda

dependencies:
- pcgr ==2.3.1.9001 # bump
- pcgr ==2.3.1.9002 # bump
- bioconda::bedtools
- bioconda::bcftools
- bioconda::ensembl-vep ==115.1
Expand Down
2 changes: 1 addition & 1 deletion conda/env/yaml/pcgrr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ channels:

dependencies:
- python
- r-pcgrr ==2.3.1.9001 # bump
- r-pcgrr ==2.3.1.9002 # bump
- r-cpsr
- r-argparse
- bioconductor-bsgenome.hsapiens.ucsc.hg38
Expand Down
2 changes: 1 addition & 1 deletion conda/env/yaml/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
- bioconda
- conda-forge
dependencies:
- r-pcgrr ==2.3.1.9001 # bump
- r-pcgrr ==2.3.1.9002 # bump
- r-pkgdown
- r-readr
- r-glue
Expand Down
2 changes: 1 addition & 1 deletion conda/recipe/pcgr/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
context:
name: pcgr
version: 2.3.1.9001 # bump
version: 2.3.1.9002 # bump

package:
name: ${{ name|lower }}
Expand Down
2 changes: 1 addition & 1 deletion conda/recipe/pcgrr/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
context:
name: r-pcgrr
version: 2.3.1.9001 # bump
version: 2.3.1.9002 # bump

package:
name: ${{ name|lower }}
Expand Down
2 changes: 1 addition & 1 deletion pcgr/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.3.1.9001' # bump
__version__ = '2.3.1.9002' # bump
2 changes: 1 addition & 1 deletion pcgrr/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: pcgrr
Type: Package
Title: Personal Cancer Genome ReporteR
Version: 2.3.1.9001
Version: 2.3.1.9002
Authors@R:
c(person(given = "Sigve",
family = "Nakken",
Expand Down
1 change: 1 addition & 0 deletions pcgrr/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export(stats_report_germline)
export(stats_report_snv_indel)
export(stats_type_snv_indel)
export(strip_html)
export(sync_biomarker_evidence)
export(tcga_somatic_status)
export(tier_af_distribution)
export(tmb_doc_note)
Expand Down
13 changes: 13 additions & 0 deletions pcgrr/R/input_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,19 @@ load_somatic_snv_indel <- function(
}
}

## Re-sync biomarker evidence items/classifications with the variant set
## as it stands after all filtering above (allelic depth/fraction, and -
## for tumor-only input - germline/non-exonic filtering). Biomarker
## matching was performed once, early, inside load_dna_variants(), against
## the variant set as it existed prior to this filtering - without this
## step, evidence items for variants removed above remain orphaned in
## 'bm_evidence' (see https://github.com/sigven/pcgr/issues/302)
if ("bm_evidence" %in% names(callset)) {
callset[['bm_evidence']] <- sync_biomarker_evidence(
bm_evidence = callset[['bm_evidence']],
var_df = callset[['variant']])
}

if (NROW(callset[['variant']]) > 0) {
callset[['variant']] <- callset[['variant']] |>
dplyr::arrange(
Expand Down
76 changes: 76 additions & 0 deletions pcgrr/R/variant_classification.R
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,82 @@ assign_amp_asco_cap_tiers <- function(

}

#' Re-synchronize biomarker evidence items/classifications with a
#' (possibly further-filtered) variant set
#'
#' Biomarker evidence matching (\code{map_biomarker_data()},
#' \code{assign_amp_asco_cap_tiers()}) is performed once, early, against
#' the variant set as it existed right after annotation. Callers may go on
#' to remove variants from that set afterwards (e.g. allelic depth/fraction
#' filtering via \code{filter_read_support()}, or germline/non-exonic
#' filtering for tumor-only input). Without re-syncing, evidence items for
#' variants removed by such downstream filtering remain "orphaned" -
#' present in \code{bm_evidence} but absent from the variant set - which
#' surfaces as biomarker-matched variants missing from the variant listing
#' in the report while still appearing in the biomarker evidence listing
#' (see <https://github.com/sigven/pcgr/issues/302>).
#'
#' @param bm_evidence list with biomarker evidence data (as initialized by
#' \code{init_biomarker_content()}), i.e. top-level 'eitems'/'classification'
#' data frames plus one sub-list per clinical significance category, each
#' with its own 'eitems'/'classification' data frames
#' @param var_df data frame with the final (filtered) variant set
#'
#' @return bm_evidence list, with all 'eitems'/'classification' data frames
#' limited to records matching a variant in var_df
#'
#' @export
sync_biomarker_evidence <- function(bm_evidence = NULL, var_df = NULL) {

invisible(assertthat::assert_that(
is.list(bm_evidence),
msg = "Argument 'bm_evidence' needs to be of type list"))
invisible(assertthat::assert_that(
is.data.frame(var_df),
msg = "Argument 'var_df' needs to be of type data.frame"))

join_cols <- intersect(
c("VAR_ID", "VARIANT_CLASS", "ENTREZGENE"),
colnames(var_df))

if (length(join_cols) == 0 || NROW(var_df) == 0) {
return(bm_evidence)
}

variant_keys <- var_df |>
dplyr::select(dplyr::all_of(join_cols)) |>
dplyr::distinct()

sync_df <- function(df) {
if (is.data.frame(df) && NROW(df) > 0 &&
all(join_cols %in% colnames(df))) {
return(dplyr::semi_join(df, variant_keys, by = join_cols))
}
return(df)
}

for (elem in c("eitems", "classification")) {
if (elem %in% names(bm_evidence)) {
bm_evidence[[elem]] <- sync_df(bm_evidence[[elem]])
}
}

for (clnsig in names(bm_evidence)) {
if (is.list(bm_evidence[[clnsig]]) &&
!is.data.frame(bm_evidence[[clnsig]])) {
for (elem in c("eitems", "classification")) {
if (elem %in% names(bm_evidence[[clnsig]])) {
bm_evidence[[clnsig]][[elem]] <-
sync_df(bm_evidence[[clnsig]][[elem]])
}
}
}
}

return(bm_evidence)

}

#' Assign tiers of clinical significance (AMP/ASCO/CAP framework) to
#' somatic CNAs
#'
Expand Down
34 changes: 34 additions & 0 deletions pcgrr/man/sync_biomarker_evidence.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pcgrr/vignettes/installation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require(glue, include.only = "glue")

```{r vars, echo=FALSE}
Sys.setenv(VEP_VERSION = "115")
Sys.setenv(PCGR_VERSION = "2.3.1.9001")
Sys.setenv(PCGR_VERSION = "2.3.1.9002")
Sys.setenv(BUNDLE_VERSION = "20260620")
VEP_VERSION <- Sys.getenv("VEP_VERSION")
PCGR_VERSION <- Sys.getenv("PCGR_VERSION")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pcgr"
version = "2.3.1.9001" # bump
version = "2.3.1.9002" # bump
description = "Personal Cancer Genome Reporter (PCGR) - variant interpretation for precision cancer medicine"
authors = [
{name = "Sigve Nakken", email = "sigven@gmail.com"},
Expand Down