Skip to content

Commit

Permalink
add a check for DimHeatmaps that will take a long time to plot
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwbutler committed Sep 1, 2017
1 parent fa6db17 commit 17efcea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ importFrom(tclust,tkmeans)
importFrom(tidyr,gather)
importFrom(tsne,tsne)
importFrom(utils,globalVariables)
importFrom(utils,menu)
importFrom(utils,packageVersion)
importFrom(utils,read.table)
importFrom(utils,setTxtProgressBar)
Expand Down
11 changes: 11 additions & 0 deletions R/plotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -1790,12 +1790,14 @@ CellPlot <- function(
#' @param do.balanced Plot an equal number of genes with both + and - scores.
#' @param remove.key Removes the color key from the plot.
#' @param label.columns Labels for columns
#' @param check.plot Check that plotting will finish in a reasonable amount of time
#' @param ... Extra parameters for heatmap plotting.
#'
#' @return If do.return==TRUE, a matrix of scaled values which would be passed
#' to heatmap.2. Otherwise, no return value, only a graphical output
#'
#' @importFrom graphics par
#' @importFrom utils menu
#'
#' @export
#'
Expand All @@ -1817,6 +1819,7 @@ DimHeatmap <- function(
do.balanced = FALSE,
remove.key = FALSE,
label.columns = NULL,
check.plot = TRUE,
...
) {
num.row <- floor(x = length(x = dim.use) / 3.01) + 1
Expand Down Expand Up @@ -1880,6 +1883,14 @@ DimHeatmap <- function(
}
data.use <- rbind(data.use, new.data)
}
if(check.plot & any(dim(data.use) > 700) & (remove.key == FALSE & length(dim.use) == 1)) {
choice <- menu(c("Continue with plotting", "Quit"), title = "Plot(s) requested will likely take a while to plot.")
if(choice == 1){
check.plot = FALSE
} else {
return()
}
}
#data.use <- [email protected][genes.use, cells.ordered]
data.use <- MinMax(data = data.use, min = disp.min, max = disp.max)
#if (!(use.scale)) data.use <- as.matrix(object@data[genes.use, cells.ordered])
Expand Down
5 changes: 4 additions & 1 deletion man/DimHeatmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 17efcea

Please sign in to comment.