From 36160ad1735f252cceff4b0900535cf8c743de01 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Mon, 31 Jul 2023 19:33:35 +0200 Subject: [PATCH 01/10] Move anchor heatmap to the Transcript Set Detailed Data panel --- pvactools/tools/pvacview/ui.R | 38 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/pvactools/tools/pvacview/ui.R b/pvactools/tools/pvacview/ui.R index 9972e406b..27a401d73 100644 --- a/pvactools/tools/pvacview/ui.R +++ b/pvactools/tools/pvacview/ui.R @@ -185,6 +185,21 @@ explore_tab <- tabItem( tabBox(width = 12, title = " ", tabPanel("Peptide Candidates from Selected Transcript Set", DTOutput("peptideTable") %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;font-size:100%"), + tabPanel("Anchor Heatmap", + column(width = 6, + h4("Allele specific anchor prediction heatmap for top 20 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(), + plotOutput(outputId = "peptideFigureLegend", height = "50px"), + plotOutput(outputId = "anchorPlot", height = "500px") + ) %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;", + column(width = 6, + h4("Anchor vs Mutation position Scenario Guide", + img(src = "https://github.com/griffithlab/pVACtools/raw/master/pvactools/tools/pvacview/www/anchor.jpg", + align = "center", height = "500px") + ) + ) + ), tabPanel("Transcripts in Set", DTOutput("transcriptsTable") %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;font-size:100%") ) @@ -192,13 +207,15 @@ explore_tab <- tabItem( ), fluidRow( box(width = 12, title = "Additional Peptide Information", status = "primary", solidHeader = TRUE, collapsible = TRUE, - tabBox(title = " ", id = "info", + tabBox(width = 12, title = " ", id = "info", tabPanel("IC50 Plot", h4("Violin Plots showing distribution of MHC IC50 predictions for selected peptide pair (MT and WT)."), + h5("Showcases individual binding prediction scores from each algorithm used. A solid line is used to represent the median score."), plotOutput(outputId = "bindingData_IC50") %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;" ), tabPanel("%ile Plot", h4("Violin Plots showing distribution of MHC percentile predictions for selected peptide pair (MT and WT)."), + h5("Showcases individual percentile scores from each algorithm used. A solid line is used to represent the median percentile score."), plotOutput(outputId = "bindingData_percentile") %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;" ), tabPanel("Binding Data", @@ -218,25 +235,6 @@ explore_tab <- tabItem( strong("NetMHCpanEL / NetMHCIIpanEL"), span(": A predictor trained on eluted ligand data. ("), a(href = "https://academic.oup.com/nar/article/48/W1/W449/5837056", "Citation"), span(")"), style = "overflow-x: scroll;" - ), - tabPanel("Anchor Heatmap", - h4("Allele specific anchor prediction heatmap for top 20 candidates in peptide table."), - plotOutput(outputId = "peptideFigureLegend", height = "50px"), - plotOutput(outputId = "anchorPlot") %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;" - ) - ), - box( - column(width = 4, - h4("Allele Specific Anchor Prediction Heatmap"), - h5(" This tab displays 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("MHC Binding Prediction Scores"), - h5(" This tab contains violin plots that showcase individual binding prediction scores from each algorithm used. A solid line is used to represent the median score.") - ), - column(width = 8, - box(title = "Anchor vs Mutation position Scenario Guide", collapsible = TRUE, collapsed = FALSE, width = 12, - img(src = "https://github.com/griffithlab/pVACtools/raw/master/pvactools/tools/pvacview/www/anchor.jpg", - align = "center", height = "350px", width = "600px"), style = "overflow-x: scroll;") ) ) ) From 71f52dbd85c63e1cbeb53dce62d2206cc4e3cbed Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Thu, 3 Aug 2023 16:32:20 +0200 Subject: [PATCH 02/10] Rename Transcript Set Detailed Data panel in pVACview --- pvactools/tools/pvacview/ui.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvactools/tools/pvacview/ui.R b/pvactools/tools/pvacview/ui.R index 27a401d73..65b61e3dd 100644 --- a/pvactools/tools/pvacview/ui.R +++ b/pvactools/tools/pvacview/ui.R @@ -181,7 +181,7 @@ explore_tab <- tabItem( ) ), fluidRow( - box(width = 12, title = "Transcript Set Detailed Data", solidHeader = TRUE, collapsible = TRUE, status = "primary", + box(width = 12, title = "Transcript and Peptide Set Data", solidHeader = TRUE, collapsible = TRUE, status = "primary", tabBox(width = 12, title = " ", tabPanel("Peptide Candidates from Selected Transcript Set", DTOutput("peptideTable") %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;font-size:100%"), From 5b0999187163a5f8511bf056cec6da6398babae7 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 13 Feb 2024 15:19:41 -0600 Subject: [PATCH 03/10] Remove Show X entries dropdown from binding and elution data tables --- pvactools/tools/pvacview/server.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pvactools/tools/pvacview/server.R b/pvactools/tools/pvacview/server.R index 1c10e6722..4a43bc8a8 100644 --- a/pvactools/tools/pvacview/server.R +++ b/pvactools/tools/pvacview/server.R @@ -992,7 +992,7 @@ server <- shinyServer(function(input, output, session) { incProgress(1) dtable <- datatable(binding_reformat, options = list( pageLength = 10, - lengthMenu = c(10), + lengthChange = FALSE, rowCallback = JS("function(row, data, index, rowId) {", "if(((rowId+1) % 4) == 3 || ((rowId+1) % 4) == 0) {", 'row.style.backgroundColor = "#E0E0E0";', "}", "}") @@ -1056,7 +1056,7 @@ server <- shinyServer(function(input, output, session) { incProgress(1) dtable <- datatable(elution_reformat, options = list( pageLength = 10, - lengthMenu = c(10), + lengthChange = FALSE, rowCallback = JS("function(row, data, index, rowId) {", "if(((rowId+1) % 4) == 3 || ((rowId+1) % 4) == 0) {", 'row.style.backgroundColor = "#E0E0E0";', "}", "}") From f124d85eb0bfbd24cc783fbec8670deda69af6fa Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 13 Feb 2024 15:19:59 -0600 Subject: [PATCH 04/10] Update header for elution data table --- pvactools/tools/pvacview/ui.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvactools/tools/pvacview/ui.R b/pvactools/tools/pvacview/ui.R index 4af0d3653..9ee3d1231 100644 --- a/pvactools/tools/pvacview/ui.R +++ b/pvactools/tools/pvacview/ui.R @@ -223,7 +223,7 @@ explore_tab <- tabItem( DTOutput(outputId = "bindingDatatable"), style = "overflow-x: scroll;" ), tabPanel("Elution and Immunogenicity Data", - h4("Prediction score table showing exact MHC binding values for elution and percentile calculations."), + h4("Prediction score table showing exact MHC scpres for elution, immunogenicity, and percentile calculations."), DTOutput(outputId = "elutionDatatable"), br(), strong("MHCflurryEL Processing"), span(': An "antigen processing" predictor that attempts to model MHC allele-independent effects such as proteosomal cleavage. ('), From f70bfcc7832be6fd9fe3b8c122197bfb418dcc80 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 13 Feb 2024 15:54:03 -0600 Subject: [PATCH 05/10] Display pVACtools version on the bottom of the sidebar menu --- pvactools/tools/pvacview/server.R | 2 ++ pvactools/tools/pvacview/ui.R | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pvactools/tools/pvacview/server.R b/pvactools/tools/pvacview/server.R index 4a43bc8a8..afa143220 100644 --- a/pvactools/tools/pvacview/server.R +++ b/pvactools/tools/pvacview/server.R @@ -18,6 +18,8 @@ options(shiny.host = '0.0.0.0') options(shiny.port = 3333) server <- shinyServer(function(input, output, session) { + ## pVACtools version + output$version <- renderText({"pVACtools version 4.0.8"}) ##############################DATA UPLOAD TAB################################### ## helper function defined for generating shinyInputs in mainTable (Evaluation dropdown menus) diff --git a/pvactools/tools/pvacview/ui.R b/pvactools/tools/pvacview/ui.R index 9ee3d1231..72ba09384 100644 --- a/pvactools/tools/pvacview/ui.R +++ b/pvactools/tools/pvacview/ui.R @@ -607,7 +607,8 @@ ui <- dashboardPage( menuItem("Tutorials", tabName = "tutorial", startExpanded = TRUE, icon = icon("fas fa-book-open")), menuItem("pVACview Documentation", icon = icon("fas fa-file-invoice"), href = "https://pvactools.readthedocs.io/en/latest/pvacview.html"), menuItem("Submit Github Issue", tabName = "contact", icon = icon("far fa-question-circle")) - ) + ), + div(textOutput("version"), style="margin-left:20px;position:fixed;bottom:20px;color:#b8c7ce") ), body = dashboardBody( use_theme(mytheme), From d75a597472ebf85e2776ef01d8ab12d8410adfd0 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Wed, 14 Feb 2024 10:10:44 -0600 Subject: [PATCH 06/10] Improve anchor heatmap display --- pvactools/tools/pvacview/server.R | 6 +++--- pvactools/tools/pvacview/ui.R | 16 +++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pvactools/tools/pvacview/server.R b/pvactools/tools/pvacview/server.R index afa143220..b3d4bb80a 100644 --- a/pvactools/tools/pvacview/server.R +++ b/pvactools/tools/pvacview/server.R @@ -881,8 +881,8 @@ server <- shinyServer(function(input, output, session) { incProgress(0.2) p1 <- p1 + geom_rect(data = all_peptides_multiple_hla, aes(xmin = x_pos - 0.5, xmax = 1 + x_pos - 0.5, ymin = .5 + y_pos, ymax = -.5 + y_pos), fill = all_peptides_multiple_hla$color_value) + - geom_text(data = all_peptides_multiple_hla, aes(x = x_pos, y = y_pos, label = aa, color = mutation), size = 5) + - geom_text(data = hla_data, aes(x = x_pos, y = y_pos, label = hla), size = 5, fontface = "bold") + + geom_text(data = all_peptides_multiple_hla, aes(x = x_pos, y = y_pos, label = aa, color = mutation), size = 4) + + geom_text(data = hla_data, aes(x = x_pos, y = y_pos, label = hla), size = 4, fontface = "bold") + geom_line(data = h_line_pos, (aes(x = x_pos, y = y_pos, group = y_pos)), linetype = "dashed") p1 <- p1 + scale_color_manual("mutation", values = c("not_mutated" = "#000000", "mutated" = "#e74c3c")) p1 <- p1 + theme_void() + theme(legend.position = "none", panel.border = element_blank()) @@ -894,7 +894,7 @@ server <- shinyServer(function(input, output, session) { print(p1) } }) - }, height = 500, width = 1000) + }, height = 400, width = 800) ##updating IC50 binding score for selected peptide pair bindingScoreDataIC50 <- reactive({ if (is.null(df$metricsData)) { diff --git a/pvactools/tools/pvacview/ui.R b/pvactools/tools/pvacview/ui.R index 72ba09384..2952ca005 100644 --- a/pvactools/tools/pvacview/ui.R +++ b/pvactools/tools/pvacview/ui.R @@ -187,16 +187,18 @@ explore_tab <- tabItem( DTOutput("peptideTable") %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;font-size:100%"), tabPanel("Anchor Heatmap", column(width = 6, - h4("Allele specific anchor prediction heatmap for top 20 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(), - plotOutput(outputId = "peptideFigureLegend", height = "50px"), - plotOutput(outputId = "anchorPlot", height = "500px") - ) %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;", + div(style = 'overflow-y:scroll;height: 500px;', + h4("Allele specific anchor prediction heatmap for top 20 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(), + plotOutput(outputId = "peptideFigureLegend", height = "50px"), + plotOutput(outputId = "anchorPlot") + ) + ) %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll; overflow-y: scroll", column(width = 6, h4("Anchor vs Mutation position Scenario Guide", img(src = "https://github.com/griffithlab/pVACtools/raw/master/pvactools/tools/pvacview/www/anchor.jpg", - align = "center", height = "500px") + align = "center", width = "100%") ) ) ), From a18ea70847b5d5998fe215fef2be336a9ed0f467 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Thu, 15 Feb 2024 10:02:48 -0600 Subject: [PATCH 07/10] Add anchor weights table --- .../pvacview/anchor_and_helper_functions.R | 37 ++++++++++++++++++ pvactools/tools/pvacview/server.R | 16 +++++++- pvactools/tools/pvacview/ui.R | 38 ++++++++++++------- 3 files changed, 76 insertions(+), 15 deletions(-) diff --git a/pvactools/tools/pvacview/anchor_and_helper_functions.R b/pvactools/tools/pvacview/anchor_and_helper_functions.R index 74d7ced4f..b8290e803 100644 --- a/pvactools/tools/pvacview/anchor_and_helper_functions.R +++ b/pvactools/tools/pvacview/anchor_and_helper_functions.R @@ -1,5 +1,6 @@ library(RCurl) library(curl) +library(data.table) ## Load Anchor data anchor_data <- list() @@ -80,6 +81,42 @@ peptide_coloring <- function(hla_allele, peptide_row) { colors <- colorRampPalette(c("lightblue", "blue"))(99)[value_bins] return(colors[[position]]) } +#calculate per-length anchor score for HLA allele +anchor_weights_for_alleles <- function(hla_alleles) { + scores_df <- data.frame() + for (hla_allele in hla_alleles) { + if (any(hla_allele == anchor_data[[8]]["HLA"])) { + eight_mer_scores <- append(anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][1:(8 + 1)], "9mer", 1) + } + else { + eight_mer_scores <- c(hla_allele, "8mer") + } + if (any(hla_allele == anchor_data[[9]]["HLA"])) { + nine_mer_scores <- append(anchor_data[[9]][anchor_data[[9]]["HLA"] == hla_allele][1:(9 + 1)], "9mer", 1) + } + else { + nine_mer_scores <- c(hla_allele, "9mer") + } + if (any(hla_allele == anchor_data[[10]]["HLA"])) { + ten_mer_scores <- append(anchor_data[[10]][anchor_data[[10]]["HLA"] == hla_allele][1:(10 + 1)], "10mer", 1) + } + else { + ten_mer_scores <- c(hla_allele, "8mer") + } + if (any(hla_allele == anchor_data[[11]]["HLA"])) { + eleven_mer_scores <- append(anchor_data[[11]][anchor_data[[11]]["HLA"] == hla_allele][1:(11 + 1)], "11mer", 1) + } + else { + eleven_mer_scores <- c(hla_allele, "8mer") + } + scores <- list(eight_mer_scores, nine_mer_scores, ten_mer_scores, eleven_mer_scores) + scores <- lapply(scores, `length<-`, 13) + scores <- transpose(data.frame(scores)) + colnames(scores) <- c("HLA Allele", "Peptide Length", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11") + scores_df <- rbind(scores_df, scores) + } + return(scores_df) +} #calculate anchor list for specific peptide length and HLA allele combo given contribution cutoff calculate_anchor <- function(hla_allele, peptide_length, anchor_contribution) { result <- tryCatch({ diff --git a/pvactools/tools/pvacview/server.R b/pvactools/tools/pvacview/server.R index b3d4bb80a..3a32b869a 100644 --- a/pvactools/tools/pvacview/server.R +++ b/pvactools/tools/pvacview/server.R @@ -742,7 +742,7 @@ server <- shinyServer(function(input, output, session) { } }) ##display peptide table with coloring - output$peptideTable <- renderDT({ + output$peptideTable<- renderDT({ withProgress(message = "Loading Peptide Table", value = 0, { if (length(df$metricsData[[selectedID()]]$sets) != 0 & !is.null(df$metricsData)) { peptide_data <- df$metricsData[[selectedID()]]$good_binders[[selectedTranscriptSet()]]$`peptides` @@ -895,6 +895,20 @@ server <- shinyServer(function(input, output, session) { } }) }, height = 400, width = 800) + #anchor score tables for each HLA allele + output$anchorWeights<- renderDT({ + withProgress(message = "Loading Anchor Weights Table", value = 0, { + weights <- anchor_weights_for_alleles(df$metricsData$alleles) + dtable <- datatable(weights, options = list( + pageLength = 10, + lengthChange = FALSE, + rowCallback = JS("function(row, data, index, rowId) {", + "if(((rowId+1) % 4) == 3 || ((rowId+1) % 4) == 0) {", + 'row.style.backgroundColor = "#E0E0E0";', "}", "}") + )) + dtable + }) + }) ##updating IC50 binding score for selected peptide pair bindingScoreDataIC50 <- reactive({ if (is.null(df$metricsData)) { diff --git a/pvactools/tools/pvacview/ui.R b/pvactools/tools/pvacview/ui.R index 2952ca005..0edec6930 100644 --- a/pvactools/tools/pvacview/ui.R +++ b/pvactools/tools/pvacview/ui.R @@ -186,24 +186,34 @@ explore_tab <- tabItem( tabPanel("Peptide Candidates from Selected Transcript Set", DTOutput("peptideTable") %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;font-size:100%"), tabPanel("Anchor Heatmap", - column(width = 6, - div(style = 'overflow-y:scroll;height: 500px;', - h4("Allele specific anchor prediction heatmap for top 20 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(), - plotOutput(outputId = "peptideFigureLegend", height = "50px"), - plotOutput(outputId = "anchorPlot") + fluidRow( + column(width = 6, + div(style = 'overflow-y:scroll;height: 500px;', + h4("Allele specific anchor prediction heatmap for top 20 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(), + plotOutput(outputId = "peptideFigureLegend", height = "50px"), + plotOutput(outputId = "anchorPlot") + ) + ) %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll; overflow-y: scroll", + column(width = 6, + h4("Anchor vs Mutation position Scenario Guide", + img(src = "https://github.com/griffithlab/pVACtools/raw/master/pvactools/tools/pvacview/www/anchor.jpg", + align = "center", width = "100%") + ) ) - ) %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll; overflow-y: scroll", - column(width = 6, - h4("Anchor vs Mutation position Scenario Guide", - img(src = "https://github.com/griffithlab/pVACtools/raw/master/pvactools/tools/pvacview/www/anchor.jpg", - align = "center", width = "100%") + ), + fluidRow( + box(width = 12, title = "Anchor Weights", solidHeader = TRUE, collapsible = TRUE, status = "primary", collapsed = TRUE, + DTOutput("anchorWeights") %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll" ) ) ), - tabPanel("Transcripts in Set", - DTOutput("transcriptsTable") %>% withSpinner(color = "#8FCCFA"), style = "overflow-x: scroll;font-size:100%") + tabPanel( + "Transcripts in Set", + DTOutput("transcriptsTable") %>% withSpinner(color = "#8FCCFA"), + style = "overflow-x: scroll;font-size:100%" + ) ) ) ), From 6299b16e2ef3cfbae7c71d8ba61cc6724e9135f7 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Mon, 19 Feb 2024 08:48:39 -0600 Subject: [PATCH 08/10] Add box showing current tiering parameters --- pvactools/tools/pvacview/server.R | 40 ++++++++++++ pvactools/tools/pvacview/ui.R | 100 ++++++++++++++++++++---------- 2 files changed, 107 insertions(+), 33 deletions(-) diff --git a/pvactools/tools/pvacview/server.R b/pvactools/tools/pvacview/server.R index 3a32b869a..f60be8cb4 100644 --- a/pvactools/tools/pvacview/server.R +++ b/pvactools/tools/pvacview/server.R @@ -421,6 +421,46 @@ server <- shinyServer(function(input, output, session) { ) } ) + output$currentParamTable <- renderTable( + data <- data.frame( + "Parameter" = c("VAF Clonal", "VAF Subclonal", "Allele Expression for Passing Variants", + "Binding Threshold", "Binding Threshold for Inclusion into Metrics File", "Maximum TSL", + "Percentile Threshold", "Allele Specific Binding Thresholds", + "MT Top Score Metric", "WT Top Score Metric", + "Allele Specific Anchors Used", "Anchor Contribution Threshold"), + "Value" = c( + df$dna_cutoff, + df$dna_cutoff / 2, + df$allele_expr, + df$binding_threshold, + df$metricsData$`aggregate_inclusion_binding_threshold`, + df$metricsData$maximum_transcript_support_level, + if (is.null(df$percentile_threshold) || is.na(df$percentile_threshold)) {"NULL"}else { df$percentile_threshold}, + df$use_allele_specific_binding_thresholds, + df$metricsData$mt_top_score_metric, + df$metricsData$wt_top_score_metric, + df$allele_specific_anchors, df$anchor_contribution) + ), digits = 3 + ) + output$currentBindingParamTable <- renderTable( + if (df$use_allele_specific_binding_thresholds) { + data <- data.frame( + "HLA Alleles" = df$metricsData$alleles, + "Binding Cutoffs" = unlist(lapply(df$metricsData$alleles, function(x) { + if (x %in% names(df$metricsData$allele_specific_binding_thresholds)) { + df$metricsData$allele_specific_binding_thresholds[[x]] + } else { + df$binding_threshold + } + } + ))) + } else { + data <- data.frame( + "HLA Alleles" = df$metricsData$alleles, + "Binding Cutoffs" = unlist(lapply(df$metricsData$alleles, function(x) df$binding_threshold)) + ) + } + ) output$comment_text <- renderUI({ if (is.null(df$mainTable)) { return(HTML("N/A")) diff --git a/pvactools/tools/pvacview/ui.R b/pvactools/tools/pvacview/ui.R index 0edec6930..8009dffca 100644 --- a/pvactools/tools/pvacview/ui.R +++ b/pvactools/tools/pvacview/ui.R @@ -83,39 +83,73 @@ explore_tab <- tabItem( tags$script(HTML("Shiny.addCustomMessageHandler('unbind-DT', function(id) { Shiny.unbindAll($('#'+id).find('table').DataTable().table().node()); })")), - box(width = 6, - title = "Advanced Options: Regenerate Tiering with different parameters", - status = "primary", solidHeader = TRUE, collapsible = TRUE, collapsed = TRUE, - "*Please note that the metrics file is required in order to regenerate tiering information with different parameters", br(), - "Current version of pVACseq results defaults to positions 1, 2, n-1 and n (for a n-mer peptide) when determining anchor positions. - If you would like to use our allele specific anchor results and regenerate the tiering results for your variants, - please specify your contribution cutoff and submit for recalculation. ", tags$a(href = "https://www.biorxiv.org/content/10.1101/2020.12.08.416271v1", "More details can be found here.", target = "_blank"), br(), - uiOutput("allele_specific_anchors_ui"), - uiOutput("anchor_contribution_ui"), - uiOutput("binding_threshold_ui"), - uiOutput("allele_specific_binding_ui"), - uiOutput("percentile_threshold_ui"), - uiOutput("dna_cutoff_ui"), - uiOutput("allele_expr_ui"), - h5("For further explanations on these inputs, please refer to the ", tags$a(href = "https://pvactools.readthedocs.io/en/latest/pvacview/getting_started.html#visualize-and-explore", "pVACview documentation.", target = "_blank")), - actionButton("submit", "Recalculate Tiering with new parameters"), - style = "overflow-x: scroll;font-size:100%"), - box(width = 3, - title = "Original Parameters for Tiering", - status = "primary", solidHeader = TRUE, collapsible = TRUE, - column(width = 12, - h5("These are the original parameters used in the tiering calculations extracted from the metrics data file given as input."), - tableOutput("paramTable"), - tableOutput("bindingParamTable"), style = "height:250px; overflow-y: scroll;overflow-x: scroll;"), - actionButton("reset_params", "Reset to original parameters"), - style = "overflow-x: scroll;font-size:100%"), - box(width = 3, - title = "Add Comments for selected variant", - status = "primary", solidHeader = TRUE, collapsible = TRUE, - textAreaInput("comments", "Please add/update your comments for the variant you are currently examining", value = ""), - actionButton("comment", "Update Comment Section"), - h5("Comment:"), htmlOutput("comment_text"), - style = "font-size:100%") + column(width = 6, + box(width = 12, + title = "Advanced Options: Regenerate Tiering with different parameters", + status = "primary", solidHeader = TRUE, collapsible = TRUE, collapsed = TRUE, + "*Please note that the metrics file is required in order to regenerate tiering information with different parameters", br(), + "Current version of pVACseq results defaults to positions 1, 2, n-1 and n (for a n-mer peptide) when determining anchor positions. + If you would like to use our allele specific anchor results and regenerate the tiering results for your variants, + please specify your contribution cutoff and submit for recalculation. ", tags$a(href = "https://www.biorxiv.org/content/10.1101/2020.12.08.416271v1", "More details can be found here.", target = "_blank"), br(), + uiOutput("allele_specific_anchors_ui"), + uiOutput("anchor_contribution_ui"), + uiOutput("binding_threshold_ui"), + uiOutput("allele_specific_binding_ui"), + uiOutput("percentile_threshold_ui"), + uiOutput("dna_cutoff_ui"), + uiOutput("allele_expr_ui"), + h5("For further explanations on these inputs, please refer to the ", tags$a(href = "https://pvactools.readthedocs.io/en/latest/pvacview/getting_started.html#visualize-and-explore", "pVACview documentation.", target = "_blank")), + actionButton("submit", "Recalculate Tiering with new parameters"), + style = "overflow-x: scroll;font-size:100%"), + style = "padding:0px;" + ), + column(width = 3, + fluidRow( + box(width = 12, + title = "Original Parameters for Tiering", + status = "primary", solidHeader = TRUE, collapsible = TRUE, collapsed = TRUE, + column(width = 12, + h5("These are the original parameters used in the tiering calculations extracted from the metrics data file given as input."), + tableOutput("paramTable"), + tableOutput("bindingParamTable"), + style = "height:250px; overflow-y: scroll;overflow-x: scroll;" + ), + style = "font-size:100%" + ) + ), + fluidRow( + box(width = 12, + title = "Current Parameters for Tiering", + status = "primary", solidHeader = TRUE, collapsible = TRUE, collapsed = FALSE, + column(width = 12, + h5("These are current parameters used in the tiering calculaions which may be different from the original parameters if candidates were re-tiered."), + tableOutput("currentParamTable"), + tableOutput("currentBindingParamTable"), + style = "height:250px; overflow-y: scroll;overflow-x: scroll;" + ), + style = "font-size:100%" + ) + ), + fluidRow( + column( + width = 12, + actionButton("reset_params", "Reset to original parameters", style = "width: 100%"), + align = "center", + style = "padding-bottom: 20px" + ) + ), + style = "padding:0px;" + ), + column(width = 3, + box(width = 12, + title = "Add Comments for selected variant", + status = "primary", solidHeader = TRUE, collapsible = TRUE, + textAreaInput("comments", "Please add/update your comments for the variant you are currently examining", value = ""), + actionButton("comment", "Update Comment Section"), + h5("Comment:"), htmlOutput("comment_text"), + style = "font-size:100%"), + style = "padding:0px;" + ) ), fluidRow( box(width = 12, From 4d8b2875736cdd82e67e949fbd2c5c8bd935c67d Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Mon, 19 Feb 2024 12:40:59 -0600 Subject: [PATCH 09/10] By default, select the transcript set in with the best transcript in the Transcript Sets of Selected Variant --- pvactools/tools/pvacview/server.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pvactools/tools/pvacview/server.R b/pvactools/tools/pvacview/server.R index f60be8cb4..c51e20276 100644 --- a/pvactools/tools/pvacview/server.R +++ b/pvactools/tools/pvacview/server.R @@ -715,10 +715,11 @@ server <- shinyServer(function(input, output, session) { transcript_set <- lapply(transcript_set, function(x) strsplit(x, "-")[[1]][1]) if (best_transcript %in% transcript_set) { best_transcript_set <- df$metricsData[[selectedID()]]$sets[i] + best_transcript_set_id <- i } } incProgress(0.5) - datatable(GB_transcripts, selection = list(mode = "single", selected = "1"), style="bootstrap") %>% + datatable(GB_transcripts, selection = list(mode = "single", selected = best_transcript_set_id), style="bootstrap") %>% formatStyle("Transcripts Sets", backgroundColor = styleEqual(c(best_transcript_set), c("#98FF98"))) }else { GB_transcripts <- data.frame("Transcript Sets" = character(), "# Transcripts" = character(), "# Peptides" = character(), "Total Expr" = character()) From d7274b641eef1e818e04eac6608f30ceb0e4eab3 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 20 Feb 2024 14:57:50 -0600 Subject: [PATCH 10/10] Apply suggestions from code review --- pvactools/tools/pvacview/anchor_and_helper_functions.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pvactools/tools/pvacview/anchor_and_helper_functions.R b/pvactools/tools/pvacview/anchor_and_helper_functions.R index b8290e803..f488d4341 100644 --- a/pvactools/tools/pvacview/anchor_and_helper_functions.R +++ b/pvactools/tools/pvacview/anchor_and_helper_functions.R @@ -86,7 +86,7 @@ anchor_weights_for_alleles <- function(hla_alleles) { scores_df <- data.frame() for (hla_allele in hla_alleles) { if (any(hla_allele == anchor_data[[8]]["HLA"])) { - eight_mer_scores <- append(anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][1:(8 + 1)], "9mer", 1) + eight_mer_scores <- append(anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][1:(8 + 1)], "8mer", 1) } else { eight_mer_scores <- c(hla_allele, "8mer") @@ -101,13 +101,13 @@ anchor_weights_for_alleles <- function(hla_alleles) { ten_mer_scores <- append(anchor_data[[10]][anchor_data[[10]]["HLA"] == hla_allele][1:(10 + 1)], "10mer", 1) } else { - ten_mer_scores <- c(hla_allele, "8mer") + ten_mer_scores <- c(hla_allele, "10mer") } if (any(hla_allele == anchor_data[[11]]["HLA"])) { eleven_mer_scores <- append(anchor_data[[11]][anchor_data[[11]]["HLA"] == hla_allele][1:(11 + 1)], "11mer", 1) } else { - eleven_mer_scores <- c(hla_allele, "8mer") + eleven_mer_scores <- c(hla_allele, "11mer") } scores <- list(eight_mer_scores, nine_mer_scores, ten_mer_scores, eleven_mer_scores) scores <- lapply(scores, `length<-`, 13)