Search
Question: I am trying to plot from a check box for fcs file in a reactive environment
0
gravatar for ramsnvenkat
4 months ago by
ramsnvenkat0 wrote:

my ui code is

    

rm(list = ls())

library(shiny)
library(flowCore)


shinyUI(fluidPage(
  titlePanel("Quality Control for Flow Cytometry Data"),
  
  fluidRow(
    column(3,
           fileInput('fcsFiles', strong('Choose fcs file(s):'), multiple = TRUE, 
                     accept = c('text/fcs', '.fcs')),
           
           actionButton("goButton", "Submit!"),
           hr(),
           
           
           ## sample limits: 50
           uiOutput("sample_select"),
           
           lapply(1:50, function(i) {
             uiOutput(paste0('timeSlider', i))
          }),
           
           hr(),
           uiOutput(outputId= "marker_select"),
         
          uiOutput(outputId= "marker_select121"),
           hr()
          
          
    ),
  
  
 sidebarPanel(
  
   
  numericInput("num1", label = h6("WBC COUNT"), value = 1,min = 0, max = NA, step = NA),
  
  hr(),
  fluidRow(column(3, verbatimTextOutput("wbc"))),
  
  numericInput("num2", label = h6("lymphocyte percentage"), value = 1,min = 0, max = NA, step = NA),
  
  hr(),
  
  fluidRow(column(3, verbatimTextOutput("lymphocyte"))),
 
  textOutput("ablymph"),
  uiOutput(outputId= "xaxis"),
  hr(),
  uiOutput(outputId= "yaxis"),
  hr(),
 
  actionButton("goButton", "Submit!")
 ),
    mainPanel(
      plotOutput("fowardside"),
    
      plotOutput("cd3plot"),
      plotOutput("cd4plot"),
      plotOutput("meplot"),
      plotOutput("cd8plot")
      
    )
  )
))

and my server.r code is

r

rm(list = ls())


library(flowCore)
library(shiny)
library(flowViz)
library(flowStats)

shinyServer(function(input, output,session) {
  
  output$ablymph <- renderText({
    W <- input$num1
    L <- input$num2
    x <- W*(L/100)
    paste("Absolute Lymphocytes Count is =", x)
  })
  
  set <- reactive({
    if (input$goButton == 0)
      return()
    isolate({fcsFiles<- input$fcsFiles
    if (is.null(fcsFiles))
      return (NULL)
    set <- read.flowSet(fcsFiles$datapath)
    sampleNames(set)<- fcsFiles$name})
    return(set)
    print(set)
  })
  
  
  output$sample_select <- renderUI({
    if(is.null(set())){
      return(NULL)
    }else{
      
      checkboxGroupInput('samples', strong('Select samples:'), 
                         sampleNames(set()), selected = sampleNames(set()))
    }   
  }) 
  markerNames <- reactive({
    if(is.null(set()))
      return(NULL)
    pd <- set()[[1]]@parameters@data
    markers <- paste("<", pd$name, ">:", pd$desc, sep = "")
    return(markers)
  })
  
  output$marker_select <- renderUI({
    if(is.null(markerNames())){
      return(NULL)
    }else{
      radioButtons(inputId = 'paras', label = ('Select markers for X-AXIS:'), 
                         choices =  markerNames(), selected = )
    }   
    
  })
    
  output$marker_select121 <- renderUI({
    if(is.null(markerNames())){
      return(NULL)
    }else{
      radioButtons(inputId = 'paras1', label = ('Select markers for Y-AXIS:'), 
                         choices =  markerNames(), selected = NULL)
    }   
   
  
  })
  output$filetable <- renderTable({
    data1<- set()[[1]]@parameters@data
    return(data1)
  })
  output$cd3plot<-renderPlot({
    plot(set()[[1]]@parameters@data1[paras],set()[[1]]@parameters@data1[paras1])
   
     
  })
   
  })

 

i am not able to fine out how do I plot the different check box values are stores and plot them, can any one please help me. I am trying to learn it for my project. thanks in advance

ver code is 

 

 

R
ADD COMMENTlink modified 4 months ago by James W. MacDonald44k • written 4 months ago by ramsnvenkat0
0
gravatar for James W. MacDonald
4 months ago by
United States
James W. MacDonald44k wrote:

Shiny isn't a Bioconductor package, so this isn't the correct support forum for your question. I presume that the RStudio folks have some sort of listserv or whatnot that you could use, or perhaps you could try stackoverflow.

ADD COMMENTlink written 4 months ago by James W. MacDonald44k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 150 users visited in the last hour