Skip to content

Commit

Permalink
added dropdown to select plots of doseresponse
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad1991 committed Nov 14, 2024
1 parent e143bc2 commit 9269b24
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 95 deletions.
26 changes: 26 additions & 0 deletions .development/ESY_Labs.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
output: html_document
---

## Overview

- 1. Describe DOE in Excel
* Number of parameters
* Boundaries of parameters
- 2. Rscript
* generates DOE matrix
- 3. TPA sends DOE matrix back to ELN
- 4. User collects DOE matrix via chemotion python API using the Device computer
- 5. Device measures samples and sends results back to ELN via Inbox (via Shuttle)

## Alternative

- 1. Describe DOE in Excel
* Number of parameters
* Boundaries of parameters
- 2. Rscript
* generates DOE matrix
* uses python API to generate one reaction variation per row in the DOE matrix
- 3. User collects Reaction variation via python API
- 4. Device measures samples and sends results back to ELN via Inbox (via Shuttle)
- 5. Maybe, python API can link the results with the respective Reaction variation
Binary file removed Rplots.pdf
Binary file not shown.
1 change: 0 additions & 1 deletion Start_Serverless_App.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Sys.setenv(RUN_MODE = "BROWSER")
library(bs)
app <- bs::app()
shiny::shinyApp(app$ui, app$server)
28 changes: 28 additions & 0 deletions bs/R/DoseResponse.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ DoseResponseUI <- function(id) {
tabPanel("Results Table",
tableOutput(NS(id, "dr_result"))),
tabPanel("Results Plot",
uiOutput(NS(id, "dropdown_plots")),
plotOutput(NS(id, "dr_result_plot")),
actionButton(NS(id, "previousPage"), "Previous plot"),
actionButton(NS(id, "nextPage"), "Next plot")
Expand All @@ -58,6 +59,7 @@ DoseResponseServer <- function(id, data, listResults) {

r_vals <- reactiveValues(
plots = NULL,
names = NULL, # For dropdown_plots
currentPage = 1
)

Expand Down Expand Up @@ -217,6 +219,8 @@ DoseResponseServer <- function(id, data, listResults) {
print_noti(!is.null(data$formula), "You have to set a formula")
req(!is.null(data$formula))
r_vals$plots <- NULL # reset
r_vals$names <- NULL # reset
r_vals$currentPage <- 1 # reset
f <- as.character(data$formula)
dep <- f[2]
indep <- f[3]
Expand Down Expand Up @@ -246,6 +250,7 @@ DoseResponseServer <- function(id, data, listResults) {
resP <- resP[!is.null(resP)]
resP <- resP[!sapply(resP, is.null)]
r_vals$plots <- resP
r_vals$names <- resDF$name
resPlot <- resP
})
if (inherits(e, "try-error")) {
Expand All @@ -269,6 +274,29 @@ DoseResponseServer <- function(id, data, listResults) {
output$dr_result_plot <- renderPlot(r_vals$plots[[r_vals$currentPage]])
})

output[["dropdown_plots"]] <- renderUI({
req(!is.null(r_vals$plots))
req(is.list(r_vals$plots))
req(length(r_vals$plots) > 1)
req(!is.null(r_vals$names))
req(length(r_vals$names) > 1)
selectInput(
inputId = "DOSERESPONSE-dropdown_plots",
label = "Select plot",
choices = r_vals$names,
selected = r_vals$names[1]
)
})

observeEvent(input$dropdown_plots, {
req(!is.null(r_vals$plots))
req(is.list(r_vals$plots))
req(length(r_vals$plots) > 1)
req(!is.null(r_vals$names))
req(length(r_vals$names) > 1)
r_vals$currentPage <- which(input$dropdown_plots == r_vals$names)
})

observeEvent(input$nextPage, {
req(!is.null(r_vals$plots))
req(is.list(r_vals$plots))
Expand Down
87 changes: 0 additions & 87 deletions data.html

This file was deleted.

7 changes: 0 additions & 7 deletions deploy.R

This file was deleted.

0 comments on commit 9269b24

Please sign in to comment.