SGDDNB / ShinyCell

Shiny Interactive Web Apps for Single-Cell Data
GNU General Public License v3.0
148 stars 57 forks source link

ShinyCell Multi: Can I make another tab to display the UMAPS from two different tabs? #44

Open shamsbhuiyan opened 2 years ago

shamsbhuiyan commented 2 years ago

Hi,

So I have two different single cell datasets that I am displaying on two different tabs on ShinyCell. I figured I could just hard code a new tabPanel() and insert these two functions in the same tab panel: fluidRow(column(12, uiOutput("sc1a3oup1.ui"))), and fluidRow(column(12, uiOutput("sc1a3oup1.ui"))),. However, when I do this, it prevents all the other UMAPs/visualizations from displaying. Any advice about how I should approach this task/problem?

jfouyang commented 2 years ago

Hey, it seems that Shiny itself doesn't like it when you uiOutput two of the same outputs i.e. "sc1a3oup1.ui" at the same time. There is a hack around this: you can duplicate the output in both ui.R and server.R. For example, if you want to duplicate "sc1a1oup1.ui"...

In ui.R, add:

            ) 
          ) 
        ), 
        fluidRow(column(12, uiOutput("sc1a1oup1.ui"))), 
##### NEW LINE TO ADD #####
        fluidRow(column(12, uiOutput("sc1a1oup1v2.ui"))), 
##### NEW LINE TO ADD #####
        downloadButton("sc1a1oup1.pdf", "Download PDF"), 
        downloadButton("sc1a1oup1.png", "Download PNG"), br(), 

In server.R, add:

  output$sc1a1oup1.ui <- renderUI({ 
    plotOutput("sc1a1oup1", height = pList[input$sc1a1psz]) 
  }) 
##### NEW LINE TO ADD #####
  output$sc1a1oup1v2 <- renderPlot({ 
    scDRcell(sc1conf, sc1meta, input$sc1a1drX, input$sc1a1drY, input$sc1a1inp1,  
             input$sc1a1sub1, input$sc1a1sub2, 
             input$sc1a1siz, input$sc1a1col1, input$sc1a1ord1, 
             input$sc1a1fsz, input$sc1a1asp, input$sc1a1txt, input$sc1a1lab1) 
  }) 
  output$sc1a1oup1v2.ui <- renderUI({ 
    plotOutput("sc1a1oup1v2", height = pList[input$sc1a1psz]) 
  }) 
##### NEW LINE TO ADD #####
  output$sc1a1oup1.pdf <- downloadHandler( 
    filename = function() { paste0("sc1",input$sc1a1drX,"_",input$sc1a1drY,"_",  
                                   input$sc1a1inp1,".pdf") }, 
jfouyang commented 2 years ago

So basically, you need to:

Vimalajeno commented 1 year ago

Hi, Thanks for the shinycell app. What should I do if I want to display both conditions on a single page and I have two datasets, such as ctrl and mutant? For example, I'd like to see both heatmaps of the conditions on the same page...