Answers.Body: <p>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.</p>
  <p>Lets say we have ui.R, server.R and global.R.</p>
  <p><strong>Inside global.R, add following code:</strong></p>
  <pre><code>glimmaMDSOutput &lt;- function(outputId, width = &quot;100%&quot;, height = &quot;400px&quot;) {
          htmlwidgets::shinyWidgetOutput(outputId, 'glimmaMDS', width, height, package = 'Glimma')
  }
  
  renderglimmaMDS &lt;- function(expr, env = parent.frame(), quoted = FALSE) {
          if (!quoted) { expr &lt;- substitute(expr) }
          htmlwidgets::shinyRenderWidget(expr, glimmaMDSOutput, env, quoted = TRUE)
  }
  </code></pre>
  <p><strong>Inside ui.R, add following:</strong></p>
  <pre><code>glimmaMDSOutput(outputId = 'MDSplot')
  
  **Inside server.R, add following:**
  output$MDSplot &lt;- renderglimmaMDS({
                  Glimma::glimmaMDS(x = .., labels = .., groups = .., top = .., gene.selection = &quot;pairwise&quot;, launch = FALSE, html = NULL, width = 1000, height = 500);
  })
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-28T15:39:23.780Z
Answers.LastActivityDate: 2022-09-28T16:27:52.547Z
Answers.LastEditDate: 2022-09-28T16:27:52.547Z
Answers.UserDisplayName: SrikantPVerma
Body: <p>I am trying to code a shiny app for RNA-Seq data analysis.</p>
  
  <p>I would like to include glimma interactive plots in it. 
  However, in my current interface, clicking the action button <code>Glimma plot</code> opens the glimma interface in a new page of my web browser and not in the shiny UI.</p>
  
  <p>I use <code>shiny</code>, <code>glimma</code> and <code>EdgeR</code>. Here is my code:</p>
  
  <pre><code>ui &lt;- fluidPage(
    actionButton(inputId="run.glimma", label="Glimma plot"),
    htmlOutput("glimma")
  
  
  server &lt;- function(input, output, session){
    observeEvent(input<span class="math-container">$run.glimma, {
      glMDSPlot(dgeObj.norm(), labels=rownames(dgeObj.norm()$samples), groups=dgeObj.norm()$samples[,as.character(input$</span>mds.grouping.feature)])
    }),
  
    output$glimma &lt;- renderUI({
        includeHTML("glimma-plots/MDS-Plot.html")
      })
  }
  </code></pre>
  
  <p>I only indicated the part of the code that I use to generate the <code>glimma</code> MDS plot.</p>
  
  <p>Is there a way to display the <code>glimma</code> plots in the shiny app UI and not in a new webpage ?</p>
  
  <p>Thank you</p>
  
Tags: <r><rna-seq><bioconductor>
Title: include a glimma interface in a shiny app
ThreadText: # include a glimma interface in a shiny app
  
  (Asked by: username_0 on 2020-01-08)
  
  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
  
  **Tags:** r, rna-seq, bioconductor
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-09-28. Score: 2
  
  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);
  })
  
  ```
  
  
  ---
  
  