Tutorial: drug_regimen_sunburst"

knitr::opts_chunk$set(
  collapse = TRUE,
  message = FALSE,
  comment = "#>")

# exit if user doesn't have synapser, a log in, or access to data.
if (genieBPC:::.is_connected_to_genie() == FALSE){
  knitr::knit_exit()
}
library(genieBPC)
library(dplyr)
library(ggplot2)
library(plotly)
library(gt)
library(magrittr)
library(tibble)
gt_compact_fun <- function(x) {
  gt::tab_options(x,
                  table.font.size = 'small',
                  data_row.padding = gt::px(1),
                  summary_row.padding = gt::px(1),
                  grand_summary_row.padding = gt::px(1),
                  footnotes.padding = gt::px(1),
                  source_notes.padding = gt::px(1),
                  row_group.padding = gt::px(1))
}

Introduction

The drug_regimen_sunburst() function allows the user to visualize the complete treatment course for selected diagnoses in a given analytic cohort. The function returns a list containing a 'treatment_history' data frame and the interactive plot 'sunburst_plot'.

Modifying Function Arguments

tbl_arguments = tibble::tribble(
  ~Argument,       ~Description,
  "`data_synapse`",       "The item from the nested list returned from pull_data_synapse() corresponding to the cancer cohort of interest.",
  "`data_cohort`",       "The list returned from the `create_analytic_cohort()` function call.",
  "`max_n_regimens`",        "The number of lines of treatment displayed in the sunburst plot.") %>%
  gt::gt() %>%
  gt::tab_header(title = "`drug_regimen_sunburst()` Function Arguments") %>%
  gt::fmt_markdown(columns = c(Argument)) %>%
  gt::tab_options(table.font.size = 'small',
                  data_row.padding = gt::px(1),
                  summary_row.padding = gt::px(1),
                  grand_summary_row.padding = gt::px(1),
                  footnotes.padding = gt::px(1),
                  source_notes.padding = gt::px(1),
                  row_group.padding = gt::px(1)) %>%
  gt_compact_fun()

tbl_arguments
tbl_arguments

Note that the innermost circle of the sunburst plot indicates the first therapies that patients received following diagnosis. The circle is divided proportionally based on the percentage of patients that received a particular treatment. Each subsequent ring of the sunburst corresponds to a subsequent treatment regimen, such that the inner rings represent earlier treatments. Together, the rings illustrate the distribution and patterns of various treatment regimens.

Setup

Before going through the tutorial, load the {genieBPC} library and log into Synapse using the set_synapse_credentials() function. For more information on set_synapse_credentials(), refer to the Tutorial: pull_data_synapse() vignette.

library(genieBPC)

set_synapse_credentials()

This tutorial will utilize the data downloaded in the Tutorial: pull_data_synapse() vignette, as shown below:

nsclc_2_0 = pull_data_synapse("NSCLC", version = "v2.0-public")

Example

The example below creates a sunburst plot of the first three cancer-directed regimens received by patients diagnosed with Stage IV NSCLC.

nsclc_stg_iv = create_analytic_cohort(data_synapse = nsclc_2_0$NSCLC_v2.0,
                                      stage = c("Stage IV"))

nsclc_treatment = drug_regimen_sunburst(data_synapse = nsclc_2_0$NSCLC_v2.0,
                      data_cohort = nsclc_stg_iv,
                      max_n_regimens = 3)
head(nsclc_treatment$treatment_history)
nsclc_treatment$sunburst_plot


Try the genieBPC package in your browser

Any scripts or data that you put into this service are public.

genieBPC documentation built on March 7, 2023, 6:46 p.m.