From c3aa59f585fc4108adeaac1a72a40fe09906c3e5 Mon Sep 17 00:00:00 2001 From: pdiakumis Date: Fri, 29 Sep 2023 21:41:25 +1000 Subject: [PATCH] pcgr: handle tmb v_stat (fixes #99) --- R/pcgr.R | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/R/pcgr.R b/R/pcgr.R index 1d77a95..193fb77 100644 --- a/R/pcgr.R +++ b/R/pcgr.R @@ -32,17 +32,19 @@ PcgrJsonFile <- R6::R6Class( # purrr::map(l2tib) |> # dplyr::bind_rows(.id = "name_tidy") |> # dplyr::select("name", "name_tidy", "version", "url", "resource_type") - tmb <- j[["content"]][["tmb"]][["variant_statistic"]] - # handle nulls - tmb <- tmb %||% list(tmb_estimate = NA, n_tmb = NA) + # handle nulls and rename - see umccr/dracarys#99 + tmb <- + j[["content"]][["tmb"]][["variant_statistic"]] %||% + j[["content"]][["tmb"]][["v_stat"]] %||% + list(tmb_estimate = NA, n_tmb = NA) tmb <- purrr::flatten(tmb) |> - tibble::as_tibble() |> + tibble::as_tibble_row() |> dplyr::select("tmb_estimate", "n_tmb") msi <- j[["content"]][["msi"]][["prediction"]][["msi_stats"]] # handle nulls msi <- msi %||% list(fracIndels = NA, predicted_class = NA) msi <- purrr::flatten(msi) |> - tibble::as_tibble() |> + tibble::as_tibble_row() |> dplyr::select("fracIndels", "predicted_class") metrics <- dplyr::bind_cols(msi, tmb) list(