Skip to content

Commit

Permalink
Switch to dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
RiboRings committed Nov 29, 2024
1 parent 2919209 commit 39c1782
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 107 deletions.
11 changes: 5 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@ importFrom(scater,runMDS)
importFrom(scater,runPCA)
importFrom(shiny,actionButton)
importFrom(shiny,checkboxInput)
importFrom(shiny,column)
importFrom(shiny,conditionalPanel)
importFrom(shiny,downloadButton)
importFrom(shiny,downloadHandler)
importFrom(shiny,fileInput)
importFrom(shiny,fluidPage)
importFrom(shiny,fluidRow)
importFrom(shiny,isolate)
importFrom(shiny,mainPanel)
importFrom(shiny,modalDialog)
importFrom(shiny,numericInput)
importFrom(shiny,observe)
Expand All @@ -62,17 +59,19 @@ importFrom(shiny,req)
importFrom(shiny,selectInput)
importFrom(shiny,showModal)
importFrom(shiny,showNotification)
importFrom(shiny,sidebarLayout)
importFrom(shiny,sidebarPanel)
importFrom(shiny,sliderInput)
importFrom(shiny,tabPanel)
importFrom(shiny,tabsetPanel)
importFrom(shiny,textInput)
importFrom(shiny,titlePanel)
importFrom(shiny,updateNumericInput)
importFrom(shiny,updateSelectInput)
importFrom(shiny,verbatimTextOutput)
importFrom(shiny,wellPanel)
importFrom(shinydashboard,box)
importFrom(shinydashboard,dashboardBody)
importFrom(shinydashboard,dashboardHeader)
importFrom(shinydashboard,dashboardPage)
importFrom(shinydashboard,dashboardSidebar)
importFrom(shinyjs,disable)
importFrom(shinyjs,enable)
importFrom(stats,as.formula)
Expand Down
212 changes: 111 additions & 101 deletions R/landing_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
#' @keywords internal

#' @rdname landing_page
#' @importFrom shiny actionButton fluidPage titlePanel sidebarLayout column
#' sidebarPanel mainPanel tabPanel tabsetPanel renderUI selectInput
#' @importFrom shiny actionButton tabPanel tabsetPanel renderUI selectInput
#' sliderInput textInput wellPanel fluidRow reactiveValues radioButtons
#' numericInput fileInput checkboxInput verbatimTextOutput downloadButton
#' conditionalPanel
#' @importFrom shinydashboard dashboardPage dashboardHeader dashboardSidebar
#' dashboardBody box
#' @importFrom shinyjs disable
#' @importFrom utils data
.landing_page <- function(FUN, input, output, session) {
Expand All @@ -24,30 +25,33 @@

output$allPanels <- renderUI({

fluidPage(
dashboardPage(

fluidRow(column(4, wellPanel(id = "import.panel",

titlePanel("Import"),

dashboardHeader(disable = TRUE),
dashboardSidebar(disable = TRUE),
dashboardBody(

fluidRow(box(id = "import.panel", title = "Import", width = 4,
status = "primary", solidHeader = TRUE,

tabsetPanel(id = "format",

tabPanel(title = "Dataset", value = "dataset",
tabPanel(title = "Dataset", value = "dataset", br(),

selectInput(inputId = "data", label = "Dataset:",
choices = mia_datasets,
selected = mia_datasets[1])

),

tabPanel(title = "R Object", value = "rds",
tabPanel(title = "R Object", value = "rds", br(),

fileInput(inputId = "file", label = "RDS:",
accept = ".rds")

),

tabPanel(title = "Raw Data", value = "raw",
tabPanel(title = "Raw Data", value = "raw", br(),

fileInput(inputId = "assay", label = "Assays:",
accept = ".csv", multiple = TRUE),
Expand All @@ -60,7 +64,7 @@

),

tabPanel(title = "Foreign", value = "foreign",
tabPanel(title = "Foreign", value = "foreign", br(),

radioButtons(inputId = "ftype",
label = "Type:", choices = list("biom", "QZA",
Expand Down Expand Up @@ -97,134 +101,132 @@
actionButton("import", "Upload", class = "btn-success",
style = .actionbutton_biocstyle)

)),
),

column(4, wellPanel(id = "manipulate.panel",

titlePanel("Manipulate"),

tabsetPanel(id = "manipulate",
box(id = "manipulate.panel", title = "Manipulate", width = 4,
status = "primary", solidHeader = TRUE,

tabsetPanel(id = "manipulate",

tabPanel(title = "Subset", value = "subset",
tabPanel(title = "Subset", value = "subset", br(),

radioButtons(inputId = "subkeep", label = "Keep:",
choices = c("prevalent", "rare"), inline = TRUE),
radioButtons(inputId = "subkeep", label = "Keep:",
choices = c("prevalent", "rare"), inline = TRUE),

selectInput(inputId = "subassay", label = "Assay:",
choices = NULL),
selectInput(inputId = "subassay", label = "Assay:",
choices = NULL),

sliderInput(inputId = "prevalence", value = 0,
label = "Prevalence threshold:", step = 0.01,
min = 0, max = 1),
sliderInput(inputId = "prevalence", value = 0,
label = "Prevalence threshold:", step = 0.01,
min = 0, max = 1),

numericInput(inputId = "detection", value = 0,
label = "Detection threshold:", min = 0, step = 1)
numericInput(inputId = "detection", value = 0,
label = "Detection threshold:", min = 0, step = 1)

),
),

tabPanel(title = "Agglomerate", value = "agglomerate",
tabPanel(title = "Agglomerate", value = "agglomerate", br(),

selectInput(inputId = "taxrank",
label = "Taxonomic rank:", choices = NULL)
selectInput(inputId = "taxrank",
label = "Taxonomic rank:", choices = NULL)

),
),

tabPanel(title = "Transform", value = "transform",
tabPanel(title = "Transform", value = "transform", br(),

selectInput(inputId = "assay.type", label = "Assay:",
choices = NULL),
selectInput(inputId = "assay.type", label = "Assay:",
choices = NULL),

selectInput(inputId = "trans.method", label = "Method:",
choices = c("relabundance", "clr", "standardize")),
selectInput(inputId = "trans.method", label = "Method:",
choices = c("relabundance", "clr", "standardize")),

checkboxInput(inputId = "pseudocount",
label = "Pseudocount"),
checkboxInput(inputId = "pseudocount",
label = "Pseudocount"),

textInput(inputId = "assay.name", label = "Name:"),
textInput(inputId = "assay.name", label = "Name:"),

radioButtons(inputId = "margin", label = "Margin:",
choices = c("samples", "features"), inline = TRUE)
radioButtons(inputId = "margin", label = "Margin:",
choices = c("samples", "features"), inline = TRUE)

)),
)

),

actionButton("apply", "Apply", class = "btn-success",
style = .actionbutton_biocstyle)
actionButton("apply", "Apply", class = "btn-success",
style = .actionbutton_biocstyle)

)),
),

column(4, wellPanel(id = "estimate.panel",

titlePanel("Estimate"),

tabsetPanel(id = "estimate",
box(id = "estimate.panel", title = "Estimate", width = 4,
status = "primary", solidHeader = TRUE,

tabsetPanel(id = "estimate",

tabPanel(title = "Alpha", value = "alpha",
tabPanel(title = "Alpha", value = "alpha", br(),

selectInput(inputId = "alpha.assay", label = "Assay:",
choices = NULL),
selectInput(inputId = "alpha.assay", label = "Assay:",
choices = NULL),

selectInput(inputId = "alpha.index", label = "Metric:",
choices = c("coverage", "shannon", "faith"),
multiple = TRUE),
selectInput(inputId = "alpha.index", label = "Metric:",
choices = c("coverage", "shannon", "faith"),
multiple = TRUE),

textInput(inputId = "alpha.name", label = "Name:")
textInput(inputId = "alpha.name", label = "Name:")

),
),

tabPanel(title = "Beta", value = "beta",
tabPanel(title = "Beta", value = "beta", br(),

radioButtons(inputId = "bmethod", label = "Method:",
choices = c("MDS", "NMDS", "PCA", "RDA"),
inline = TRUE),
radioButtons(inputId = "bmethod", label = "Method:",
choices = c("MDS", "NMDS", "PCA", "RDA"),
inline = TRUE),

selectInput(inputId = "beta.assay", label = "Assay:",
choices = NULL),
selectInput(inputId = "beta.assay", label = "Assay:",
choices = NULL),

conditionalPanel(
condition = "input.bmethod != 'PCA'",

selectInput(inputId = "beta.index", label = "Metric:",
choices = c("euclidean", "bray", "jaccard", "unifrac")),
),

conditionalPanel(
condition = "input.bmethod == 'RDA'",

textInput(inputId = "rda.formula", label = "Formula:",
placeholder = "data ~ var1 + var2 * var3"),
),
conditionalPanel(
condition = "input.bmethod != 'PCA'",

selectInput(inputId = "beta.index", label = "Metric:",
choices = c("euclidean", "bray", "jaccard", "unifrac")),
),

numericInput(inputId = "ncomponents", value = 5,
label = "Number of components:", min = 1, step = 1),
conditionalPanel(
condition = "input.bmethod == 'RDA'",

textInput(inputId = "rda.formula", label = "Formula:",
placeholder = "data ~ var1 + var2 * var3"),
),

textInput(inputId = "beta.name", label = "Name:")

)
numericInput(inputId = "ncomponents", value = 5,
label = "Number of components:", min = 1, step = 1),

textInput(inputId = "beta.name", label = "Name:")

)

),
),

actionButton("compute", "Compute", class = "btn-success",
style = .actionbutton_biocstyle)
actionButton("compute", "Compute", class = "btn-success",
style = .actionbutton_biocstyle)

))),
)),

fluidRow(column(4, wellPanel(id = "visualise.panel",

titlePanel("Visualise"),

fluidRow(box(id = "visualise.panel", title = "Visualise", width = 4,
status = "primary", solidHeader = TRUE,

selectInput(inputId = "panels", label = "Panels:",
choices = c(default_panels, other_panels),
multiple = TRUE, selected = c(default_panels)),

actionButton("launch", "Launch iSEE", class = "btn-success",
style = .actionbutton_biocstyle)

)),

column(8, wellPanel(id = "output.panel",

titlePanel("Output"),
),

box(id = "output.panel", title = "Output", width = 8,
status = "primary", solidHeader = TRUE,

verbatimTextOutput(outputId = "object"),

downloadButton(outputId = "download", label = "Download",
Expand All @@ -248,12 +250,20 @@

observe({
.print_message(
title = "Welcome to the Microbiome Analysis Dashboard!",
"miaDash is actively maintained, so we are happy to receive",
"feedback from you. Feature requests, bug reports and other",
"comments can be submitted",
title = "Welcome to the Microbiome Analysis Dashboard! 🦠",
"miaDash is actively maintained by the",
tags$a(href = "https://datascience.utu.fi/",
"Turku Data Science Group", target = "_blank", .noWS = "after"),
", so we are happy to receive feedback from you. Feature requests,",
"bug reports and other comments can be submitted",
tags$a(href = "https://github.com/microbiome/miaDash/issues",
"here", target = "_blank", .noWS = "after"), ".",
"here", target = "_blank", .noWS = "after"), HTML(".<br/><br/>"),
"If you are new here, you can learn how to use the app with",
tags$a(href = "https://microbiome.github.io/miaDash/articles/miaDash.html",
"this short tutorial", target = "_blank", .noWS = "after"),
". Technical support can be obtained on",
tags$a(href = "https://app.gitter.im/#/room/#microbiome_miaverse:gitter.im",
"our Gitter channel", target = "_blank", .noWS = "after"), "."
)
})

Expand Down

0 comments on commit 39c1782

Please sign in to comment.