Closed freestatman closed 6 years ago
See the following test Shiny code.
library(shiny) library(ideogRam) # ---------------------------------------------------------------------------- # ideogRam shiny example: reactivity is not working: # ---------------------------------------------------------------------------- server <- function(input, output) { get_config <- reactive({ ideo_01_config <- list( organism = "human", orientation = "horizontal", chromosome = as.character(input$chr), ## here is the issue.... annotations = list( list( name = "xxx", chr = "2", start = 34294, stop = 125482 ), list( name = "BRCA1", chr = "17", start = 43125400, stop = 43125482 ) ) ) }) ideo_02_config <- list( organism = "human", annotationsPath = "https://unpkg.com/ideogram@0.9.0/dist/data/annotations/10_virtual_cnvs.json", annotationsLayout = "overlay" ) output$ideo_01 <- renderIdeogRam({ ideo_01_config <- get_config() p <- ideogRam(data = ideo_01_config, message = NULL, elementId = "ideo_01") # elementId has to be the same with output$ obj name p$elementId <- 'test_id1' p }) output$ideo_02 <- renderIdeogRam({ p <- ideogRam(data = ideo_02_config, message = NULL, elementId = "ideo_02") # elementId has to be the same with output$ obj name p$elementId <- 'test_id2' p }) } ui <- shinyUI(fluidPage( titlePanel("Hello IdeogRam!"), sidebarPanel( width = 2, numericInput("chr", "Chromosome:", 4, min = 1, max = 26) ), mainPanel( ideogRamOutput("ideo_01"), ideogRamOutput("ideo_02") ) )) runApp(list(ui = ui, server = server)) `
Fixed in (https://github.com/wangtulao/ideogRam/commit/d33e6852f8779d53fe07d543e6c43e7c38cbe929) by @Marlin-Na
See the following test Shiny code.