inst/shiny-scripts/app.R

# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (C) 2021  Kevin Lu

library(shiny)

ui <- basicPage(
  titlePanel("Epigene lite"),
  mainPanel(
    p(paste(
      "This app may not work out of the box due to the size of the sample dataset.",
      "Please download the tarball from",
      "https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE55491",
      "and extract the IDAT files into the same directory as the CSV sample sheet",
      "in extdata/"
      )),
    p("Note that the plot may take some time to render."),
    plotOutput("pca", click = "pca_click"),
    verbatimTextOutput("info")
  )
)

server <- function(input, output) {
  grset <- read_idat("../extdata/GSE55491/samplesheet.rss-GSE55491.csv")

  output$pca <- renderPlot({
    pca_plot(grset)
  })

  # TODO: show sample sheet details of the nearest sample
  output$info <- renderText({
    paste0("x=", input$pca_click$x, "\ny=", input$pca_click$y)
  })
}

shinyApp(ui, server)

# [END]
kevinlul/EpigeneLite documentation built on Dec. 21, 2021, 6:35 a.m.