diff --git a/scripts/functions/tests/test_bp_subcolours_i.R b/scripts/functions/tests/test_bp_subcolours_i.R new file mode 100644 index 0000000..d8c1b42 --- /dev/null +++ b/scripts/functions/tests/test_bp_subcolours_i.R @@ -0,0 +1,59 @@ +#!/usr/bin/env Rscript +#source("~/git/Misc/shiny/myshiny/gid_data.R") + +source("~/git/LSHTM_analysis/config/gid.R") +source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R") +source("~/git/LSHTM_analysis/scripts/functions/bp_subcolours.R") + +# p1 +bp_stability_hmap(plotdf = merged_df3 + , stability_colname = "duet_scaled" + , stability_outcome_colname = "duet_outcome" + , p_title = "DUET" ) + +# p2 +bp_stability_hmap(plotdf = merged_df3 + , stability_colname = "foldx_scaled" + , stability_outcome_colname = "foldx_outcome" + , p_title = "FoldX" ) + +# p3 +bp_stability_hmap(plotdf = merged_df3 + , stability_colname = "deepddg_scaled" + , stability_outcome_colname = "deepddg_outcome" + , p_title = "DeepDDG" ) + +################################################## + +merged_df3_f = merged_df3 + +setDT(merged_df3_f)[, pos_count := .N, by = position] + +################################################## +ui <- basicPage( + plotOutput("plot1", click = "plot_click"), + verbatimTextOutput("info") +) + +server <- function(input, output) { + output$plot1 <- renderPlot({ + + #plot(mtcars$wt, mtcars$mpg) + bp_stability_hmap(plotdf = merged_df3_f + , xvar_colname = "position" + , stability_colname = "foldx_scaled" + , stability_outcome_colname = "foldx_outcome" + , p_title = "FoldX" ) + + }) + + output$info <- renderPrint({ + # With base graphics, need to tell it what the x and y variables are. + nearPoints(merged_df3_f, input$plot_click + , xvar = "position" + , yvar = "pos_count" + ) + }) +} + +shinyApp(ui, server) \ No newline at end of file