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(