Gene fitness scores {.tabset}



Loss-of-fitness distribution

targets_wide <- as.data.frame(
  onc_enrich_report[['data']][['fitness']][['fitness_scores']][['targets']] |>
    dplyr::group_by(.data$symbol,
                    .data$n_gene_tissue,
                    .data$symbol_link_ps,
                    .data$n_gene,
                    .data$tissue) |>
    dplyr::summarise(cell_lines = paste(.data$model_name, collapse = ", "),
                     ps_link = paste(.data$model_link_ps, collapse = ", "),
                     .groups = "drop") |>
    dplyr::ungroup() |>
    dplyr::mutate(cell_lines = stringr::str_replace_all(.data$cell_lines, "\\.", "-"))
)

fitness_lof_oe_plot <- targets_wide |>
  dplyr::mutate(symbol = forcats::fct_reorder(symbol, n_gene)) |>
  ggplot2::ggplot(ggplot2::aes(x = symbol, y = n_gene_tissue, fill = tissue)) +
  ggplot2::geom_bar(stat = "identity") +
  ggplot2::coord_flip() +
  ggplot2::ylab("Number of cell lines with significant loss-of-fitness") +
  ggplot2::xlab("") +
  ggplot2::scale_fill_manual(values = pals::stepped(24)) +
  ggplot2::theme(
    panel.grid.minor = ggplot2::element_blank(),
    axis.text = ggplot2::element_text(family = "Helvetica", size = 11),
    legend.text = ggplot2::element_text(family = "Helvetica", size = 11),
    axis.title.x = ggplot2::element_text(family = "Helvetica", size = 12),
    legend.title = ggplot2::element_blank(),
    #set thickness of axis ticks
    axis.ticks = ggplot2::element_line(size = 0.2),
    #remove plot background
    plot.background = ggplot2::element_blank()
  )

plotly::ggplotly(fitness_lof_oe_plot)
rm(fitness_lof_oe_plot)
cat('<br>\n <ul><li>  <i> <span style="font-size: 105%; padding: 3px; background-color:#989898; color:white">&nbsp;&nbsp;<b>NO GENES</b> in the query set found with loss-of-fitness effect from CRISPR/Cas9 screens in DepMap/Project Score.&nbsp;&nbsp; </span></i></li></ul>',sep='\n')
cat('\n')
cat('<br><br>')

Loss-of-fitness table

htmltools::br()

fitness_lof_oe_df <- onc_enrich_report[['data']][['fitness']][['fitness_scores']][['targets']] |>
  dplyr::group_by(.data$symbol,
                  .data$n_gene_tissue,
                  .data$symbol_link_ps,
                  .data$n_gene,
                  .data$tissue) |>
  dplyr::summarise(ps_link = paste(.data$model_link_ps, collapse = ", "),
                   .groups = "drop") |>
  dplyr::ungroup() |>
  dplyr::select(.data$symbol_link_ps, .data$tissue, .data$ps_link) |>
  dplyr::rename(cell_lines = .data$ps_link, symbol = .data$symbol_link_ps) |>
  dplyr::mutate(loss_of_fitness = T) |>
  head(2000)

fitness_lof_oe_table <- 
  crosstalk::SharedData$new(fitness_lof_oe_df)
rm(fitness_lof_oe_df)

crosstalk::bscols(
  list(
    crosstalk::filter_select("tissue", "Tissue", 
                             fitness_lof_oe_table, ~tissue)
  )
)

DT::datatable(
  fitness_lof_oe_table, 
  escape = F, 
  extensions = c("Buttons","Responsive"), 
  width = "100%",
  options = list(buttons = c('csv','excel'),
               dom = 'Bfrtip', 
               pagelength = 20)
  )
cat('<br>\n <ul><li>  <i> <span style="font-size: 105%; padding: 3px; background-color:#989898; color:white">&nbsp;&nbsp;<b>NO GENES</b> in the query set found with loss-of-fitness effect from CRISPR/Cas9 screens in DepMap/Project Score.&nbsp;&nbsp; </span></i></li></ul>',sep='\n')
cat('\n')
cat('<br><br>')

Target priority scores


oe_priority_matrix <- as.data.frame(
  onc_enrich_report[['data']][['fitness']][['target_priority_scores']][['targets']] |>
  dplyr::arrange(symbol) |>
  tidyr::pivot_wider(names_from = tumor_type,
                     values_from = priority_score)
)
rownames(oe_priority_matrix) <-
  oe_priority_matrix$symbol
oe_priority_matrix$symbol <- NULL
oe_priority_matrix <- as.matrix(oe_priority_matrix)

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

oe_priority_matrix <- 
  oe_priority_matrix[nrow(oe_priority_matrix):1, ]

oe_target_priority_fig <- plotly::plot_ly(
  colors = "YlGn",
  width = 800,
  height = 400 + (14.67 * NROW(oe_priority_matrix))) |>
  plotly::add_heatmap(
    y = rownames(oe_priority_matrix),
    x = colnames(oe_priority_matrix),
    z = oe_priority_matrix,
    hovertext = "Priority score",
    yaxis = "y") |>
  plotly::layout(
    title = 'Target priority scores',
    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 = 10, 
    title = list(text = "Priority score",side = "bottom"),
    limits = c(0, plyr::round_any(max(oe_priority_matrix), 10, ceiling)))

rm(oe_priority_matrix)
oe_target_priority_fig
cat('<br>\n <ul><li>  <i> <span style="font-size: 105%; padding: 3px; background-color:#989898; color:white">&nbsp;&nbsp;<b>NO / LIMITED GENES</b> in the query set nominated as prioritized targets in DepMap/Project Score.&nbsp;&nbsp; </span></i></li></ul>',sep='\n')
cat('\n')



{.unlisted .unnumbered .toc-ignore}

  Citation Note   : If you use the output of the Gene fitness scores module of oncoEnrichR in your research, please cite the following resources and tools as appropriate:





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