From 466450bf50825bc5b618f584672746992be60281 Mon Sep 17 00:00:00 2001 From: LTLA Date: Sun, 24 Nov 2024 22:31:13 -0800 Subject: [PATCH 01/10] Avoid unnecessarily scary messages when only one row is available. --- R/AggregatedDotPlot.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/AggregatedDotPlot.R b/R/AggregatedDotPlot.R index 8dbb98d..fd1a9f8 100644 --- a/R/AggregatedDotPlot.R +++ b/R/AggregatedDotPlot.R @@ -429,7 +429,7 @@ setMethod(".generateOutput", "AggregatedDotPlot", function(x, se, all_memory, al # Row clustering. unclustered_cmds <- c(".rownames_ordered <- rev(rownames(.averages))") - if (x[[.ADPClusterFeatures]]) { + if (x[[.ADPClusterFeatures]] && nrow(plot_env$.averages) > 1L) { clustering_cmds <- c( sprintf(".averages_dist <- dist(.averages, method = %s);", deparse(x[[.ADPClusterDistanceFeatures]])), sprintf(".averages_hclust <- hclust(.averages_dist, method = %s);", deparse(x[[.ADPClusterMethodFeatures]])), From f819838be83ae247cba9c9946c2a144919e5bb7f Mon Sep 17 00:00:00 2001 From: LTLA Date: Sun, 24 Nov 2024 22:40:19 -0800 Subject: [PATCH 02/10] Implement .multiSelectionResponsive for AggregateDotPlot. --- R/AggregatedDotPlot.R | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/R/AggregatedDotPlot.R b/R/AggregatedDotPlot.R index fd1a9f8..0a13283 100644 --- a/R/AggregatedDotPlot.R +++ b/R/AggregatedDotPlot.R @@ -157,6 +157,7 @@ #' .definePanelTour,AggregatedDotPlot-method #' .createObservers,AggregatedDotPlot-method #' .refineParameters,AggregatedDotPlot-method +#' .multiSelectResponsive,AggregateDotPlot-method #' initialize,AggregatedDotPlot-method NULL @@ -830,6 +831,19 @@ setMethod(".hideInterface", "AggregatedDotPlot", function(x, field) { } }) +#' @export +setMethod(".multiSelectionResponsive", "AggregatedDotPlot", function(x, dims = character(0)) { + if ("row" %in% dims) { + if (!slot(x, .ADPCustomFeatNames)) { + return(TRUE) + } + } + if ("column" %in% dims) { + return(TRUE) + } + return(FALSE) +}) + #' @export setMethod(".definePanelTour", "AggregatedDotPlot", function(x) { rbind( From 2336c83c324079b684c2fba2c0f9471252e9b821 Mon Sep 17 00:00:00 2001 From: LTLA Date: Sun, 24 Nov 2024 22:54:44 -0800 Subject: [PATCH 03/10] Hide irrelevant parameters: the dot plot always restricts on multi-selections. --- R/AggregatedDotPlot.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/AggregatedDotPlot.R b/R/AggregatedDotPlot.R index 0a13283..c16a400 100644 --- a/R/AggregatedDotPlot.R +++ b/R/AggregatedDotPlot.R @@ -824,7 +824,7 @@ setMethod(".createObservers", "AggregatedDotPlot", function(x, se, input, sessio #' @export setMethod(".hideInterface", "AggregatedDotPlot", function(x, field) { - if (field %in% c(iSEE:::.multiSelectHistory)) { + if (field %in% c(iSEE:::.multiSelectHistory, iSEE:::.selectRowRestrict, iSEE:::.selectColumnRestrict)) { TRUE } else { callNextMethod() From e52e714f5ca1c19349d322bb3cf05b591b75d6a8 Mon Sep 17 00:00:00 2001 From: LTLA Date: Sun, 24 Nov 2024 23:21:24 -0800 Subject: [PATCH 04/10] Implement a cap on the number of rows in the ADP. This prevents the application from choking when it is asked to cluster too many rows, e.g., because the user was careless in the table filtering used to generate the multiple selection. Besides, there's no point making a dot plot where you can't even identify the genes. --- R/AggregatedDotPlot.R | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/R/AggregatedDotPlot.R b/R/AggregatedDotPlot.R index c16a400..fe7145c 100644 --- a/R/AggregatedDotPlot.R +++ b/R/AggregatedDotPlot.R @@ -15,6 +15,12 @@ #' typically corresponding to the row names of the \linkS4class{SummarizedExperiment}. #' Names should be new-line separated within this string. #' Defaults to the name of the first row in the SummarizedExperiment. +#' \item \code{CapMaxRows}, a logical scalar indicating whether to cap the number of features to be shown on the plot. +#' This ensures that the \pkg{iSEE} application does not freeze when asked to cluster a very large selection of rows. +#' Defaults to \code{TRUE}, in which case a notification will be raised if the cap needs to be enforced. +#' \item \code{MaxRows}, an integer specifying the cap on the number of features to be shown on the plot. +#' Only used if \code{CapMaxRows} is set to \code{TRUE}. +#' Defaults to 50. #' } #' #' The following slots control the specification of groups: @@ -165,6 +171,8 @@ NULL .ADPCustomFeatNames <- "CustomRows" .ADPFeatNameText <- "CustomRowsText" .ADPClusterFeatures <- "ClusterRows" +.ADPCapMaxRows <- "CapMaxRows" +.ADPMaxRows <- "MaxRows" .ADPColDataLabel <- "ColumnDataLabel" .ADPColDataFacet <- "ColumnDataFacet" @@ -190,6 +198,8 @@ collated <- character(0) collated[.ADPAssay] <- "character" collated[.ADPCustomFeatNames] <- "logical" collated[.ADPFeatNameText] <- "character" +collated[.ADPCapMaxRows] <- "logical" +collated[.ADPMaxRows] <- "integer" collated[.ADPColDataLabel] <- "character" collated[.ADPColDataFacet] <- "character" @@ -232,6 +242,10 @@ setMethod("initialize", "AggregatedDotPlot", function(.Object, ...) { args <- .emptyDefault(args, .ADPCustomFeatNames, TRUE) args <- .emptyDefault(args, .ADPFeatNameText, NA_character_) + args <- .emptyDefault(args, .ADPCapMaxRows, TRUE) + args <- .emptyDefault(args, .ADPMaxRows, 50L) + args[[.ADPMaxRows]] <- as.integer(args[[.ADPMaxRows]]) + vals <- args[[.ADPFeatNameText]] if (length(vals)!=1L) { args[[.ADPFeatNameText]] <- paste(vals, collapse="\n") @@ -291,9 +305,12 @@ setValidity2("AggregatedDotPlot", function(object) { ) ) + msg <- .validNumberError(msg, object, .ADPMaxRows, 1L, Inf) + msg <- .validLogicalError(msg, object, c( .ADPCustomFeatNames, + .ADPCapMaxRows, .visualParamBoxOpen, .ADPCustomColor, .ADPExpressors, @@ -405,6 +422,12 @@ setMethod(".generateOutput", "AggregatedDotPlot", function(x, se, all_memory, al cmd <- sprintf(".group_by <- SummarizedExperiment::colData(se)[.chosen.columns,%s,drop=FALSE];", paste(deparse(coldata.names), collapse="")) + if (x[[.ADPCapMaxRows]]) { + # Arbitrarily taking the top rows. + # TODO: move this into .extractAssaySubmatrix. + cmd <- c(cmd, sprintf("plot.data <- head(plot.data, %s)", x[[.ADPMaxRows]])) + } + computation <- c(cmd, ".averages.se <- scuttle::sumCountsAcrossCells(plot.data, .group_by, average=TRUE, store.number=NULL);", ".averages <- SummarizedExperiment::assay(.averages.se);", @@ -574,6 +597,17 @@ setMethod(".defineDataInterface", "AggregatedDotPlot", function(x, se, select_in ) }) + .addSpecificTour(class(x), .ADPCapMaxRows, function(plot_name) { + data.frame( + rbind( + c( + element=paste0("#", plot_name, "_", .ADPCapMaxRows), + intro="We can check this box to cap the maximum number of rows to be shown on the plot. This prevents the application from freezing if we ask it to plot too many genes.

Check this box if it isn't already checked." + ) + ) + ) + }) + .addSpecificTour(class(x), .ADPColDataLabel, function(plot_name) { data.frame( element=paste0("#", plot_name, "_", .ADPColDataLabel, " + .selectize-control"), @@ -632,6 +666,14 @@ The clustering itself is done on the group averages using hclust, i actionButton(.input_FUN(.dimnamesModalOpen), label="Edit feature names"), br(), br() ), + .checkboxInput.iSEE(x, .ADPCapMaxRows, label="Cap the maximum number of rows", + value=x[[.ADPCapMaxRows]]), + .conditionalOnCheckSolo( + .input_FUN(.ADPCapMaxRows), + on_select=TRUE, + numericInput(.input_FUN(.ADPMaxRows), label="Maximum number of rows", + value=x[[.ADPMaxRows]], min=1, step=1) + ), .checkboxInput.iSEE(x, .ADPClusterFeatures, label="Cluster rows (on averages)", value=x[[.ADPClusterFeatures]]), .conditionalOnCheckSolo( From 5bc339846f901f0eed85dad6d73a45621a4e77cc Mon Sep 17 00:00:00 2001 From: LTLA Date: Sun, 24 Nov 2024 23:25:17 -0800 Subject: [PATCH 05/10] Added documentation for the clustering parameters. --- R/AggregatedDotPlot.R | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/R/AggregatedDotPlot.R b/R/AggregatedDotPlot.R index fe7145c..903c892 100644 --- a/R/AggregatedDotPlot.R +++ b/R/AggregatedDotPlot.R @@ -58,6 +58,19 @@ #' Defaults to \code{FALSE}. #' } #' +#' The following slots control the clustering of rows: +#' \itemize{ +#' \item \code{ClusterRows}, a logical scalar indicating whether clustering of the rows should be performed, +#' so as to group genes that have more similar average expression profiles across groups. +#' Defaults to \code{FALSE}. +#' \item \code{ClusterRowsDistance}, string specifying the distance metric to use. +#' This can be any one of \code{"euclidean"}, \code{"maximum"}, \code{"manhattan"}, \code{"canberra"}, \code{"binary"}, \code{"minkowski"}, \code{"pearson"}, \code{"spearman"}, or \code{"kendall"}. +#' Defaults to \code{"euclidean"}. +#' \item \code{ClusterRowsMethod}, string specifying a linkage method to use. +#' This can be any one of \code{"ward.D"}, \code{"ward.D2"}, \code{"single"}, \code{"complete"}, \code{"average"}, \code{"mcquitty"}, \code{"median"}, or \code{"centroid"}. +#' Defaults to \code{"ward.D2"}. +#' } +#' #' The following slots control the color: #' \itemize{ #' \item \code{UseCustomColormap}, a logical scalar indicating whether to use a custom color scale. From 282639375b239878ef32e63143d277921386a651 Mon Sep 17 00:00:00 2001 From: LTLA Date: Sun, 24 Nov 2024 23:26:10 -0800 Subject: [PATCH 06/10] Reoxygenated. --- DESCRIPTION | 2 +- NAMESPACE | 1 + man/AggregatedDotPlot.Rd | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4ed9077..81a68f3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -73,6 +73,6 @@ BugReports: https://github.com/iSEE/iSEEu/issues biocViews: ImmunoOncology, Visualization, GUI, DimensionReduction, FeatureExtraction, Clustering, Transcription, GeneExpression, Transcriptomics, SingleCell, CellBasedAssays -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Roxygen: list(markdown = TRUE) VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 730c304..c50606c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -84,6 +84,7 @@ exportMethods(.multiSelectionClear) exportMethods(.multiSelectionCommands) exportMethods(.multiSelectionDimension) exportMethods(.multiSelectionInvalidated) +exportMethods(.multiSelectionResponsive) exportMethods(.panelColor) exportMethods(.prioritizeDotPlotData) exportMethods(.refineParameters) diff --git a/man/AggregatedDotPlot.Rd b/man/AggregatedDotPlot.Rd index dba0903..93527ac 100644 --- a/man/AggregatedDotPlot.Rd +++ b/man/AggregatedDotPlot.Rd @@ -18,6 +18,7 @@ \alias{.definePanelTour,AggregatedDotPlot-method} \alias{.createObservers,AggregatedDotPlot-method} \alias{.refineParameters,AggregatedDotPlot-method} +\alias{.multiSelectResponsive,AggregateDotPlot-method} \alias{initialize,AggregatedDotPlot-method} \title{The AggregatedDotPlot class} \description{ @@ -37,6 +38,12 @@ Defaults to \code{TRUE}. typically corresponding to the row names of the \linkS4class{SummarizedExperiment}. Names should be new-line separated within this string. Defaults to the name of the first row in the SummarizedExperiment. +\item \code{CapMaxRows}, a logical scalar indicating whether to cap the number of features to be shown on the plot. +This ensures that the \pkg{iSEE} application does not freeze when asked to cluster a very large selection of rows. +Defaults to \code{TRUE}, in which case a notification will be raised if the cap needs to be enforced. +\item \code{MaxRows}, an integer specifying the cap on the number of features to be shown on the plot. +Only used if \code{CapMaxRows} is set to \code{TRUE}. +Defaults to 50. } The following slots control the specification of groups: @@ -74,6 +81,19 @@ Defaults to \code{FALSE}. Defaults to \code{FALSE}. } +The following slots control the clustering of rows: +\itemize{ +\item \code{ClusterRows}, a logical scalar indicating whether clustering of the rows should be performed, +so as to group genes that have more similar average expression profiles across groups. +Defaults to \code{FALSE}. +\item \code{ClusterRowsDistance}, string specifying the distance metric to use. +This can be any one of \code{"euclidean"}, \code{"maximum"}, \code{"manhattan"}, \code{"canberra"}, \code{"binary"}, \code{"minkowski"}, \code{"pearson"}, \code{"spearman"}, or \code{"kendall"}. +Defaults to \code{"euclidean"}. +\item \code{ClusterRowsMethod}, string specifying a linkage method to use. +This can be any one of \code{"ward.D"}, \code{"ward.D2"}, \code{"single"}, \code{"complete"}, \code{"average"}, \code{"mcquitty"}, \code{"median"}, or \code{"centroid"}. +Defaults to \code{"ward.D2"}. +} + The following slots control the color: \itemize{ \item \code{UseCustomColormap}, a logical scalar indicating whether to use a custom color scale. From 3bcaceeeb2e71302105af63e79c8128a45a8e3ed Mon Sep 17 00:00:00 2001 From: LTLA Date: Sun, 24 Nov 2024 23:40:50 -0800 Subject: [PATCH 07/10] Actually emit a warning notification if a cap is used. --- R/AggregatedDotPlot.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/AggregatedDotPlot.R b/R/AggregatedDotPlot.R index 903c892..5d18cdd 100644 --- a/R/AggregatedDotPlot.R +++ b/R/AggregatedDotPlot.R @@ -464,6 +464,11 @@ setMethod(".generateOutput", "AggregatedDotPlot", function(x, se, all_memory, al .textEval(computation, plot_env) all_cmds$command <- computation + # Emitting a notification if we had to cap the number of rows. + if (length(plot_env$.chosen.rows) > nrow(plot_env$.averages)) { + showNotification(sprintf("number of features capped to %s in %s", nrow(plot_env$.averages), .getEncodedName(x)), type="warning") + } + # Row clustering. unclustered_cmds <- c(".rownames_ordered <- rev(rownames(.averages))") if (x[[.ADPClusterFeatures]] && nrow(plot_env$.averages) > 1L) { From c51979a552d0453f4a8abe05d4c0d66a032796f8 Mon Sep 17 00:00:00 2001 From: LTLA Date: Sun, 24 Nov 2024 23:45:00 -0800 Subject: [PATCH 08/10] Minor alias fix for CHECK. --- R/AggregatedDotPlot.R | 2 +- man/AggregatedDotPlot.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/AggregatedDotPlot.R b/R/AggregatedDotPlot.R index 5d18cdd..7431dee 100644 --- a/R/AggregatedDotPlot.R +++ b/R/AggregatedDotPlot.R @@ -176,7 +176,7 @@ #' .definePanelTour,AggregatedDotPlot-method #' .createObservers,AggregatedDotPlot-method #' .refineParameters,AggregatedDotPlot-method -#' .multiSelectResponsive,AggregateDotPlot-method +#' .multiSelectionResponsive,AggregateDotPlot-method #' initialize,AggregatedDotPlot-method NULL diff --git a/man/AggregatedDotPlot.Rd b/man/AggregatedDotPlot.Rd index 93527ac..bab8be1 100644 --- a/man/AggregatedDotPlot.Rd +++ b/man/AggregatedDotPlot.Rd @@ -18,7 +18,7 @@ \alias{.definePanelTour,AggregatedDotPlot-method} \alias{.createObservers,AggregatedDotPlot-method} \alias{.refineParameters,AggregatedDotPlot-method} -\alias{.multiSelectResponsive,AggregateDotPlot-method} +\alias{.multiSelectionResponsive,AggregateDotPlot-method} \alias{initialize,AggregatedDotPlot-method} \title{The AggregatedDotPlot class} \description{ From d40be216545c8f9558148495966e5db7eff42bec Mon Sep 17 00:00:00 2001 From: LTLA Date: Tue, 10 Dec 2024 17:18:56 -0800 Subject: [PATCH 09/10] Match new signature for multiselectionresponsive. --- R/AggregatedDotPlot.R | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/R/AggregatedDotPlot.R b/R/AggregatedDotPlot.R index 7431dee..aec0ea3 100644 --- a/R/AggregatedDotPlot.R +++ b/R/AggregatedDotPlot.R @@ -892,13 +892,12 @@ setMethod(".hideInterface", "AggregatedDotPlot", function(x, field) { }) #' @export -setMethod(".multiSelectionResponsive", "AggregatedDotPlot", function(x, dims = character(0)) { - if ("row" %in% dims) { +setMethod(".multiSelectionResponsive", "AggregatedDotPlot", function(x, dim) { + if (dim == "row") { if (!slot(x, .ADPCustomFeatNames)) { return(TRUE) } - } - if ("column" %in% dims) { + } else if (dim == "column") { return(TRUE) } return(FALSE) From 6d88afa85b776362bfe3bbd9188b92d19c24cb75 Mon Sep 17 00:00:00 2001 From: LTLA Date: Tue, 10 Dec 2024 17:34:24 -0800 Subject: [PATCH 10/10] Align with the new capping method in the heatmap. --- R/AggregatedDotPlot.R | 58 +++++++++++++++++++--------------------- man/AggregatedDotPlot.Rd | 10 +++---- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/R/AggregatedDotPlot.R b/R/AggregatedDotPlot.R index aec0ea3..1fa75df 100644 --- a/R/AggregatedDotPlot.R +++ b/R/AggregatedDotPlot.R @@ -15,12 +15,10 @@ #' typically corresponding to the row names of the \linkS4class{SummarizedExperiment}. #' Names should be new-line separated within this string. #' Defaults to the name of the first row in the SummarizedExperiment. -#' \item \code{CapMaxRows}, a logical scalar indicating whether to cap the number of features to be shown on the plot. -#' This ensures that the \pkg{iSEE} application does not freeze when asked to cluster a very large selection of rows. -#' Defaults to \code{TRUE}, in which case a notification will be raised if the cap needs to be enforced. -#' \item \code{MaxRows}, an integer specifying the cap on the number of features to be shown on the plot. -#' Only used if \code{CapMaxRows} is set to \code{TRUE}. -#' Defaults to 50. +#' \item \code{CapRowSelection}, an integer specifying the cap on the number of rows from a multiple selection to show in the heatmap, +#' to avoid a frozen state when the application attempts to process a very large heatmap. +#' Ignored if \code{CustomRows = TRUE}. +#' Defaults to 200. #' } #' #' The following slots control the specification of groups: @@ -183,8 +181,8 @@ NULL .ADPAssay <- "Assay" .ADPCustomFeatNames <- "CustomRows" .ADPFeatNameText <- "CustomRowsText" +.ADPCapRowSelection <- "CapRowSelection" .ADPClusterFeatures <- "ClusterRows" -.ADPCapMaxRows <- "CapMaxRows" .ADPMaxRows <- "MaxRows" .ADPColDataLabel <- "ColumnDataLabel" @@ -211,8 +209,7 @@ collated <- character(0) collated[.ADPAssay] <- "character" collated[.ADPCustomFeatNames] <- "logical" collated[.ADPFeatNameText] <- "character" -collated[.ADPCapMaxRows] <- "logical" -collated[.ADPMaxRows] <- "integer" +collated[.ADPCapRowSelection] <- "integer" collated[.ADPColDataLabel] <- "character" collated[.ADPColDataFacet] <- "character" @@ -254,10 +251,7 @@ setMethod("initialize", "AggregatedDotPlot", function(.Object, ...) { args <- .emptyDefault(args, .ADPAssay, getPanelDefault("Assay")) args <- .emptyDefault(args, .ADPCustomFeatNames, TRUE) args <- .emptyDefault(args, .ADPFeatNameText, NA_character_) - - args <- .emptyDefault(args, .ADPCapMaxRows, TRUE) - args <- .emptyDefault(args, .ADPMaxRows, 50L) - args[[.ADPMaxRows]] <- as.integer(args[[.ADPMaxRows]]) + args <- .emptyDefault(args, .ADPCapRowSelection, 200L) vals <- args[[.ADPFeatNameText]] if (length(vals)!=1L) { @@ -318,12 +312,11 @@ setValidity2("AggregatedDotPlot", function(object) { ) ) - msg <- .validNumberError(msg, object, .ADPMaxRows, 1L, Inf) + msg <- .validNumberError(msg, object, .ADPCapRowSelection, 0, Inf) msg <- .validLogicalError(msg, object, c( .ADPCustomFeatNames, - .ADPCapMaxRows, .visualParamBoxOpen, .ADPCustomColor, .ADPExpressors, @@ -425,7 +418,9 @@ setMethod(".generateOutput", "AggregatedDotPlot", function(x, se, all_memory, al all_cmds$select <- .processMultiSelections(x, all_memory, all_contents, plot_env) all_cmds$assay <- .extractAssaySubmatrix(x, se, plot_env, use_custom_row_slot=.ADPCustomFeatNames, - custom_row_text_slot=.ADPFeatNameText) + custom_row_text_slot=.ADPFeatNameText, + cap_row_selection_slot=.ADPCapRowSelection, + as_matrix=FALSE) # Computing the various statistics. col1 <- x[[.ADPColDataLabel]] @@ -435,12 +430,6 @@ setMethod(".generateOutput", "AggregatedDotPlot", function(x, se, all_memory, al cmd <- sprintf(".group_by <- SummarizedExperiment::colData(se)[.chosen.columns,%s,drop=FALSE];", paste(deparse(coldata.names), collapse="")) - if (x[[.ADPCapMaxRows]]) { - # Arbitrarily taking the top rows. - # TODO: move this into .extractAssaySubmatrix. - cmd <- c(cmd, sprintf("plot.data <- head(plot.data, %s)", x[[.ADPMaxRows]])) - } - computation <- c(cmd, ".averages.se <- scuttle::sumCountsAcrossCells(plot.data, .group_by, average=TRUE, store.number=NULL);", ".averages <- SummarizedExperiment::assay(.averages.se);", @@ -615,12 +604,13 @@ setMethod(".defineDataInterface", "AggregatedDotPlot", function(x, se, select_in ) }) - .addSpecificTour(class(x), .ADPCapMaxRows, function(plot_name) { + .addSpecificTour(class(x)[1], .ADPCapRowSelection, function(plot_name) { data.frame( rbind( c( - element=paste0("#", plot_name, "_", .ADPCapMaxRows), - intro="We can check this box to cap the maximum number of rows to be shown on the plot. This prevents the application from freezing if we ask it to plot too many genes.

Check this box if it isn't already checked." + element = paste0("#", plot_name, "_", .ADPCapRowSelection), + intro = "Sometimes, when receiving a multiple selection of rows from another panel, there may be too many rows to visualize efficiently on the plot. This field allows us to cap the number of rows in the selection so tha + the application does not freeze while attempting to render a very large plot. (Setting this value to zero will show all selected rows.)" ) ) ) @@ -684,13 +674,18 @@ The clustering itself is done on the group averages using hclust, i actionButton(.input_FUN(.dimnamesModalOpen), label="Edit feature names"), br(), br() ), - .checkboxInput.iSEE(x, .ADPCapMaxRows, label="Cap the maximum number of rows", - value=x[[.ADPCapMaxRows]]), .conditionalOnCheckSolo( - .input_FUN(.ADPCapMaxRows), - on_select=TRUE, - numericInput(.input_FUN(.ADPMaxRows), label="Maximum number of rows", - value=x[[.ADPMaxRows]], min=1, step=1) + .input_FUN(.ADPCustomFeatNames), + on_select=FALSE, + .numericInput.iSEE( + x, + .ADPCapRowSelection, + label="Cap on the number of selected rows", + value=slot(x, .ADPCapRowSelection), + min=0, + step=1, + help = TRUE + ), ), .checkboxInput.iSEE(x, .ADPClusterFeatures, label="Cluster rows (on averages)", value=x[[.ADPClusterFeatures]]), @@ -864,6 +859,7 @@ setMethod(".createObservers", "AggregatedDotPlot", function(x, se, input, sessio # as there aren't any selections transmitted from this panel anyway. .createProtectedParameterObservers(plot_name, fields=c(.ADPCustomFeatNames, + .ADPCapRowSelection, .ADPClusterFeatures, .ADPClusterDistanceFeatures, .ADPClusterMethodFeatures), diff --git a/man/AggregatedDotPlot.Rd b/man/AggregatedDotPlot.Rd index bab8be1..e8cfa22 100644 --- a/man/AggregatedDotPlot.Rd +++ b/man/AggregatedDotPlot.Rd @@ -38,12 +38,10 @@ Defaults to \code{TRUE}. typically corresponding to the row names of the \linkS4class{SummarizedExperiment}. Names should be new-line separated within this string. Defaults to the name of the first row in the SummarizedExperiment. -\item \code{CapMaxRows}, a logical scalar indicating whether to cap the number of features to be shown on the plot. -This ensures that the \pkg{iSEE} application does not freeze when asked to cluster a very large selection of rows. -Defaults to \code{TRUE}, in which case a notification will be raised if the cap needs to be enforced. -\item \code{MaxRows}, an integer specifying the cap on the number of features to be shown on the plot. -Only used if \code{CapMaxRows} is set to \code{TRUE}. -Defaults to 50. +\item \code{CapRowSelection}, an integer specifying the cap on the number of rows from a multiple selection to show in the heatmap, +to avoid a frozen state when the application attempts to process a very large heatmap. +Ignored if \code{CustomRows = TRUE}. +Defaults to 200. } The following slots control the specification of groups: