This works very well but my problem is now how to save all selected genes because after a new search all selected genes will be discarded. Furthermore, I would like to introduce a "Clear Genes" button to reset the selection. The final step should be the calculation of a heat map of all saved selected genes.
Here's my ui.R:
library(shiny)
library(gsubfn)
library(stringr)
shinyUI(fluidPage(
titlePanel("Heat Map"),
sidebarPanel(
selectizeInput(
'e0', 'Cells:', choices = as.character(cells[,1]), multiple = TRUE,
selected = list("s1","s2","s3")),
textInput("nameSearch", "Search for gene name", "SEPT"),
uiOutput("selectUI"),
br(),
actionButton("decrease","Clear Genes"),
helpText("Save selected genes for subsequent calculation or clear data."),
br(),
uiOutput("actual_value"),
br(),
submitButton("Submit Calculation"),
helpText("Please choose at least two cells and two genes to calculate a Heat Map!")
),
mainPanel(
textOutput("text"),
plotOutput("expressionPlot")
)
)
)
shinyServer(function(input, output, session) {searchResult<- reactive({partners[grep(input$nameSearch, partners$name), ]#subset(partners, grepl(input$nameSearch, partners$name))})output$searchResult <- renderTable({searchResult()[,1]})output$selectUI <- renderUI({selectizeInput("var", "Click in and select genes",choices=as.character(searchResult()[,1]), multiple=TRUE, selected=list("SEPT1","SEPT2","SEPT3") )})blah <- reactive({selectizeInput("var", "Click in and select genes",choices=as.character(searchResult()[,1]), multiple=TRUE, selected=list("SEPT1","SEPT2","SEPT3") )})newBlah <- reactive({autoInvalidate()extract <- str_extract_all(blah(), 'selected>[a-zA-Z0-9_-]*<')newExtract <- gsub('selected>','',extract)gsub('<','', newExtract)})output$actual_value <- renderUI({if (input$decrease >0) {varNew <<- list("-")}else {autoInvalidate()varNew <<- newBlah()}autoInvalidate()paste("Actual value is: ", varNew)})output$expressionPlot <- renderPlot({blah <- data.matrix(dat0[input$partnerName,input$e0])if(nrow(blah)<2 || ncol(blah)<2) {# print error/ warning messageoutput$text <- renderText({paste("Please select at least two cells and two genes!")})} else {output$text <- renderText({paste("")})heatmap(blah)}})})
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/51a6097c-c614-4a80-b829-9c08da43a542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.