show_hpa_prognostic <- list() prognostic_assoc_data <- list() active_tab <- list() for(n in c('favorable','unfavorable')){ show_hpa_prognostic[[n]] <- TRUE active_tab[[n]] <- FALSE prognostic_assoc_data[[n]] <- data.frame() prognostic_assoc_data[[n]] <- onc_enrich_report[['data']][['cancer_prognosis']][['hpa']][['assocs']] |> dplyr::filter(evidence_direction == n) |> dplyr::select(-evidence_direction) if(nrow(prognostic_assoc_data[[n]]) == 0){ show_hpa_prognostic[[n]] <- FALSE } } if(show_hpa_prognostic[['favorable']] == T){ active_tab[['favorable']] <- T }else{ if(show_hpa_prognostic[['unfavorable']] == T){ active_tab[['unfavorable']] <- T }else{ active_tab[['favorable']] <- T } }
if(active_tab[['favorable']] == T){ cat("") cat("##### Favorable associations {.active}") cat("") }else{ cat("") cat("##### Favorable associations") cat("") }
prognostic_genes_favorable <- crosstalk::SharedData$new(prognostic_assoc_data[['favorable']]) crosstalk::bscols( list( crosstalk::filter_select("symbol", "Target gene", prognostic_genes_favorable, ~symbol), crosstalk::filter_slider("log10_p_value", "-log10 (p-value)", prognostic_genes_favorable, ~log10_p_value, step = 1, min = 3, max = 16) ), list( crosstalk::filter_select("primary_site", "Primary tumor site", prognostic_genes_favorable, ~primary_site), crosstalk::filter_slider("percentile_rank_all", "Percentile rank (any tumor site)", prognostic_genes_favorable, ~percentile_rank_all, step = 10, min = 0, max = 100), crosstalk::filter_slider("percentile_rank_site", "Percentile rank (tumor site)", prognostic_genes_favorable, ~percentile_rank_site, step = 10, min = 0, max = 100) ) ) htmltools::br() DT::datatable(prognostic_genes_favorable, escape = F, extensions=c("Buttons","Responsive"), width = "100%", options=list(buttons = c('csv','excel'), dom = 'Bfrtip')) |> DT::formatStyle("symbol","log10_p_value", color = "white", fontWeight = "bold", backgroundColor = DT::styleInterval(onc_enrich_report[['config']][['prognosis']][['breaks']], onc_enrich_report[['config']][['prognosis']][['colors_favorable']]))
cat('<br><br>\n <ul><li> <i> <span style="font-size: 105%; padding: 3px; background-color:#989898; color:white"> No genes in the query set with favorable gene expression association to prognosis </span></i></li></ul>',sep='\n') cat('\n') cat('<br><br>')
if(active_tab[['unfavorable']] == T){ cat("") cat("##### Unfavorable associations {.active}") cat("") }else{ cat("") cat("##### Unfavorable associations") cat("") }
prognostic_genes_unfavorable <- crosstalk::SharedData$new(prognostic_assoc_data[['unfavorable']]) crosstalk::bscols( list( crosstalk::filter_select("symbol", "Target gene", prognostic_genes_unfavorable, ~symbol), crosstalk::filter_slider("log10_p_value", "-log10 (p-value)", prognostic_genes_unfavorable, ~log10_p_value, step = 1, min = 3, max = 16) ), list( crosstalk::filter_select("primary_site", "Primary tumor site", prognostic_genes_unfavorable, ~primary_site), crosstalk::filter_slider("percentile_rank_all", "Percentile rank (any tumor site)", prognostic_genes_unfavorable, ~percentile_rank_all, step = 10, min = 0, max = 100), crosstalk::filter_slider("percentile_rank_site", "Percentile rank (tumor site)", prognostic_genes_unfavorable, ~percentile_rank_site, step = 10, min = 0, max = 100) ) ) htmltools::br() DT::datatable(prognostic_genes_unfavorable, escape = F, extensions=c("Buttons","Responsive"), width = "100%", options=list(buttons = c('csv','excel'), dom = 'Bfrtip')) |> DT::formatStyle("symbol","log10_p_value", color = "white", fontWeight = "bold", backgroundColor = DT::styleInterval(onc_enrich_report[['config']][['prognosis']][['breaks']], onc_enrich_report[['config']][['prognosis']][['colors_unfavorable']]))
cat('<br><br>\n <ul><li> <i> <span style="font-size: 105%; padding: 3px; background-color:#989898; color:white"> No genes in the query set with unfavorable gene expression association to prognosis </span></i></li></ul>',sep='\n') cat('\n') cat('<br><br>')
mutation_zscore_matrix <- as.data.frame( onc_enrich_report[['data']][['cancer_prognosis']][['km_cshl']][['assocs']][['mut']] |> tidyr::pivot_wider(names_from = tcga_cohort, values_from = z_score) |> dplyr::arrange(symbol) ) rownames(mutation_zscore_matrix) <- mutation_zscore_matrix$symbol mutation_zscore_matrix$symbol <- NULL mutation_zscore_matrix <- as.matrix(mutation_zscore_matrix) if(NROW(mutation_zscore_matrix) > 100){ mutation_zscore_matrix <- mutation_zscore_matrix[1:100,] } if(NROW(mutation_zscore_matrix) > 1){ mutation_zscore_matrix <- mutation_zscore_matrix[nrow(mutation_zscore_matrix):1, ] } n_zscore_ticks <- 20 if(NROW(mutation_zscore_matrix) < 20){ n_zscore_ticks <- 5 } mutation_survival_fig <- plotly::plot_ly( colors = "RdBu", width = 800, height = 400 + (14.67 * NROW(mutation_zscore_matrix))) |> plotly::add_heatmap( y = rownames(mutation_zscore_matrix), x = colnames(mutation_zscore_matrix), z = mutation_zscore_matrix, hovertext = "Z-score", yaxis = "y") |> plotly::layout( title = 'Target survival associations (mutation)', 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_zscore_ticks, title = list(text = "Z-score",side = "bottom"), limits = c(-8.5, 8.5)) mutation_survival_fig
cat('<br>\n <ul><li> <i> <span style="font-size: 105%; padding: 3px; background-color:#989898; color:white"> <b>NO GENES</b> in the query set with survival association scores (mutation). </span></i></li></ul>',sep='\n') cat('\n')
expression_zscore_matrix <- as.data.frame( onc_enrich_report[['data']][['cancer_prognosis']][['km_cshl']][['assocs']][['exp']] |> tidyr::pivot_wider(names_from = tcga_cohort, values_from = z_score) |> dplyr::arrange(symbol) ) rownames(expression_zscore_matrix) <- expression_zscore_matrix$symbol expression_zscore_matrix$symbol <- NULL expression_zscore_matrix <- as.matrix(expression_zscore_matrix) if(NROW(expression_zscore_matrix) > 100){ expression_zscore_matrix <- expression_zscore_matrix[1:100,] } if(NROW(expression_zscore_matrix) > 1){ expression_zscore_matrix <- expression_zscore_matrix[nrow(expression_zscore_matrix):1, ] } n_zscore_ticks <- 20 if(NROW(expression_zscore_matrix) < 20){ n_zscore_ticks <- 5 } expression_survival_fig <- plotly::plot_ly( colors = "RdBu", width = 800, height = 400 + (14.67 * NROW(expression_zscore_matrix))) |> plotly::add_heatmap( y = rownames(expression_zscore_matrix), x = colnames(expression_zscore_matrix), z = expression_zscore_matrix, hovertext = "Z-score", yaxis = "y") |> plotly::layout( title = 'Target survival associations (expression)', 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_zscore_ticks, title = list(text = "Z-score",side = "bottom"), limits = c(-11, 11)) expression_survival_fig
cat('<br>\n <ul><li> <i> <span style="font-size: 105%; padding: 3px; background-color:#989898; color:white"> <b>NO GENES</b> in the query set with survival association scores (expression). </span></i></li></ul>',sep='\n') cat('\n')
cna_zscore_matrix <- as.data.frame( onc_enrich_report[['data']][['cancer_prognosis']][['km_cshl']][['assocs']][['cna']] |> tidyr::pivot_wider(names_from = tcga_cohort, values_from = z_score) |> dplyr::arrange(symbol) ) rownames(cna_zscore_matrix) <- cna_zscore_matrix$symbol cna_zscore_matrix$symbol <- NULL cna_zscore_matrix <- as.matrix(cna_zscore_matrix) if(NROW(cna_zscore_matrix) > 100){ cna_zscore_matrix <- cna_zscore_matrix[1:100,] } if(NROW(cna_zscore_matrix) > 1){ cna_zscore_matrix <- cna_zscore_matrix[nrow(cna_zscore_matrix):1, ] } n_zscore_ticks <- 20 if(NROW(cna_zscore_matrix) < 20){ n_zscore_ticks <- 5 } cna_survival_fig <- plotly::plot_ly( colors = "RdBu", width = 800, height = 400 + (14.67 * NROW(cna_zscore_matrix))) |> plotly::add_heatmap( y = rownames(cna_zscore_matrix), x = colnames(cna_zscore_matrix), z = cna_zscore_matrix, hovertext = "Z-score", yaxis = "y") |> plotly::layout( title = 'Target survival associations (CNA)', 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_zscore_ticks, title = list(text = "Z-score",side = "bottom"), limits = c(-11, 11)) cna_survival_fig
cat('<br>\n <ul><li> <i> <span style="font-size: 105%; padding: 3px; background-color:#989898; color:white"> <b>NO GENES</b> in the query set with survival association scores (CNA). </span></i></li></ul>',sep='\n') cat('\n')
meth_zscore_matrix <- as.data.frame( onc_enrich_report[['data']][['cancer_prognosis']][['km_cshl']][['assocs']][['meth']] |> tidyr::pivot_wider(names_from = tcga_cohort, values_from = z_score) |> dplyr::arrange(symbol) ) rownames(meth_zscore_matrix) <- meth_zscore_matrix$symbol meth_zscore_matrix$symbol <- NULL meth_zscore_matrix <- as.matrix(meth_zscore_matrix) if(NROW(meth_zscore_matrix) > 100){ meth_zscore_matrix <- meth_zscore_matrix[1:100,] } if(NROW(meth_zscore_matrix) > 1){ meth_zscore_matrix <- meth_zscore_matrix[nrow(meth_zscore_matrix):1, ] } n_zscore_ticks <- 20 if(NROW(meth_zscore_matrix) < 20){ n_zscore_ticks <- 5 } meth_survival_fig <- plotly::plot_ly( colors = "RdBu", width = 800, height = 400 + (14.67 * NROW(meth_zscore_matrix))) |> plotly::add_heatmap( y = rownames(meth_zscore_matrix), x = colnames(meth_zscore_matrix), z = meth_zscore_matrix, hovertext = "Z-score", yaxis = "y") |> plotly::layout( title = 'Target survival associations (methylation)', 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_zscore_ticks, title = list(text = "Z-score",side = "bottom"), limits = c(-11.5, 11.5)) meth_survival_fig
cat('<br>\n <ul><li> <i> <span style="font-size: 105%; padding: 3px; background-color:#989898; color:white"> <b>NO GENES</b> in the query set with survival association scores (methylation). </span></i></li></ul>',sep='\n') cat('\n')
Citation Note : If you use the output of the Prognostic associations module of oncoEnrichR in your research, please cite the following resources and tools:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.