Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
transformation_example: use reactive inputs
  • Loading branch information
HendrikSchultheis committed Mar 14, 2019
1 parent fedaaea commit 2701066
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions exec/transformation_example.R
Expand Up @@ -3,21 +3,32 @@ library(shiny)
source("../R/transformation.R")

ui <- fluidPage(
transformationUI(id = "id", transposeOptions = TRUE)
h3("Module UI"),
transformationUI(id = "id", transposeOptions = TRUE),
hr(),
h3("Input parameter"),
numericInput(inputId = "pseudocount", label = "Pseudocount", value = 1),
checkboxInput(inputId = "transpose", label = "Transpose"),
checkboxInput(inputId = "replaceInf", label = "replace Inf with NA", value = TRUE),
checkboxInput(inputId = "replaceNA", label = "replace NA with 0", value = TRUE),
hr(),
h3("Module output"),
verbatimTextOutput(outputId = "module_out")
)

server <- function(input, output) {
data_matrix <- matrix( 0:10, ncol = 10)
data_matrix <- matrix(c(0:9, 0:9), ncol = 10)

data <- reactive({
data_matrix
})

mod <- callModule(transformation, "id", data, transpose = F, pseudocount = 0, replaceInf = T, replaceNA = T)
mod <- callModule(transformation, "id", data, transpose = reactive(input$transpose), pseudocount = reactive(input$pseudocount), replaceInf = reactive(input$replaceInf), replaceNA = reactive(input$replaceNA))

observe({
output$module_out <- renderPrint({
print(mod$method())
print(mod$data())
print(mod$transpose())
})
}

Expand Down

0 comments on commit 2701066

Please sign in to comment.