From fffc0aedf8ecbadcf1d7b13af0ab88fb0ed9bee1 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Fri, 13 Sep 2024 09:24:28 -0500 Subject: [PATCH] Show all candidates from peptide table in the anchor heatmap plot --- pvactools/tools/pvacview/server.R | 17 ++++++++++++++--- pvactools/tools/pvacview/ui.R | 6 +++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pvactools/tools/pvacview/server.R b/pvactools/tools/pvacview/server.R index 79ee9332..d224e164 100644 --- a/pvactools/tools/pvacview/server.R +++ b/pvactools/tools/pvacview/server.R @@ -930,6 +930,9 @@ server <- shinyServer(function(input, output, session) { }) ##Add legend for anchor heatmap output$peptideFigureLegend <- renderPlot({ + if (is.null(df$metricsData)) { + return() + } colors <- colorRampPalette(c("lightblue", "blue"))(99)[seq(1, 99, 7)] color_pos <- data.frame(d = as.character(seq(1, 99, 7)), x1 = seq(0.1, 1.5, 0.1), x2 = seq(0.2, 1.6, 0.1), y1 = rep(1, 15), y2 = rep(1.1, 15), colors = colors) color_label <- data.frame(x = c(0.1, 0.8, 1.6), y = rep(0.95, 3), score = c(0, 0.5, 1)) @@ -944,7 +947,15 @@ server <- shinyServer(function(input, output, session) { print(p1) }) ##Anchor Heatmap overlayed on selected peptide sequences - output$anchorPlot <- renderPlot({ + anchorPlotHeight <- reactive({ + if (is.null(df$metricsData)) { + return(0) + } + peptide_data <- df$metricsData[[selectedID()]]$good_binders[[selectedTranscriptSet()]]$`peptides` + peptide_names <- names(peptide_data) + (length(peptide_names)) * 2 * 15 + }) + observe({output$anchorPlot <- renderPlot({ if (is.null(df$metricsData)) { return() } @@ -964,7 +975,7 @@ server <- shinyServer(function(input, output, session) { peptide_data[[peptide_names[[i]]]]$individual_el_percentile_calls <- NULL } peptide_data <- as.data.frame(peptide_data) - p1 <- ggplot() + scale_x_continuous(limits = c(0, 80)) + scale_y_continuous(limits = c(-31, 1)) + p1 <- ggplot() + scale_x_continuous(limits = c(0, 80)) + scale_y_continuous(limits = c((length(peptide_names) * 2 + 1) * -1, 1)) all_peptides <- list() incProgress(0.1) for (i in 1:length(peptide_names)) { @@ -1028,7 +1039,7 @@ server <- shinyServer(function(input, output, session) { print(p1) } }) - }, height = 400, width = 800) + }, height = anchorPlotHeight(), width = 800)}) #anchor score tables for each HLA allele output$anchorWeights<- renderDT({ withProgress(message = "Loading Anchor Weights Table", value = 0, { diff --git a/pvactools/tools/pvacview/ui.R b/pvactools/tools/pvacview/ui.R index 59ff09d9..7f71e7c0 100644 --- a/pvactools/tools/pvacview/ui.R +++ b/pvactools/tools/pvacview/ui.R @@ -224,9 +224,9 @@ explore_tab <- tabItem( fluidRow( column(width = 6, div(style = 'overflow-y:scroll;height: 500px;', - h4("Allele specific anchor prediction heatmap for top 15 candidates in peptide table."), - h5("HLA allele specific anchor predictions overlaying good-binding peptide sequences generated from each specific transcript.", br(), - " Current version supports the first 15 MT/WT peptide sequence pairs (first 30 rows of the peptide table)."), br(), + h4("Allele specific anchor prediction heatmap for the candidates in peptide table."), + h5("HLA allele specific anchor predictions overlaying candidate peptide sequences for selected transcript set."), + br(), plotOutput(outputId = "peptideFigureLegend", height = "50px"), plotOutput(outputId = "anchorPlot") )