diff --git a/NAMESPACE b/NAMESPACE index d431810..b5cbbd0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -18,19 +18,19 @@ export(do_FeaturePlot) export(do_GeyserPlot) export(do_GroupwiseDEPlot) export(do_LigandReceptorPlot) -export(do_LoadingsPlot) +export(do_LoadingsHeatmap) export(do_MetadataPlot) export(do_NebulosaPlot) +export(do_PackageReport) export(do_PathwayActivityPlot) -export(do_RankedEnrichmentPlot) -export(do_RankedExpressionPlot) +export(do_RankedEnrichmentHeatmap) +export(do_RankedExpressionHeatmap) export(do_RidgePlot) export(do_SCEnrichmentHeatmap) export(do_SCExpressionHeatmap) +export(do_SavePlot) export(do_TFActivityPlot) export(do_TermEnrichmentPlot) export(do_ViolinPlot) export(do_VolcanoPlot) export(do_WafflePlot) -export(package_report) -export(save_Plot) diff --git a/NEWS.md b/NEWS.md index 47119eb..f71c810 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,16 +5,19 @@ ## Added functions - `do_WafflePlot()`: This function displays proportions as a pictogram grid of 10x10 tiles. It helps to visually see at a glance the proportions of your data. This fails to correctly convey decimal proportions and completely ignores heavily under-represented classes in your dataset. -- `do_RankedExpressionPlot()` to plot expression values as a heatmap along a diffusion component. +- `do_RankedExpressionHeatmap()` to plot expression values as a heatmap along a dimensional reduction component. ## Removed functions - `do_FunctionalAnnotationPlot()`. - `do_GroupedGOTermPlot()`. -The reason behind it is that they, together with do_TermEnrichmentPlot() targetted the same analysis and, therefore, were redundant. +The reason behind it is that they, together with do_TermEnrichmentPlot() targeted the same analysis and, therefore, were redundant. ## Renamed functions -- `do_DiffusionMapPlot()` is now called `do_RankedEnrichmentPlot()`. As it now accepts any dimensional reduction and not only diffusion maps. +- `do_DiffusionMapPlot()` is now called `do_RankedEnrichmentHeatmap()`. As it now accepts any dimensional reduction and not only diffusion maps. +- `save_plot()` (development release only) is now called `do_SavePlot()`. This is a preparation for the version `2.0.3` which will launch together with the publication. +- `package_report()` is now called `do_PackageReport()`. This is a preparation for the version `2.0.3` which will launch together with the publication. +- `do_LoadingsPlot()` is now called `do_LoadingsHeatmap()`. This is a preparation for the version `2.0.3` which will launch together with the publication. ## Heavily modified functions. - `do_TermEnrichmentPlot()`: Recoded the whole function. Now accepts the result of using `clusterProfiler::enrichGO()`, `clusterProfiler::enrichKEGG()`, etc. The output is a dot plot with the terms on the Y axis, the Gene Ratio in the X, colored by the adjusted p-value and size mapped to the Gene Count. @@ -25,6 +28,7 @@ The reason of these modification is to allow for a much clearer and concise outp ## do_AlluvialPlot() - Enforced a minimum version of `ggalluvial` to deal with deprecation of functions from `dplyr` and `tidyr` that were still used in `ggalluvial` functions. +- Modified the legend items to have a black border. ## do_BoxPlot() - Added `legend.ncol`, `legend.nrow` and `legend.byrow` parameters to control legend behavior. @@ -32,6 +36,14 @@ The reason of these modification is to allow for a much clearer and concise outp - When `map_signif_levels` is used, the mapping now appears as a plot legend for clarity. - Added black borders to the legend glyphs when using `use_silhouette = FALSE`. +## do_CellularStatesPlot() +- Added reference lines to the plot to better visualize the segments. +- Added black border around the legend items. +- Fixed bug where axis text will always display in bold. + +## do_ChortDiagramPlot() +- Added `font.size` parameter to control the font size of the plot. + ## do_ColorPalette() - Changed "Wheel" to "Color wheel" when plotting the output without additional parameters. diff --git a/R/do_AlluvialPlot.R b/R/do_AlluvialPlot.R index 8fb01a4..71c7c57 100644 --- a/R/do_AlluvialPlot.R +++ b/R/do_AlluvialPlot.R @@ -291,7 +291,9 @@ do_AlluvialPlot <- function(sample, ggplot2::labs(title = plot.title, subtitle = plot.subtitle, caption = plot.caption) + - ggplot2::guides(fill = ggplot2::guide_legend(title = legend.title)) + + ggplot2::guides(fill = ggplot2::guide_legend(title = legend.title, + override.aes = list(color = "black", + shape = 22))) + ggplot2::theme_minimal(base_size = font.size) + ggplot2::theme(axis.title = ggplot2::element_text(color = "black", face = axis.title.face), diff --git a/R/do_CellularStatesPlot.R b/R/do_CellularStatesPlot.R index 462cd43..f98feb2 100644 --- a/R/do_CellularStatesPlot.R +++ b/R/do_CellularStatesPlot.R @@ -254,6 +254,8 @@ do_CellularStatesPlot <- function(sample, pixels = c(raster.dpi, raster.dpi)) } p <- p + + ggplot2::geom_hline(yintercept = 0, linetype = "dashed") + + ggplot2::geom_vline(xintercept = 0, linetype = "dashed") + ggplot2::scale_color_manual(values = colors.use) + ggplot2::guides(color = ggplot2::guide_legend(title = "")) + ggplot2::xlab(x_lab) + @@ -357,6 +359,8 @@ do_CellularStatesPlot <- function(sample, pixels = c(raster.dpi, raster.dpi)) } p <- p + + ggplot2::geom_hline(yintercept = 0, linetype = "dashed") + + ggplot2::geom_vline(xintercept = 0, linetype = "dashed") + ggplot2::scale_color_manual(values = colors.use) + ggplot2::xlab(x_lab) + ggplot2::ylab(y_lab) + @@ -465,6 +469,8 @@ do_CellularStatesPlot <- function(sample, pixels = c(raster.dpi, raster.dpi)) } p <- p + + ggplot2::geom_hline(yintercept = 0, linetype = "dashed") + + ggplot2::geom_vline(xintercept = 0, linetype = "dashed") + ggplot2::scale_color_manual(values = colors.use) + ggplot2::xlab(x_lab1) + ggplot2::ylab(y_lab1) + @@ -485,6 +491,8 @@ do_CellularStatesPlot <- function(sample, suppressMessages({ p <- p + + ggplot2::geom_hline(yintercept = 0, linetype = "dashed") + + ggplot2::geom_vline(xintercept = 0, linetype = "dashed") + ggplot2::xlim(lim) + ggplot2::ylim(lim) + ggplot2::scale_y_continuous(sec.axis = ggplot2::sec_axis(~., name = y_lab2)) + @@ -510,7 +518,6 @@ do_CellularStatesPlot <- function(sample, axis.text.y.right = ggplot2::element_text(face = axis.text.face, color = "black"), axis.title.x.top = ggplot2::element_text(face = axis.title.face, color = "black"), axis.title.y.right = ggplot2::element_text(face = axis.title.face, color = "black"), - axis.text = ggplot2::element_text(face = "bold", color = "black"), plot.title = ggplot2::element_text(face = plot.title.face, hjust = 0), plot.subtitle = ggplot2::element_text(face = plot.subtitle.face, hjust = 0), plot.caption = ggplot2::element_text(face = plot.caption.face, hjust = 1), @@ -532,7 +539,10 @@ do_CellularStatesPlot <- function(sample, ncol = legend.ncol, nrow = legend.nrow, byrow = legend.byrow, - override.aes = list(size = legend.icon.size))) + override.aes = list(size = legend.icon.size, + color = "black", + fill = colors.use, + shape = 21))) # Add cell borders. if (isTRUE(plot_cell_borders)){ diff --git a/R/do_ChordDiagramPlot.R b/R/do_ChordDiagramPlot.R index f088a50..e89bed4 100644 --- a/R/do_ChordDiagramPlot.R +++ b/R/do_ChordDiagramPlot.R @@ -71,6 +71,7 @@ do_ChordDiagramPlot <- function(sample = NULL, alignment = "default", annotationTrack = c("grid", "axis"), padding_labels = 4, + font.size = 1, ...){ # Add lengthy error messages. withr::local_options(.new = list("warning.length" = 8170)) @@ -90,7 +91,8 @@ do_ChordDiagramPlot <- function(sample = NULL, "alpha.highlight" = alpha.highlight, "self.link" = self.link, "directional" = directional, - "padding_labels" = padding_labels) + "padding_labels" = padding_labels, + "font.size" = font.size) check_type(parameters = numeric_list, required_type = "numeric", test_function = is.numeric) # Check character parameters. @@ -352,7 +354,8 @@ do_ChordDiagramPlot <- function(sample = NULL, facing = "clockwise", niceFacing = TRUE, adj = c(-0.15, 0.5), - font = 2)}, + font = 2, + cex = font.size)}, bg.border = NA) p <- grDevices::recordPlot() circlize::circos.clear() diff --git a/R/do_GeyserPlot.R b/R/do_GeyserPlot.R index ec2bf12..5c4909c 100644 --- a/R/do_GeyserPlot.R +++ b/R/do_GeyserPlot.R @@ -66,8 +66,8 @@ do_GeyserPlot <- function(sample, diverging.palette = "RdBu", diverging.direction = -1, sequential.palette = "YlGnBu", - sequential.direction = -1, - use_viridis = TRUE, + sequential.direction = 1, + use_viridis = FALSE, plot.title.face = "bold", plot.subtitle.face = "plain", plot.caption.face = "italic", diff --git a/R/do_LoadingsPlot.R b/R/do_LoadingsHeatmap.R similarity index 98% rename from R/do_LoadingsPlot.R rename to R/do_LoadingsHeatmap.R index e7f1c0d..fa286a2 100644 --- a/R/do_LoadingsPlot.R +++ b/R/do_LoadingsHeatmap.R @@ -10,13 +10,13 @@ #' @return A ggplot2 object. #' @export #' -#' @example /man/examples/examples_do_LoadingsPlot.R -do_LoadingsPlot <- function(sample, +#' @example /man/examples/examples_do_LoadingsHeatmap.R +do_LoadingsHeatmap <- function(sample, group.by = NULL, subsample = NA, dims = 1:10, top_loadings = 5, - assay = "SCT", + assay = NULL, slot = "data", grid.color = "white", border.color = "black", @@ -56,7 +56,7 @@ do_LoadingsPlot <- function(sample, # Add lengthy error messages. withr::local_options(.new = list("warning.length" = 8170)) - check_suggests("do_LoadingsPlot") + check_suggests("do_LoadingsHeatmap") # Check logical parameters. logical_list <- list("use_viridis" = use_viridis, @@ -139,7 +139,14 @@ do_LoadingsPlot <- function(sample, use_viridis = use_viridis, direction = ifelse(isTRUE(use_viridis), viridis.direction, sequential.direction), enforce_symmetry = FALSE) - + + + # Check assay. + assay <- if (is.null(assay)){Seurat::DefaultAssay(sample)} else {assay} + + Seurat::DefaultAssay(sample) <- assay + + # Check group.by. out <- check_group_by(sample = sample, group.by = group.by, diff --git a/R/do_RankedEnrichmentPlot.R b/R/do_RankedEnrichmentHeatmap.R similarity index 97% rename from R/do_RankedEnrichmentPlot.R rename to R/do_RankedEnrichmentHeatmap.R index 6079f1c..598e05d 100644 --- a/R/do_RankedEnrichmentPlot.R +++ b/R/do_RankedEnrichmentHeatmap.R @@ -1,14 +1,14 @@ -#' Compute a heatmap of enrichment of gene sets on the context of a diffusion component. +#' Compute a heatmap of enrichment of gene sets on the context of a dimensional reduction component. #' #' @inheritParams doc_function #' @param colors.use \strong{\code{\link[base]{list}}} | A named list of named vectors. The names of the list correspond to the names of the values provided to metadata and the names of the items in the named vectors correspond to the unique values of that specific metadata variable. The values are the desired colors in HEX code for the values to plot. The used are pre-defined by the package but, in order to get the most out of the plot, please provide your custom set of colors for each metadata column! #' @param main.heatmap.size \strong{\code{\link[base]{numeric}}} | A number from 0 to 1 corresponding to how big the main heatmap plot should be with regards to the rest (corresponds to the proportion in size). #' @param scale.enrichment \strong{\code{\link[base]{logical}}} | Should the enrichment scores be scaled (z-scored) for better comparison in between gene sets? Setting this to TRUE should make intra- gene set comparisons easier at the cost ot not being able to compare inter- gene sets in absolute values. -#' @return A list of ggplot2 objects and a Seurat object if desired. +#' @return A list of ggplot2 objects, one per dimensional reduction component, and a Seurat object if desired. #' @export #' -#' @example /man/examples/examples_do_RankedEnrichmentPlot.R -do_RankedEnrichmentPlot <- function(sample, +#' @example /man/examples/examples_do_RankedEnrichmentHeatmap.R +do_RankedEnrichmentHeatmap <- function(sample, input_gene_list, assay = NULL, slot = NULL, @@ -61,7 +61,7 @@ do_RankedEnrichmentPlot <- function(sample, # Add lengthy error messages. withr::local_options(.new = list("warning.length" = 8170)) - check_suggests("do_RankedEnrichmentPlot") + check_suggests("do_RankedEnrichmentHeatmap") check_Seurat(sample = sample) # Check the reduction. @@ -264,7 +264,7 @@ do_RankedEnrichmentPlot <- function(sample, data.use <- data.use %>% tidyr::pivot_longer(cols = dplyr::all_of(c(names(input_gene_list))), names_to = "Gene_Set", - values_to = "Enrichment") + values_to = "Enrichment") # Generate DC-based heatmaps. @@ -373,6 +373,8 @@ do_RankedEnrichmentPlot <- function(sample, ggplot2::guides(fill = ggplot2::guide_legend(title = name, title.position = "top", title.hjust = 0.5, + override.aes = list(color = "black", + shape = 22), ncol = legend.ncol, nrow = legend.nrow, byrow = legend.byrow)) + diff --git a/R/do_RankedExpressionPlot.R b/R/do_RankedExpressionHeatmap.R similarity index 96% rename from R/do_RankedExpressionPlot.R rename to R/do_RankedExpressionHeatmap.R index 67265e6..2e69e30 100644 --- a/R/do_RankedExpressionPlot.R +++ b/R/do_RankedExpressionHeatmap.R @@ -1,13 +1,13 @@ -#' Compute a heatmap of enrichment of gene sets on the context of a diffusion component. +#' Compute a heatmap of expression of genes on the context of a dimensional reduction component. #' #' @inheritParams doc_function #' @param colors.use \strong{\code{\link[base]{list}}} | A named list of named vectors. The names of the list correspond to the names of the values provided to metadata and the names of the items in the named vectors correspond to the unique values of that specific metadata variable. The values are the desired colors in HEX code for the values to plot. The used are pre-defined by the package but, in order to get the most out of the plot, please provide your custom set of colors for each metadata column! #' @param main.heatmap.size \strong{\code{\link[base]{numeric}}} | A number from 0 to 1 corresponding to how big the main heatmap plot should be with regards to the rest (corresponds to the proportion in size). -#' @return A list of ggplot2 objects and a Seurat object if desired. +#' @return A list of ggplot2 objects, one per dimensional reduction component, and a Seurat object if desired. #' @export #' -#' @example /man/examples/examples_do_RankedExpressionPlot.R -do_RankedExpressionPlot <- function(sample, +#' @example /man/examples/examples_do_RankedExpressionHeatmap.R +do_RankedExpressionHeatmap <- function(sample, features, assay = NULL, slot = NULL, @@ -58,7 +58,7 @@ do_RankedExpressionPlot <- function(sample, # Add lengthy error messages. withr::local_options(.new = list("warning.length" = 8170)) - check_suggests("do_RankedExpressionPlot") + check_suggests("do_RankedExpressionHeatmap") check_Seurat(sample = sample) # Check the reduction. @@ -242,7 +242,8 @@ do_RankedExpressionPlot <- function(sample, data.use <- data.use %>% tidyr::pivot_longer(cols = dplyr::all_of(c(features)), names_to = "Feature", - values_to = "Expression") + values_to = "Expression") %>% + dplyr::mutate("Feature" = factor(.data$Feature, levels = genes.use)) # Generate DC-based heatmaps. @@ -350,6 +351,8 @@ do_RankedExpressionPlot <- function(sample, ggplot2::guides(fill = ggplot2::guide_legend(title = name, title.position = "top", title.hjust = 0.5, + override.aes = list(color = "black", + shape = 22), ncol = legend.ncol, nrow = legend.nrow, byrow = legend.byrow)) + diff --git a/R/save_Plot.R b/R/do_SavePlot.R similarity index 94% rename from R/save_Plot.R rename to R/do_SavePlot.R index d1e6ac1..ca560bc 100644 --- a/R/save_Plot.R +++ b/R/do_SavePlot.R @@ -21,19 +21,19 @@ #' @return Nothing. #' @export #' -#' @example /man/examples/examples_save_Plot.R -save_Plot <- function(plot, - figure_path = NULL, - create_path = TRUE, - file_name = NULL, - dpi = 300, - output_format = "publication", - width = 8, - height = 8){ +#' @example /man/examples/examples_do_SavePlot.R +do_SavePlot <- function(plot, + figure_path = NULL, + create_path = TRUE, + file_name = NULL, + dpi = 300, + output_format = "publication", + width = 8, + height = 8){ # nocov start # Checks for packages. - check_suggests(function_name = "save_Plot") + check_suggests(function_name = "do_SavePlot") # Check logical parameters. logical_list <- list("create_path" = create_path) diff --git a/R/utils.R b/R/utils.R index 824a7be..9b45710 100644 --- a/R/utils.R +++ b/R/utils.R @@ -428,9 +428,9 @@ return_dependencies <- function(){ "do_GroupwiseDEPlot" = NULL, "do_MetadataPlot" = "cluster", "do_LigandReceptorPlot" = "liana", - "do_LoadingsPlot" = NULL, - "do_RankedEnrichmentPlot" = "Matrix", - "do_RankedExpressionPlot" = NULL, + "do_LoadingsHeatmap" = NULL, + "do_RankedEnrichmentHeatmap" = "Matrix", + "do_RankedExpressionHeatmap" = NULL, "do_NebulosaPlot" = "Nebulosa", "do_PathwayActivityPlot" = NULL, "do_RidgePlot" = "ggridges", @@ -441,7 +441,7 @@ return_dependencies <- function(){ "do_ViolinPlot" = NULL, "do_VolcanoPlot" = "ggrepel", "do_WafflePlot" = "waffle", - "save_Plot" = "svglite") + "do_SavePlot" = "svglite") return(pkg_list) } @@ -463,7 +463,7 @@ check_suggests <- function(function_name, passive = FALSE){ } pkgs <- c(pkg_list[[function_name]], pkg_list[["Essentials"]]) - non_seurat_functions <- c("save_Plot", + non_seurat_functions <- c("do_SavePlot", "do_VolcanoPlot", "do_LigandReceptorPlot", "do_ColorPalette") @@ -506,11 +506,11 @@ check_suggests <- function(function_name, passive = FALSE){ #' #' \donttest{ #' # Print a package report. -#' SCpubr::package_report(startup = FALSE, extended = FALSE) +#' SCpubr::do_PackageReport(startup = FALSE, extended = FALSE) #' } -package_report <- function(startup = FALSE, - extended = FALSE){ +do_PackageReport <- function(startup = FALSE, + extended = FALSE){ # nocov start if (base::isFALSE(requireNamespace("cli", quietly = TRUE)) | base::isFALSE(requireNamespace("rlang", quietly = TRUE))){ if (base::isFALSE(startup)){ @@ -606,25 +606,21 @@ package_report <- function(startup = FALSE, if (rev(strsplit(as.character( as.character(utils::packageVersion("SCpubr"))), split = "\\.")[[1]])[1] >= 9000){ names.use <- unname(vapply(functions, function(x){if (x %in% c("do_LigandReceptorPlot", - "save_Plot", + "do_SavePlot", "do_MetadataPlot", "do_SCExpressionHeatmap", "do_SCEnrichmentHeatmap", - "do_AffinityAnalysisPlot", - "do_DiffusionMapPlot", - "do_LoadingsPlot")){x <- paste0(x, cli::col_cyan(" | DEV"))} else {x}}, FUN.VALUE = character(1))) + "do_AffinityAnalysisPlot")){x <- paste0(x, cli::col_cyan(" | DEV"))} else {x}}, FUN.VALUE = character(1))) functions <- vapply(functions, check_suggests, passive = TRUE, FUN.VALUE = logical(1)) names(functions) <- names.use # nocov start } else { functions <- functions[!(functions %in% c("do_LigandReceptorPlot", - "save_Plot", + "do_SavePlot", "do_MetadataPlot", "do_SCExpressionHeatmap", "do_SCEnrichmentHeatmap", - "do_AffinityAnalysisPlot", - "do_DiffusionMapPlot", - "do_LoadingsPlot"))] + "do_AffinityAnalysisPlot"))] functions <- vapply(functions, check_suggests, passive = TRUE, FUN.VALUE = logical(1)) } # nocov end @@ -716,7 +712,7 @@ package_report <- function(startup = FALSE, crayon_body(" builds of "), crayon_key("SCpubr"), crayon_body(" are marked by the ("), - cli::style_bold(cli::col_cyan("| DEV")), + cli::col_cyan("| DEV"), crayon_body(") tag.")) functions_tip2 <- paste0(cli::style_bold(cli::col_cyan(cli::symbol$info)), @@ -732,7 +728,7 @@ package_report <- function(startup = FALSE, ins_message <- paste0(cli::style_bold(cli::col_blue("!")), crayon_body(" Check missing dependencies with: "), - cli::style_italic(crayon_key('SCpubr::package_report(extended = TRUE)'))) + cli::style_italic(crayon_key('SCpubr::do_PackageReport(extended = TRUE)'))) tip_message <- paste0(cli::style_bold(cli::col_cyan(cli::symbol$info)), crayon_body(" To remove the white and black end from continuous palettes, use: "), diff --git a/R/zzz.R b/R/zzz.R index 7478468..2b9310d 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -7,6 +7,6 @@ # nocov end # Print startup message. - package_report(startup = TRUE, - extended = FALSE) + do_PackageReport(startup = TRUE, + extended = FALSE) } \ No newline at end of file diff --git a/man/do_ChordDiagramPlot.Rd b/man/do_ChordDiagramPlot.Rd index 16f77c4..487f8fc 100644 --- a/man/do_ChordDiagramPlot.Rd +++ b/man/do_ChordDiagramPlot.Rd @@ -28,6 +28,7 @@ do_ChordDiagramPlot( alignment = "default", annotationTrack = c("grid", "axis"), padding_labels = 4, + font.size = 1, ... ) } @@ -102,6 +103,8 @@ do_ChordDiagramPlot( \item{padding_labels}{\strong{\code{\link[base]{numeric}}} | Number of extra padding (white spaces) of the labels so that they do not overlap with the scales.} +\item{font.size}{\strong{\code{\link[base]{numeric}}} | Overall font size of the plot. All plot elements will have a size relationship with this font size.} + \item{...}{For internal use only.} } \value{ diff --git a/man/do_GeyserPlot.Rd b/man/do_GeyserPlot.Rd index 5f56742..4e915bd 100644 --- a/man/do_GeyserPlot.Rd +++ b/man/do_GeyserPlot.Rd @@ -51,8 +51,8 @@ do_GeyserPlot( diverging.palette = "RdBu", diverging.direction = -1, sequential.palette = "YlGnBu", - sequential.direction = -1, - use_viridis = TRUE, + sequential.direction = 1, + use_viridis = FALSE, plot.title.face = "bold", plot.subtitle.face = "plain", plot.caption.face = "italic", diff --git a/man/do_LoadingsPlot.Rd b/man/do_LoadingsHeatmap.Rd similarity index 95% rename from man/do_LoadingsPlot.Rd rename to man/do_LoadingsHeatmap.Rd index 6e25e99..798f32c 100644 --- a/man/do_LoadingsPlot.Rd +++ b/man/do_LoadingsHeatmap.Rd @@ -1,16 +1,16 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/do_LoadingsPlot.R -\name{do_LoadingsPlot} -\alias{do_LoadingsPlot} +% Please edit documentation in R/do_LoadingsHeatmap.R +\name{do_LoadingsHeatmap} +\alias{do_LoadingsHeatmap} \title{Compute a heatmap summary of the top and bottom genes in the PCA loadings for the desired PCs in a Seurat object.} \usage{ -do_LoadingsPlot( +do_LoadingsHeatmap( sample, group.by = NULL, subsample = NA, dims = 1:10, top_loadings = 5, - assay = "SCT", + assay = NULL, slot = "data", grid.color = "white", border.color = "black", @@ -145,7 +145,7 @@ Compute a heatmap summary of the top and bottom genes in the PCA loadings for th \examples{ \donttest{ # Check Suggests. - value <- SCpubr:::check_suggests(function_name = "do_LoadingsPlot", passive = TRUE) + value <- SCpubr:::check_suggests(function_name = "do_LoadingsHeatmap", passive = TRUE) if (isTRUE(value)){ # Consult the full documentation in https://enblacar.github.io/SCpubr-book/ @@ -153,8 +153,8 @@ Compute a heatmap summary of the top and bottom genes in the PCA loadings for th # Define your Seurat object. sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr")) - p <- SCpubr::do_LoadingsPlot(sample = sample, - dims = 1:2) + p <- SCpubr::do_LoadingsHeatmap(sample = sample, + dims = 1:2) p } else if (base::isFALSE(value)){ diff --git a/man/package_report.Rd b/man/do_PackageReport.Rd similarity index 84% rename from man/package_report.Rd rename to man/do_PackageReport.Rd index 25927c0..781b238 100644 --- a/man/package_report.Rd +++ b/man/do_PackageReport.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/utils.R -\name{package_report} -\alias{package_report} +\name{do_PackageReport} +\alias{do_PackageReport} \title{Generate a status report of SCpubr and its dependencies.} \usage{ -package_report(startup = FALSE, extended = FALSE) +do_PackageReport(startup = FALSE, extended = FALSE) } \arguments{ \item{startup}{\strong{\code{\link[base]{logical}}} | Whether the message should be displayed at startup, therefore, also containing welcoming messages and tips. If \strong{\code{FALSE}}, only the report itself will be printed.} @@ -21,6 +21,6 @@ This function generates a summary report of the installation status of SCpubr, w \donttest{ # Print a package report. -SCpubr::package_report(startup = FALSE, extended = FALSE) +SCpubr::do_PackageReport(startup = FALSE, extended = FALSE) } } diff --git a/man/do_RankedEnrichmentPlot.Rd b/man/do_RankedEnrichmentHeatmap.Rd similarity index 92% rename from man/do_RankedEnrichmentPlot.Rd rename to man/do_RankedEnrichmentHeatmap.Rd index 6149072..5490c5d 100644 --- a/man/do_RankedEnrichmentPlot.Rd +++ b/man/do_RankedEnrichmentHeatmap.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/do_RankedEnrichmentPlot.R -\name{do_RankedEnrichmentPlot} -\alias{do_RankedEnrichmentPlot} -\title{Compute a heatmap of enrichment of gene sets on the context of a diffusion component.} +% Please edit documentation in R/do_RankedEnrichmentHeatmap.R +\name{do_RankedEnrichmentHeatmap} +\alias{do_RankedEnrichmentHeatmap} +\title{Compute a heatmap of enrichment of gene sets on the context of a dimensional reduction component.} \usage{ -do_RankedEnrichmentPlot( +do_RankedEnrichmentHeatmap( sample, input_gene_list, assay = NULL, @@ -165,15 +165,15 @@ do_RankedEnrichmentPlot( }} } \value{ -A list of ggplot2 objects and a Seurat object if desired. +A list of ggplot2 objects, one per dimensional reduction component, and a Seurat object if desired. } \description{ -Compute a heatmap of enrichment of gene sets on the context of a diffusion component. +Compute a heatmap of enrichment of gene sets on the context of a dimensional reduction component. } \examples{ \donttest{ # Check Suggests. - value <- SCpubr:::check_suggests(function_name = "do_RankedEnrichmentPlot", passive = TRUE) + value <- SCpubr:::check_suggests(function_name = "do_RankedEnrichmentHeatmap", passive = TRUE) if (isTRUE(value)){ # Consult the full documentation in https://enblacar.github.io/SCpubr-book/ @@ -190,14 +190,14 @@ Compute a heatmap of enrichment of gene sets on the context of a diffusion compo # This will query, for the provided components, the enrichment of the gene # sets for all cells and plot them in the context of the cells reordered by # the position alongside each dimensional reduction component. - p <- SCpubr::do_RankedEnrichmentPlot(sample = sample, - input_gene_list = genes, - nbin = 1, - ctrl = 5, - flavor = "Seurat", - subsample = NA, - dims = 1:2, - verbose = FALSE) + p <- SCpubr::do_RankedEnrichmentHeatmap(sample = sample, + input_gene_list = genes, + nbin = 1, + ctrl = 5, + flavor = "Seurat", + subsample = NA, + dims = 1:2, + verbose = FALSE) p diff --git a/man/do_RankedExpressionPlot.Rd b/man/do_RankedExpressionHeatmap.Rd similarity index 90% rename from man/do_RankedExpressionPlot.Rd rename to man/do_RankedExpressionHeatmap.Rd index edeb2b9..085781c 100644 --- a/man/do_RankedExpressionPlot.Rd +++ b/man/do_RankedExpressionHeatmap.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/do_RankedExpressionPlot.R -\name{do_RankedExpressionPlot} -\alias{do_RankedExpressionPlot} -\title{Compute a heatmap of enrichment of gene sets on the context of a diffusion component.} +% Please edit documentation in R/do_RankedExpressionHeatmap.R +\name{do_RankedExpressionHeatmap} +\alias{do_RankedExpressionHeatmap} +\title{Compute a heatmap of expression of genes on the context of a dimensional reduction component.} \usage{ -do_RankedExpressionPlot( +do_RankedExpressionHeatmap( sample, features, assay = NULL, @@ -159,15 +159,15 @@ do_RankedExpressionPlot( }} } \value{ -A list of ggplot2 objects and a Seurat object if desired. +A list of ggplot2 objects, one per dimensional reduction component, and a Seurat object if desired. } \description{ -Compute a heatmap of enrichment of gene sets on the context of a diffusion component. +Compute a heatmap of expression of genes on the context of a dimensional reduction component. } \examples{ \donttest{ # Check Suggests. - value <- SCpubr:::check_suggests(function_name = "do_RankedExpressionPlot", passive = TRUE) + value <- SCpubr:::check_suggests(function_name = "do_RankedExpressionHeatmap", passive = TRUE) if (isTRUE(value)){ # Consult the full documentation in https://enblacar.github.io/SCpubr-book/ @@ -182,13 +182,13 @@ Compute a heatmap of enrichment of gene sets on the context of a diffusion compo # This will query, for the provided components, the expression of the genes # for all cells and plot them in the context of the cells reordered by # the position alongside each dimensional reduction component. - p <- SCpubr::do_RankedExpressionPlot(sample = sample, - features = genes, - nbin = 1, - ctrl = 5, - subsample = NA, - dims = 1:2, - verbose = FALSE) + p <- SCpubr::do_RankedExpressionHeatmap(sample = sample, + features = genes, + nbin = 1, + ctrl = 5, + subsample = NA, + dims = 1:2, + verbose = FALSE) p diff --git a/man/save_Plot.Rd b/man/do_SavePlot.Rd similarity index 64% rename from man/save_Plot.Rd rename to man/do_SavePlot.Rd index 109e8d4..ee0f775 100644 --- a/man/save_Plot.Rd +++ b/man/do_SavePlot.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/save_Plot.R -\name{save_Plot} -\alias{save_Plot} +% Please edit documentation in R/do_SavePlot.R +\name{do_SavePlot} +\alias{do_SavePlot} \title{Save a plot as png, pdf and svg.} \usage{ -save_Plot( +do_SavePlot( plot, figure_path = NULL, create_path = TRUE, @@ -48,7 +48,7 @@ Save a plot as png, pdf and svg. \examples{ \dontrun{ # Check Suggests. - value <- SCpubr:::check_suggests(function_name = "save_Plot", passive = TRUE) + value <- SCpubr:::check_suggests(function_name = "do_SavePlot", passive = TRUE) if (isTRUE(value)){ # Define your Seurat object. @@ -58,35 +58,35 @@ Save a plot as png, pdf and svg. p <- SCpubr::do_DimPlot(sample = sample) # Default parameters. - SCpubr::save_Plot(plot = p) + SCpubr::do_SavePlot(plot = p) # Specifying the name and folder. - SCpubr::save_Plot(plot = p, - figure_path = "/path/to/my/figures/", - file_name = "my_figure") + SCpubr::do_SavePlot(plot = p, + figure_path = "/path/to/my/figures/", + file_name = "my_figure") # Specify to also create a new folder. - SCpubr::save_Plot(plot = p, - figure_path = "/path/to/my/figures/", - file_name = "my_figure", - create_path = TRUE) + SCpubr::do_SavePlot(plot = p, + figure_path = "/path/to/my/figures/", + file_name = "my_figure", + create_path = TRUE) # Set dimensions for the figure. - SCpubr::save_Plot(plot = p, - figure_path = "/path/to/my/figures/", - file_name = "my_figure", - create_path = TRUE, - width = 8, - height = 8) + SCpubr::do_SavePlot(plot = p, + figure_path = "/path/to/my/figures/", + file_name = "my_figure", + create_path = TRUE, + width = 8, + height = 8) # Set quality (dpi). - SCpubr::save_Plot(plot = p, - figure_path = "/path/to/my/figures/", - file_name = "my_figure", - create_path = TRUE, - width = 8, - height = 8, - dpi = 300) + SCpubr::do_SavePlot(plot = p, + figure_path = "/path/to/my/figures/", + file_name = "my_figure", + create_path = TRUE, + width = 8, + height = 8, + dpi = 300) } else if (base::isFALSE(value)){ message("This function can not be used without its suggested packages.") message("Check out which ones are needed using `SCpubr::state_dependencies()`.") diff --git a/man/examples/examples_do_LoadingsPlot.R b/man/examples/examples_do_LoadingsHeatmap.R similarity index 71% rename from man/examples/examples_do_LoadingsPlot.R rename to man/examples/examples_do_LoadingsHeatmap.R index b21016a..8d3435b 100644 --- a/man/examples/examples_do_LoadingsPlot.R +++ b/man/examples/examples_do_LoadingsHeatmap.R @@ -1,6 +1,6 @@ \donttest{ # Check Suggests. - value <- SCpubr:::check_suggests(function_name = "do_LoadingsPlot", passive = TRUE) + value <- SCpubr:::check_suggests(function_name = "do_LoadingsHeatmap", passive = TRUE) if (isTRUE(value)){ # Consult the full documentation in https://enblacar.github.io/SCpubr-book/ @@ -8,8 +8,8 @@ # Define your Seurat object. sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr")) - p <- SCpubr::do_LoadingsPlot(sample = sample, - dims = 1:2) + p <- SCpubr::do_LoadingsHeatmap(sample = sample, + dims = 1:2) p } else if (base::isFALSE(value)){ diff --git a/man/examples/examples_do_RankedEnrichmentPlot.R b/man/examples/examples_do_RankedEnrichmentHeatmap.R similarity index 66% rename from man/examples/examples_do_RankedEnrichmentPlot.R rename to man/examples/examples_do_RankedEnrichmentHeatmap.R index 7074601..2cdefc5 100644 --- a/man/examples/examples_do_RankedEnrichmentPlot.R +++ b/man/examples/examples_do_RankedEnrichmentHeatmap.R @@ -1,6 +1,6 @@ \donttest{ # Check Suggests. - value <- SCpubr:::check_suggests(function_name = "do_RankedEnrichmentPlot", passive = TRUE) + value <- SCpubr:::check_suggests(function_name = "do_RankedEnrichmentHeatmap", passive = TRUE) if (isTRUE(value)){ # Consult the full documentation in https://enblacar.github.io/SCpubr-book/ @@ -17,14 +17,14 @@ # This will query, for the provided components, the enrichment of the gene # sets for all cells and plot them in the context of the cells reordered by # the position alongside each dimensional reduction component. - p <- SCpubr::do_RankedEnrichmentPlot(sample = sample, - input_gene_list = genes, - nbin = 1, - ctrl = 5, - flavor = "Seurat", - subsample = NA, - dims = 1:2, - verbose = FALSE) + p <- SCpubr::do_RankedEnrichmentHeatmap(sample = sample, + input_gene_list = genes, + nbin = 1, + ctrl = 5, + flavor = "Seurat", + subsample = NA, + dims = 1:2, + verbose = FALSE) p diff --git a/man/examples/examples_do_RankedExpressionPlot.R b/man/examples/examples_do_RankedExpressionHeatmap.R similarity index 66% rename from man/examples/examples_do_RankedExpressionPlot.R rename to man/examples/examples_do_RankedExpressionHeatmap.R index 630daa1..41c8591 100644 --- a/man/examples/examples_do_RankedExpressionPlot.R +++ b/man/examples/examples_do_RankedExpressionHeatmap.R @@ -1,6 +1,6 @@ \donttest{ # Check Suggests. - value <- SCpubr:::check_suggests(function_name = "do_RankedExpressionPlot", passive = TRUE) + value <- SCpubr:::check_suggests(function_name = "do_RankedExpressionHeatmap", passive = TRUE) if (isTRUE(value)){ # Consult the full documentation in https://enblacar.github.io/SCpubr-book/ @@ -15,13 +15,13 @@ # This will query, for the provided components, the expression of the genes # for all cells and plot them in the context of the cells reordered by # the position alongside each dimensional reduction component. - p <- SCpubr::do_RankedExpressionPlot(sample = sample, - features = genes, - nbin = 1, - ctrl = 5, - subsample = NA, - dims = 1:2, - verbose = FALSE) + p <- SCpubr::do_RankedExpressionHeatmap(sample = sample, + features = genes, + nbin = 1, + ctrl = 5, + subsample = NA, + dims = 1:2, + verbose = FALSE) p diff --git a/man/examples/examples_do_SavePlot.R b/man/examples/examples_do_SavePlot.R new file mode 100644 index 0000000..3dd4a3e --- /dev/null +++ b/man/examples/examples_do_SavePlot.R @@ -0,0 +1,47 @@ +\dontrun{ + # Check Suggests. + value <- SCpubr:::check_suggests(function_name = "do_SavePlot", passive = TRUE) + + if (isTRUE(value)){ + # Define your Seurat object. + sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr")) + + # Generate a plot. + p <- SCpubr::do_DimPlot(sample = sample) + + # Default parameters. + SCpubr::do_SavePlot(plot = p) + + # Specifying the name and folder. + SCpubr::do_SavePlot(plot = p, + figure_path = "/path/to/my/figures/", + file_name = "my_figure") + + # Specify to also create a new folder. + SCpubr::do_SavePlot(plot = p, + figure_path = "/path/to/my/figures/", + file_name = "my_figure", + create_path = TRUE) + + # Set dimensions for the figure. + SCpubr::do_SavePlot(plot = p, + figure_path = "/path/to/my/figures/", + file_name = "my_figure", + create_path = TRUE, + width = 8, + height = 8) + + # Set quality (dpi). + SCpubr::do_SavePlot(plot = p, + figure_path = "/path/to/my/figures/", + file_name = "my_figure", + create_path = TRUE, + width = 8, + height = 8, + dpi = 300) + } else if (base::isFALSE(value)){ + message("This function can not be used without its suggested packages.") + message("Check out which ones are needed using `SCpubr::state_dependencies()`.") + } +} + diff --git a/man/examples/examples_save_Plot.R b/man/examples/examples_save_Plot.R deleted file mode 100644 index 7263174..0000000 --- a/man/examples/examples_save_Plot.R +++ /dev/null @@ -1,47 +0,0 @@ -\dontrun{ - # Check Suggests. - value <- SCpubr:::check_suggests(function_name = "save_Plot", passive = TRUE) - - if (isTRUE(value)){ - # Define your Seurat object. - sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr")) - - # Generate a plot. - p <- SCpubr::do_DimPlot(sample = sample) - - # Default parameters. - SCpubr::save_Plot(plot = p) - - # Specifying the name and folder. - SCpubr::save_Plot(plot = p, - figure_path = "/path/to/my/figures/", - file_name = "my_figure") - - # Specify to also create a new folder. - SCpubr::save_Plot(plot = p, - figure_path = "/path/to/my/figures/", - file_name = "my_figure", - create_path = TRUE) - - # Set dimensions for the figure. - SCpubr::save_Plot(plot = p, - figure_path = "/path/to/my/figures/", - file_name = "my_figure", - create_path = TRUE, - width = 8, - height = 8) - - # Set quality (dpi). - SCpubr::save_Plot(plot = p, - figure_path = "/path/to/my/figures/", - file_name = "my_figure", - create_path = TRUE, - width = 8, - height = 8, - dpi = 300) - } else if (base::isFALSE(value)){ - message("This function can not be used without its suggested packages.") - message("Check out which ones are needed using `SCpubr::state_dependencies()`.") - } -} - diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index fa785a5..069360c 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -70,7 +70,7 @@ if (base::isFALSE(dep_check[["do_LigandReceptorPlot"]])){ # base::isFALSE(dep_check[["do_CorrelationPlot"]]) & # base::isFALSE(dep_check[["do_ChordDiagramPlot"]]) & # isTRUE(requireNamespace(pkg, quietly = TRUE)) & -# base::isFALSE(dep_check[["save_Plot"]])){ +# base::isFALSE(dep_check[["do_SavePlot"]])){ #p <- SCpubr::do_DimPlot(sample) #data <- data.frame("A" = stats::runif(n = 10), # "B" = stats::runif(n = 10), diff --git a/tests/testthat/test-do_LoadingsPlot.R b/tests/testthat/test-do_LoadingsHeatmap.R similarity index 73% rename from tests/testthat/test-do_LoadingsPlot.R rename to tests/testthat/test-do_LoadingsHeatmap.R index 865ca7e..c970417 100644 --- a/tests/testthat/test-do_LoadingsPlot.R +++ b/tests/testthat/test-do_LoadingsHeatmap.R @@ -1,35 +1,35 @@ -if (base::isFALSE(dep_check[["do_LoadingsPlot"]])){ +if (base::isFALSE(dep_check[["do_LoadingsHeatmap"]])){ - testthat::test_that("do_LoadingsPlot: CRAN essentials", { + testthat::test_that("do_LoadingsHeatmap: CRAN essentials", { genes <- list("A" = rownames(sample)[1:5], "B" = rownames(sample)[6:10], "C" = rownames(sample)[11:15]) - p <- SCpubr::do_LoadingsPlot(sample = sample, + p <- SCpubr::do_LoadingsHeatmap(sample = sample, dims = 1:5) testthat::expect_type(p, "list") }) - testthat::test_that("do_LoadingsPlot: PASS - default", { + testthat::test_that("do_LoadingsHeatmap: PASS - default", { testthat::skip_on_cran() - p <- SCpubr::do_LoadingsPlot(sample = sample, + p <- SCpubr::do_LoadingsHeatmap(sample = sample, dims = 1:10) testthat::expect_type(p, "list") - p <- SCpubr::do_LoadingsPlot(sample = sample, + p <- SCpubr::do_LoadingsHeatmap(sample = sample, dims = 1:10, subsample = 100) testthat::expect_type(p, "list") sample$test <- as.factor(sample$seurat_clusters) - p <- SCpubr::do_LoadingsPlot(sample = sample, + p <- SCpubr::do_LoadingsHeatmap(sample = sample, dims = 1:10, group.by = "test") testthat::expect_type(p, "list") - p <- SCpubr::do_LoadingsPlot(sample = sample, + p <- SCpubr::do_LoadingsHeatmap(sample = sample, dims = 1:10, min.cutoff.loadings = -0.01, max.cutoff.loadings = 0.01, @@ -37,26 +37,26 @@ if (base::isFALSE(dep_check[["do_LoadingsPlot"]])){ max.cutoff.expression = 0.75) testthat::expect_type(p, "list") - p <- SCpubr::do_LoadingsPlot(sample = sample, + p <- SCpubr::do_LoadingsHeatmap(sample = sample, dims = 1:10, use_viridis = TRUE, viridis.direction = 1) testthat::expect_type(p, "list") - p <- SCpubr::do_LoadingsPlot(sample = sample, + p <- SCpubr::do_LoadingsHeatmap(sample = sample, dims = 1:10, use_viridis = TRUE, viridis.direction = -1) testthat::expect_type(p, "list") - p <- SCpubr::do_LoadingsPlot(sample = sample, + p <- SCpubr::do_LoadingsHeatmap(sample = sample, dims = 1:10, use_viridis = FALSE, sequential.direction = 1) testthat::expect_type(p, "list") - p <- SCpubr::do_LoadingsPlot(sample = sample, + p <- SCpubr::do_LoadingsHeatmap(sample = sample, dims = 1:10, use_viridis = FALSE, sequential.direction = -1) diff --git a/tests/testthat/test-do_RankedEnrichmentPlot.R b/tests/testthat/test-do_RankedEnrichmentHeatmap.R similarity index 89% rename from tests/testthat/test-do_RankedEnrichmentPlot.R rename to tests/testthat/test-do_RankedEnrichmentHeatmap.R index 579f863..ad5ea0a 100644 --- a/tests/testthat/test-do_RankedEnrichmentPlot.R +++ b/tests/testthat/test-do_RankedEnrichmentHeatmap.R @@ -1,11 +1,11 @@ -if (base::isFALSE(dep_check[["do_RankedEnrichmentPlot"]])){ +if (base::isFALSE(dep_check[["do_RankedEnrichmentHeatmap"]])){ - testthat::test_that("do_RankedEnrichmentPlot: CRAN essentials", { + testthat::test_that("do_RankedEnrichmentHeatmap: CRAN essentials", { genes <- list("A" = rownames(sample)[1:5], "B" = rownames(sample)[6:10], "C" = rownames(sample)[11:15]) - p <- SCpubr::do_RankedEnrichmentPlot(sample = sample, + p <- SCpubr::do_RankedEnrichmentHeatmap(sample = sample, input_gene_list = genes, subsample = NA, nbin = 1, @@ -18,13 +18,13 @@ if (base::isFALSE(dep_check[["do_RankedEnrichmentPlot"]])){ }) - testthat::test_that("do_RankedEnrichmentPlot: PASS - default", { + testthat::test_that("do_RankedEnrichmentHeatmap: PASS - default", { testthat::skip_on_cran() genes <- list("A" = rownames(sample)[1:5], "B" = rownames(sample)[6:10], "C" = rownames(sample)[11:15]) - p <- SCpubr::do_RankedEnrichmentPlot(sample = sample, + p <- SCpubr::do_RankedEnrichmentHeatmap(sample = sample, input_gene_list = genes, subsample = NA, nbin = 1, @@ -38,7 +38,7 @@ if (base::isFALSE(dep_check[["do_RankedEnrichmentPlot"]])){ enforce_symmetry = FALSE) testthat::expect_type(p, "list") - p <- SCpubr::do_RankedEnrichmentPlot(sample = sample, + p <- SCpubr::do_RankedEnrichmentHeatmap(sample = sample, input_gene_list = genes, subsample = NA, nbin = 1, @@ -53,7 +53,7 @@ if (base::isFALSE(dep_check[["do_RankedEnrichmentPlot"]])){ enforce_symmetry = FALSE) testthat::expect_type(p, "list") - p <- SCpubr::do_RankedEnrichmentPlot(sample = sample, + p <- SCpubr::do_RankedEnrichmentHeatmap(sample = sample, input_gene_list = genes, subsample = NA, nbin = 1, @@ -69,7 +69,7 @@ if (base::isFALSE(dep_check[["do_RankedEnrichmentPlot"]])){ testthat::expect_type(p, "list") - p <- SCpubr::do_RankedEnrichmentPlot(sample = sample, + p <- SCpubr::do_RankedEnrichmentHeatmap(sample = sample, input_gene_list = genes, subsample = 100, nbin = 1, @@ -83,7 +83,7 @@ if (base::isFALSE(dep_check[["do_RankedEnrichmentPlot"]])){ enforce_symmetry = FALSE) testthat::expect_type(p, "list") - testthat::expect_warning({SCpubr::do_RankedEnrichmentPlot(sample = sample, + testthat::expect_warning({SCpubr::do_RankedEnrichmentHeatmap(sample = sample, input_gene_list = genes, subsample = 100, nbin = 1, @@ -97,7 +97,7 @@ if (base::isFALSE(dep_check[["do_RankedEnrichmentPlot"]])){ use_viridis = FALSE, enforce_symmetry = FALSE)}) - testthat::expect_warning({SCpubr::do_RankedEnrichmentPlot(sample = sample, + testthat::expect_warning({SCpubr::do_RankedEnrichmentHeatmap(sample = sample, input_gene_list = genes, subsample = 100, nbin = 1, @@ -111,7 +111,7 @@ if (base::isFALSE(dep_check[["do_RankedEnrichmentPlot"]])){ use_viridis = FALSE, enforce_symmetry = FALSE)}) - suppressMessages({testthat::expect_message({p <- SCpubr::do_RankedEnrichmentPlot(sample = sample, + suppressMessages({testthat::expect_message({p <- SCpubr::do_RankedEnrichmentHeatmap(sample = sample, input_gene_list = genes, subsample = 100, nbin = 1, @@ -122,7 +122,7 @@ if (base::isFALSE(dep_check[["do_RankedEnrichmentPlot"]])){ verbose = TRUE)})}) testthat::expect_type(p, "list") - p <- SCpubr::do_RankedEnrichmentPlot(sample = sample, + p <- SCpubr::do_RankedEnrichmentHeatmap(sample = sample, input_gene_list = genes, subsample = 100, group.by = c("orig.ident", "seurat_clusters"), diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 4a48cc6..8688bb3 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -26,10 +26,10 @@ if (base::isFALSE(dep_check[["utils"]])){ # PACKAGE REPORT - testthat::test_that("utils: package_report - PASS - general", { + testthat::test_that("utils: do_PackageReport - PASS - general", { testthat::skip_on_cran() - suppressMessages({testthat::expect_message(SCpubr::package_report(startup = FALSE))}) - suppressMessages({testthat::expect_message(SCpubr::package_report(startup = TRUE))}) + suppressMessages({testthat::expect_message(SCpubr::do_PackageReport(startup = FALSE))}) + suppressMessages({testthat::expect_message(SCpubr::do_PackageReport(startup = TRUE))}) })