1
$\begingroup$

I am trying to code a shiny app for RNA-Seq data analysis.

I would like to include glimma interactive plots in it. However, in my current interface, clicking the action button Glimma plot opens the glimma interface in a new page of my web browser and not in the shiny UI.

I use shiny, glimma and EdgeR. Here is my code:

ui <- fluidPage(
  actionButton(inputId="run.glimma", label="Glimma plot"),
  htmlOutput("glimma")


server <- function(input, output, session){
  observeEvent(input$run.glimma, {
    glMDSPlot(dgeObj.norm(), labels=rownames(dgeObj.norm()$samples), groups=dgeObj.norm()$samples[,as.character(input$mds.grouping.feature)])
  }),

  output$glimma <- renderUI({
      includeHTML("glimma-plots/MDS-Plot.html")
    })
}

I only indicated the part of the code that I use to generate the glimma MDS plot.

Is there a way to display the glimma plots in the shiny app UI and not in a new webpage ?

Thank you

$\endgroup$

1 Answer 1

2
$\begingroup$

I have come across this page today with same query. After visiting here and there, finally following approach helped to resolve this issue. I must confess that I am just a beginner to R Shiny.

Lets say we have ui.R, server.R and global.R.

Inside global.R, add following code:

glimmaMDSOutput <- function(outputId, width = "100%", height = "400px") {
        htmlwidgets::shinyWidgetOutput(outputId, 'glimmaMDS', width, height, package = 'Glimma')
}

renderglimmaMDS <- function(expr, env = parent.frame(), quoted = FALSE) {
        if (!quoted) { expr <- substitute(expr) }
        htmlwidgets::shinyRenderWidget(expr, glimmaMDSOutput, env, quoted = TRUE)
}

Inside ui.R, add following:

glimmaMDSOutput(outputId = 'MDSplot')

**Inside server.R, add following:**
output$MDSplot <- renderglimmaMDS({
                Glimma::glimmaMDS(x = .., labels = .., groups = .., top = .., gene.selection = "pairwise", launch = FALSE, html = NULL, width = 1000, height = 500);
})
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.