From 12f17ce0de2a180809515d0d75018e8fae3c5fc7 Mon Sep 17 00:00:00 2001 From: Giulio Benedetti Date: Fri, 29 Nov 2024 16:04:40 +0200 Subject: [PATCH] Add htmltools to deps --- DESCRIPTION | 1 + NAMESPACE | 3 + R/landing_page.R | 152 +++++++++++++++++++---------------------------- 3 files changed, 65 insertions(+), 91 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a12c5c9..7eb5286 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,6 +24,7 @@ Depends: iSEE Imports: biomformat, + htmltools, iSEEtree, methods, mia, diff --git a/NAMESPACE b/NAMESPACE index 594f082..560a42a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,6 +13,9 @@ importFrom(TreeSummarizedExperiment,colLinks) importFrom(TreeSummarizedExperiment,rowLinks) importFrom(TreeSummarizedExperiment,rowTree) importFrom(biomformat,read_biom) +importFrom(htmltools,HTML) +importFrom(htmltools,br) +importFrom(htmltools,tags) importFrom(iSEE,ColumnDataTable) importFrom(iSEE,ComplexHeatmapPlot) importFrom(iSEE,ReducedDimensionPlot) diff --git a/R/landing_page.R b/R/landing_page.R index fefc915..36fa601 100644 --- a/R/landing_page.R +++ b/R/landing_page.R @@ -10,12 +10,13 @@ #' @keywords internal #' @rdname landing_page -#' @importFrom shiny actionButton tabPanel tabsetPanel renderUI selectInput -#' sliderInput textInput wellPanel fluidRow reactiveValues radioButtons +#' @importFrom shiny actionButton fluidRow tabPanel tabsetPanel renderUI +#' selectInput sliderInput textInput wellPanel reactiveValues radioButtons #' numericInput fileInput checkboxInput verbatimTextOutput downloadButton #' conditionalPanel #' @importFrom shinydashboard dashboardPage dashboardHeader dashboardSidebar #' dashboardBody box +#' @importFrom htmltools HTML br tags #' @importFrom shinyjs disable #' @importFrom utils data .landing_page <- function(FUN, input, output, session) { @@ -30,7 +31,7 @@ dashboardHeader(disable = TRUE), dashboardSidebar(disable = TRUE), dashboardBody( - + fluidRow(box(id = "import.panel", title = "Import", width = 4, status = "primary", solidHeader = TRUE, @@ -40,16 +41,12 @@ selectInput(inputId = "data", label = "Dataset:", choices = mia_datasets, - selected = mia_datasets[1]) - - ), + selected = mia_datasets[1])), tabPanel(title = "R Object", value = "rds", br(), fileInput(inputId = "file", label = "RDS:", - accept = ".rds") - - ), + accept = ".rds")), tabPanel(title = "Raw Data", value = "raw", br(), @@ -60,9 +57,7 @@ accept = ".csv"), fileInput(inputId = "rowdata", label = "rowData:", - accept = ".csv") - - ), + accept = ".csv")), tabPanel(title = "Foreign", value = "foreign", br(), @@ -81,27 +76,19 @@ label = "Remove taxa prefixes"), checkboxInput(inputId = "rank.from.pref", - label = "Derive taxa from prefixes") - ), + label = "Derive taxa from prefixes")), conditionalPanel( condition = "input.ftype == 'MetaPhlAn'", - fileInput(inputId = "col.data", label = "colData:", - accept = ".tsv"), + fileInput(inputId = "col.data", + label = "colData:", accept = ".tsv"), - fileInput(inputId = "tree.file", label = "Tree:", - accept = ".tree") - ) - - ) - - ), + fileInput(inputId = "tree.file", + label = "Tree:", accept = ".tree")))), actionButton("import", "Upload", class = "btn-success", - style = .actionbutton_biocstyle) - - ), + style = .actionbutton_biocstyle)), box(id = "manipulate.panel", title = "Manipulate", width = 4, status = "primary", solidHeader = TRUE, @@ -111,7 +98,8 @@ tabPanel(title = "Subset", value = "subset", br(), radioButtons(inputId = "subkeep", label = "Keep:", - choices = c("prevalent", "rare"), inline = TRUE), + choices = c("prevalent", "rare"), + inline = TRUE), selectInput(inputId = "subassay", label = "Assay:", choices = NULL), @@ -121,24 +109,24 @@ min = 0, max = 1), numericInput(inputId = "detection", value = 0, - label = "Detection threshold:", min = 0, step = 1) - - ), + label = "Detection threshold:", min = 0, + step = 1)), - tabPanel(title = "Agglomerate", value = "agglomerate", br(), + tabPanel(title = "Agglomerate", value = "agglomerate", + + br(), selectInput(inputId = "taxrank", - label = "Taxonomic rank:", choices = NULL) - - ), + label = "Taxonomic rank:", choices = NULL)), 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"), @@ -146,16 +134,11 @@ textInput(inputId = "assay.name", label = "Name:"), radioButtons(inputId = "margin", label = "Margin:", - choices = c("samples", "features"), inline = TRUE) - - ) - - ), + choices = c("samples", "features"), + inline = TRUE))), actionButton("apply", "Apply", class = "btn-success", - style = .actionbutton_biocstyle) - - ), + style = .actionbutton_biocstyle)), box(id = "estimate.panel", title = "Estimate", width = 4, status = "primary", solidHeader = TRUE, @@ -164,16 +147,14 @@ 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:", multiple = TRUE, + choices = c("coverage", "shannon", "faith")), - textInput(inputId = "alpha.name", label = "Name:") - - ), + textInput(inputId = "alpha.name", label = "Name:")), tabPanel(title = "Beta", value = "beta", br(), @@ -181,60 +162,49 @@ 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")), - ), + 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"), - ), + textInput(inputId = "rda.formula", + label = "Formula:", + placeholder = "data ~ var1 + var2 * var3")), numericInput(inputId = "ncomponents", value = 5, - label = "Number of components:", min = 1, step = 1), + label = "Number of components:", min = 1, + step = 1), - textInput(inputId = "beta.name", label = "Name:") - - ) - - ), + textInput(inputId = "beta.name", label = "Name:"))), actionButton("compute", "Compute", class = "btn-success", - style = .actionbutton_biocstyle) - - )), - - 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)), + style = .actionbutton_biocstyle))), - actionButton("launch", "Launch iSEE", class = "btn-success", - style = .actionbutton_biocstyle) + 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)), - box(id = "output.panel", title = "Output", width = 8, - status = "primary", solidHeader = TRUE, + box(id = "output.panel", title = "Output", width = 8, + status = "primary", solidHeader = TRUE, - verbatimTextOutput(outputId = "object"), - - downloadButton(outputId = "download", label = "Download", - style = .actionbutton_biocstyle) + verbatimTextOutput(outputId = "object"), - )) - )) - }) + downloadButton(outputId = "download", label = "Download", + style = .actionbutton_biocstyle)))))}) ## Disable navbar buttons that are not linked to any observer yet disable("iSEE_INTERNAL_organize_panels") # organize panels @@ -258,7 +228,7 @@ "bug reports and other comments can be submitted", tags$a(href = "https://github.com/microbiome/miaDash/issues", "here", target = "_blank", .noWS = "after"), HTML(".

"), - "If you are new here, you can learn how to use the app with", + "If you are new to this app, you can learn how to use it 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",