diff --git a/R/dimension_reduction.R b/R/dimension_reduction.R index 37b2b539e..1fb050629 100644 --- a/R/dimension_reduction.R +++ b/R/dimension_reduction.R @@ -1672,7 +1672,8 @@ create_screeplot <- function(eigs, ncp = 20, ylim = c(0, 20)) { #' @param set_seed logical. whether to set a seed when random_subset is used #' @param seed_number seed number to use when random_subset is used #' @param verbose show progress of jackstraw method -#' @returns ggplot object for jackstraw method +#' @returns if `return_plot` = `TRUE`: ggplot object for jackstraw method +#' if `return_plot` = `FALSE`: silently returns number of significant PCs #' @details #' The Jackstraw method uses the \code{\link[jackstraw]{permutationPA}} #' function. By systematically permuting genes it identifies robust, and thus @@ -1799,6 +1800,11 @@ jackstrawPlot <- function(gobject, "\nnumber of estimated significant components: ", nr_sign_components) + warning(wrap_txt( + "Number of significant components equals `ncp`. + Increasing `ncp` may be needed." + )) + final_results <- jtest[c("p", "cum_var_explained")] vmsg(.v = verbose, .is_debug = TRUE, final_results$p) @@ -1819,7 +1825,7 @@ jackstrawPlot <- function(gobject, show_plot = show_plot, default_save_name = default_save_name, save_param = save_param, - else_return = NULL + else_return = nr_sign_components )) } diff --git a/man/jackstrawPlot.Rd b/man/jackstrawPlot.Rd index 1da89c037..1a4778a85 100644 --- a/man/jackstrawPlot.Rd +++ b/man/jackstrawPlot.Rd @@ -10,9 +10,9 @@ jackstrawPlot( feat_type = NULL, expression_values = c("normalized", "scaled", "custom"), reduction = c("cells", "feats"), - feats_to_use = NULL, - center = FALSE, - scale_unit = FALSE, + feats_to_use = "hvf", + center = TRUE, + scale_unit = TRUE, ncp = 20, ylim = c(0, 1), iter = 10, @@ -75,7 +75,8 @@ speed up calculation} change save_name in save_param} } \value{ -ggplot object for jackstraw method +if \code{return_plot} = \code{TRUE}: ggplot object for jackstraw method +if \code{return_plot} = \code{FALSE}: silently returns number of significant PCs } \description{ Identify significant principal components (PCs)