diff --git a/DESCRIPTION b/DESCRIPTION index e4c8b23..23508ca 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: miaDash -Version: 0.99.9 +Version: 0.99.11 Authors@R: c(person(given = "Giulio", family = "Benedetti", role = c("aut", "cre"), email = "giulio.benedetti@utu.fi", @@ -27,7 +27,7 @@ Imports: ape, biomformat, htmltools, - iSEEtree, + iSEEtree (>= 1.1.4), mia, rintrojs, scater, @@ -42,6 +42,7 @@ Imports: Suggests: BiocStyle, knitr, + philr, remotes, rmarkdown, testthat (>= 3.0.0) diff --git a/R/constants.R b/R/constants.R index 0c04442..28014b5 100644 --- a/R/constants.R +++ b/R/constants.R @@ -1,19 +1,23 @@ #' Constants #' -#' Constant values used throughout miaDash panels and extensions. +#' Constant values used throughout the miaDash app. #' #' @section Panel layout: #' \describe{ #' \item{\code{.miaDashDefaultPanels}}{List of panel names in the default layout of miaDash.} #' \item{\code{.miaDashOtherPanels}}{List of panel names not in the default layout of miaDash.} +#' \item{\code{.transformMethods}}{List of transformations applicable to assays.} +#' \item{\code{.alphaMetrics}}{List of alpha diversity metrics.} +#' \item{\code{.betaMetrics}}{List of beta diversity metrics.} +#' \item{\code{.betaMethods}}{List of beta diversity methods.} #' } #' #' @author Giulio Benedetti #' #' @keywords internal #' @name constants -#' @aliases .miaDashDefaultPanels -#' .miaDashOtherPanels +#' @aliases .miaDashDefaultPanels .miaDashOtherPanels .transformMethods +#' .alphaMetrics .betaMetrics .betaMethods NULL #' @rdname constants @@ -24,4 +28,26 @@ NULL #' @rdname constants .miaDashOtherPanels <- c("PrevalencePlot", "RDAPlot", "ScreePlot", "LoadingPlot", "ColumnTreePlot", "RowGraphPlot", "ColumnGraphPlot", - "RowDataPlot", "ColumnDataPlot") \ No newline at end of file + "RowDataPlot", "ColumnDataPlot") + +#' @rdname constants +.transformMethods <- c("alr", "chi.square", "clr", "css", "frequency", + "hellinger", "log", "log10", "log2", "max", "normalize", "pa",# "philr", + "range", "rank", "rclr", "relabundance", "rrank", "standardize", "total") + +#' @rdname constants +.alphaMetrics <- c("coverage_diversity", "fisher_diversity", "faith_diversity", + "gini_simpson_diversity", "inverse_simpson_diversity", + "log_modulo_skewness_diversity", "shannon_diversity", "absolute_dominance", + "dbp_dominance", "core_abundance_dominance", "gini_dominance", + "dmn_dominance", "relative_dominance", "simpson_lambda_dominance", + "camargo_evenness", "pielou_evenness", "simpson_evenness", "evar_evenness", + "bulla_evenness", "ace_richness", "chao1_richness", "hill_richness", + "observed_richness") + +#' @rdname constants +.betaMetrics <- c("euclidean", "bray", "jaccard", "unifrac") + +#' @rdname constants +.betaMethods <- c("MDS", "NMDS", "PCA", "RDA") +#"TSNE", "UMAP") \ No newline at end of file diff --git a/R/landing_page.R b/R/landing_page.R index 17ed6c9..02eaf71 100644 --- a/R/landing_page.R +++ b/R/landing_page.R @@ -141,8 +141,7 @@ label = "Assay:", choices = NULL), selectInput(inputId = "trans.method", - label = "Method:", choices = c("relabundance", - "clr", "standardize")), + label = "Method:", choices = .transformMethods), checkboxInput(inputId = "pseudocount", label = "Pseudocount"), @@ -168,20 +167,21 @@ selectInput(inputId = "alpha.index", label = "Metric:", multiple = TRUE, - choices = c("coverage", "shannon", "faith"))), + choices = .alphaMetrics)), tabPanel(title = "Beta", value = "beta", - radioButtons(inputId = "bmethod", label = "Method:", - choices = c("MDS", "NMDS", "PCA", "RDA"), + radioButtons(inputId = "bmethod", + label = "Method:", choices = .betaMethods, inline = TRUE), conditionalPanel( - condition = "input.bmethod != 'PCA'", + condition = paste("input.bmethod == 'MDS' || ", + "input.bmethod == 'NMDS' || ", + "input.bmethod == 'RDA'"), selectInput(inputId = "beta.index", - label = "Metric:", choices = c("euclidean", - "bray", "jaccard", "unifrac"))), + label = "Metric:", choices = .betaMetrics)), conditionalPanel( condition = "input.bmethod == 'RDA'", diff --git a/R/miaDash.R b/R/miaDash.R index c803750..b08f707 100644 --- a/R/miaDash.R +++ b/R/miaDash.R @@ -34,8 +34,7 @@ miaDash <- function() { paste0("Microbiome Analysis Dashboard - v", packageVersion("miaDash")), tags$img(src = "assets/mia_logo.png", height = "40px", style = "margin-left: 10px"), style = "cursor: pointer; font-weight: 500", - onclick = "window.location='https://miadash-microbiome.2.rahtiapp.fi/'") - + onclick = "window.location='https://miadash-microbiome.2.rahtiapp.fi/'") ) } diff --git a/R/observers.R b/R/observers.R index d69116c..0eadd66 100644 --- a/R/observers.R +++ b/R/observers.R @@ -152,17 +152,6 @@ }) } else if( input$manipulate == "transform" ){ - - if( input$trans.method == "clr" && !input$pseudocount && - any(assay(rObjects$tse, input$assay.type) <= 0)){ - - .print_message( - "'clr' cannot be used with non-positive data:", - "please turn on pseudocount." - ) - - return() - } isolate({ req(input$assay.type) @@ -177,6 +166,11 @@ method = input$trans.method, assay.type = input$assay.type, MARGIN = input$margin, pseudocount = input$pseudocount) + #if( input$trans.method == "philr" ){ + # fun_args <- c(fun_args, tree = list(rowTree(rObjects$tse)), + # node.labels = rowTree(tse)$node.label) + #} + rObjects$tse <- .update_tse( rObjects$tse, transformAssay, fun_args ) diff --git a/man/constants.Rd b/man/constants.Rd index 4a1dea4..1a128d4 100644 --- a/man/constants.Rd +++ b/man/constants.Rd @@ -5,25 +5,49 @@ \alias{constants} \alias{.miaDashDefaultPanels} \alias{.miaDashOtherPanels} +\alias{.transformMethods} +\alias{.alphaMetrics} +\alias{.betaMetrics} +\alias{.betaMethods} \title{Constants} \format{ An object of class \code{character} of length 7. An object of class \code{character} of length 9. + +An object of class \code{character} of length 19. + +An object of class \code{character} of length 23. + +An object of class \code{character} of length 4. + +An object of class \code{character} of length 4. } \usage{ .miaDashDefaultPanels .miaDashOtherPanels + +.transformMethods + +.alphaMetrics + +.betaMetrics + +.betaMethods } \description{ -Constant values used throughout miaDash panels and extensions. +Constant values used throughout the miaDash app. } \section{Panel layout}{ \describe{ \item{\code{.miaDashDefaultPanels}}{List of panel names in the default layout of miaDash.} \item{\code{.miaDashOtherPanels}}{List of panel names not in the default layout of miaDash.} +\item{\code{.transformMethods}}{List of transformations applicable to assays.} +\item{\code{.alphaMetrics}}{List of alpha diversity metrics.} +\item{\code{.betaMetrics}}{List of beta diversity metrics.} +\item{\code{.betaMethods}}{List of beta diversity methods.} } } diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index d9346eb..9e1b0f6 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -1,6 +1,10 @@ destination: docs reference: - title: App +- subtitle: Main - contents: - miaDash +- subtitle: Other +- contents: + - utils - constants \ No newline at end of file