Cancer associations {.tabset}



Query set - cancer association rank




target_assocs <- onc_enrich_report[['data']][['disease']][['target']] |>
  dplyr::mutate(targetset_cancer_rank = round(
    .data$targetset_cancer_rank, digits = 2)) |>
  dplyr::mutate(global_cancer_rank = round(
    .data$global_cancer_rank, digits = 2)) |>
  dplyr::select(-c("tumor_suppressor","oncogene")) |>
  dplyr::rename(tumor_suppressive = tsg_confidence_level,
                oncogenic = oncogene_confidence_level) |>
  dplyr::mutate(tumor_suppressive = dplyr::case_when(
    tumor_suppressive == "VERY STRONG" ~ "Very Strong",
    tumor_suppressive == "STRONG" ~ "Strong",
    tumor_suppressive == "MODERATE" ~ "Moderate",
    TRUE ~ as.character(tumor_suppressive)
  )) |>
   dplyr::mutate(oncogenic = dplyr::case_when(
    oncogenic == "VERY STRONG" ~ "Very Strong",
    oncogenic == "STRONG" ~ "Strong",
    oncogenic == "MODERATE" ~ "Moderate",
    TRUE ~ as.character(oncogenic)
  )) |>
  dplyr::mutate(tumor_suppressive = dplyr::if_else(
    tumor_suppressive == "NONE/LIMITED",
    "",
    as.character(tumor_suppressive)
  )) |>
  dplyr::mutate(oncogenic = dplyr::if_else(
    oncogenic == "NONE/LIMITED",
    "",
    as.character(oncogenic)
  ))

tsg_confidence_levels <- levels(as.factor(
  target_assocs$tumor_suppressive))

oncogene_confidence_levels <- levels(as.factor(
  target_assocs$oncogenic))

targets_shared <- crosstalk::SharedData$new(target_assocs)

crosstalk::bscols(
  list(
    crosstalk::filter_select("symbol", "Target", targets_shared, ~symbol),
    crosstalk::filter_select("tumor_suppressive", "Tumor suppressor evidence", 
                             targets_shared, ~tumor_suppressive),
    crosstalk::filter_select("oncogenic", "Oncogene evidence", 
                             targets_shared, ~oncogenic)
  ),
  list(
    crosstalk::filter_select("cancer_associations", "Associated cancer types", 
                             targets_shared, ~cancer_associations),
    crosstalk::filter_select("disease_associations", "Associated diseases (non-cancer)", 
                             targets_shared, ~disease_associations),
    crosstalk::filter_checkbox("cancer_driver", "Potential cancer driver", 
                               targets_shared, ~cancer_driver)
  )
)

htmltools::br()
dt <- DT::datatable(
  targets_shared, escape = F, 
  extensions=c("Buttons","Responsive"), 
  width = "100%",
  options=list(buttons = c('csv','excel'),
               #columnDefs = list(list(className = 'dt-center', targets = 3:5)),
               pageLength = 20,
               dom = 'Blfrtip')) |>
  DT::formatStyle('oncogenic', textAlign = 'center') |>
  DT::formatStyle('tumor_suppressive', textAlign = 'center') |>
  DT::formatStyle("symbol",
                  "targetset_cancer_rank", 
                  color = "white", 
                  backgroundColor = DT::styleInterval(
                    onc_enrich_report[['config']][['disease']][['breaks']],
                    onc_enrich_report[['config']][['disease']][['colors']])
  )

if(length(tsg_confidence_levels) > 0){
  dt <- dt |>
    DT::formatStyle(
      "tumor_suppressive","tumor_suppressive",
      color = "white", 
      backgroundColor = DT::styleEqual(
        c("Very Strong", "Strong", "Moderate"),
       c("#5A5A5A", "#898989", "#BBBBBB"))
    )
}

if(length(oncogene_confidence_levels) > 0){
  dt <- dt |>
    DT::formatStyle(
      "oncogenic", "oncogenic",
      color = "white",
      backgroundColor = DT::styleEqual(
        c("Very Strong", "Strong", "Moderate"),
        c("#5A5A5A", "#898989", "#BBBBBB"))
    )
}
dt
cat('<i>No genes with disease associations from Open Targets Platform were found.</i>',sep='\n')
cat('\n')



Query set - association strength pr. tumor type



oe_ttype_matrix <- 
  onc_enrich_report[['data']][['disease']][['ttype_matrix']]

if(NROW(oe_ttype_matrix) > 100){
  oe_ttype_matrix <- oe_ttype_matrix[1:100,]
}

if(NROW(oe_ttype_matrix) > 1){
  oe_ttype_matrix <- 
    oe_ttype_matrix[nrow(oe_ttype_matrix):1, ]
}

n_percent_ticks <- 10
if(NROW(oe_ttype_matrix) < 20){
  n_percent_ticks <- 5
}

target_ttype_rank_fig <- plotly::plot_ly(
  colors = "Blues",
  width = 800,
  height = 400 + (14.67 * NROW(oe_ttype_matrix))) |>
  #width = 1040,
  #height = 520 + (19.071 * NROW(oe_ttype_matrix))) |>
  plotly::add_heatmap(
    y = rownames(oe_ttype_matrix),
    x = colnames(oe_ttype_matrix),
    z = oe_ttype_matrix,
    hovertext = "Tumor type percent rank",
    yaxis = "y") |>
  plotly::layout(
    title = 'Tumor type association rank',
    xaxis = list(tickfont = list(size = 13, family = "Helvetica"), 
                 tickangle = -50),
    yaxis = list(tickfont = list(size = 12, family = "Helvetica")),
    margin = list(l = 75, r = 20, b = 150, t = 30, pad = 4)
  ) |>
  plotly::colorbar(
    nticks = n_percent_ticks, 
    title = list(text = "Percent rank",side = "bottom"),
    limits = c(0, plyr::round_any(max(oe_ttype_matrix), 100, ceiling)))

rm(oe_ttype_matrix)
target_ttype_rank_fig
cat('<br>')
cat('\n <ul><li>  <i> <span style="font-size: 100%; padding: 3px; background-color:#989898; color:white">&nbsp;&nbsp;<b>NOT SHOWN</b> - limited/few tumor-type specific associations found for genes in the query set.&nbsp;&nbsp;</span></i></li></ul>',sep='\n')
cat('\n')
cat('<br><br>')



{.unlisted .unnumbered .toc-ignore}

  Citation Note   : If you use the output of the Cancer Association module of oncoEnrichR in your research, please cite the following resources and tools as approriate:





sigven/oncoEnrichR documentation built on Aug. 31, 2023, 8:05 a.m.