From d1fbcc2b1dc5e3cd79c605c89ee93c822546f9da Mon Sep 17 00:00:00 2001 From: vertesy Date: Thu, 20 Jun 2024 12:43:27 +0200 Subject: [PATCH] nf catch arg name qSeuViolin, etc --- R/Seurat.Utils.Visualization.R | 25 +++++++++++++++++++------ man/DimPlot.ClusterNames.Rd | 4 ++-- man/PlotFilters.Rd | 7 ++++++- man/plot3D.umap.Rd | 6 +++--- man/plotAndSaveHeatmaps.Rd | 1 + man/scGOEnrichment.Rd | 3 +++ 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/R/Seurat.Utils.Visualization.R b/R/Seurat.Utils.Visualization.R index 2d67423..c8bd96f 100644 --- a/R/Seurat.Utils.Visualization.R +++ b/R/Seurat.Utils.Visualization.R @@ -11,7 +11,9 @@ #' #' @description This function plots the filtering thresholds and distributions for Seurat objects, #' using four panels to highlight the relationship between gene- and UMI-counts, and the -#' ribosomal- and mitochondrial-content. +#' ribosomal- and mitochondrial-content. !! Default arguments assume that `p` is a list of +#' parameters, present in the global environment, with elements `thr.lp.mito`, `thr.hp.mito`, +#' `thr.lp.ribo`, `thr.hp.ribo`, `thr.lp.nFeature_RNA`, and `thr.hp.nFeature_RNA`. #' #' @param ls.obj A list of Seurat objects to be analyzed. Default: `ls.Seurat`. #' @param parentdir The parent directory where the plots will be stored. Default: `OutDirOrig`. @@ -32,6 +34,9 @@ #' @examples #' \dontrun{ #' if (interactive()) { +#' # !! Default arguments assume that `p` is a list of parameters, present in the global +#' environment, with elements `thr.lp.mito`, `thr.hp.mito`, `thr.lp.ribo`, `thr.hp.ribo`, +#' `thr.lp.nFeature_RNA`, and `thr.hp.nFeature_RNA`. #' PlotFilters(ls.Seurat) #' } #' } @@ -1608,6 +1613,7 @@ SeuratColorVector <- function(ident = NULL, obj = combined.obj, plot.colors = FA #' #' @examples #' # Assuming `results` is the output from `calculateAverageMetaData`: +#' results <- calculateAverageMetaData(obj = combined.obj) #' plotAndSaveHeatmaps(results, path = "path/to/save/heatmaps", file.prefix = "myData_") #' #' @return Invisible. The function primarily generates and saves files without returning data. @@ -1762,6 +1768,9 @@ qSeuViolin <- function( feature %in% colnames(obj@meta.data) || feature %in% rownames(obj) ) + if(!is.null("idents")) warning("Use arg. ident instead of idents!\n", immediate. = TRUE) + if(!is.null("features")) warning("Use arg. feature instead of features!\n", immediate. = TRUE) + ttl <- if (suffix.2.title) { paste(feature, "|", suffix) } else { @@ -2143,14 +2152,17 @@ umapHiLightSel <- function(obj = combined.obj, #' @examples #' \dontrun{ #' if (interactive()) { -#' DimPlot.ClusterNames() +#' DimPlot.ClusterNames(obj = combined.obj) #' } #' } #' @export DimPlot.ClusterNames <- function( obj = combined.obj, - ident = "cl.names.top.gene.res.0.5", - reduction = "umap", title = ident, ...) { + ident = GetNamedClusteringRuns(obj)[1], + reduction = "umap", + title = ident, + ...) { + # Seurat::DimPlot( object = obj, reduction = reduction, group.by = ident, label = TRUE, repel = TRUE, ... @@ -2919,7 +2931,8 @@ AutoNumber.by.UMAP <- function(obj = combined.obj, obj[[NewMetaCol]] <- NewMeta if (plot) { - clUMAP(obj, ident = NewMetaCol) + x <- clUMAP(obj, ident = NewMetaCol) + print(x) } return(obj) } @@ -3783,8 +3796,8 @@ plot3D.umap.gene <- function( #' @export plot3D.umap <- function( - category, obj = combined.obj, + category = GetNamedClusteringRuns(obj)[1], annotate.by = category, suffix = NULL, dotsize = 1.25, diff --git a/man/DimPlot.ClusterNames.Rd b/man/DimPlot.ClusterNames.Rd index 2a67cd9..a0724e3 100644 --- a/man/DimPlot.ClusterNames.Rd +++ b/man/DimPlot.ClusterNames.Rd @@ -6,7 +6,7 @@ \usage{ DimPlot.ClusterNames( obj = combined.obj, - ident = "cl.names.top.gene.res.0.5", + ident = GetNamedClusteringRuns(obj)[1], reduction = "umap", title = ident, ... @@ -29,7 +29,7 @@ Plot UMAP with Cluster names. \examples{ \dontrun{ if (interactive()) { - DimPlot.ClusterNames() + DimPlot.ClusterNames(obj = combined.obj) } } } diff --git a/man/PlotFilters.Rd b/man/PlotFilters.Rd index d2e0d8d..0842282 100644 --- a/man/PlotFilters.Rd +++ b/man/PlotFilters.Rd @@ -59,11 +59,16 @@ PlotFilters( \description{ This function plots the filtering thresholds and distributions for Seurat objects, using four panels to highlight the relationship between gene- and UMI-counts, and the -ribosomal- and mitochondrial-content. +ribosomal- and mitochondrial-content. !! Default arguments assume that \code{p} is a list of +parameters, present in the global environment, with elements \code{thr.lp.mito}, \code{thr.hp.mito}, +\code{thr.lp.ribo}, \code{thr.hp.ribo}, \code{thr.lp.nFeature_RNA}, and \code{thr.hp.nFeature_RNA}. } \examples{ \dontrun{ if (interactive()) { + # !! Default arguments assume that `p` is a list of parameters, present in the global + environment, with elements `thr.lp.mito`, `thr.hp.mito`, `thr.lp.ribo`, `thr.hp.ribo`, + `thr.lp.nFeature_RNA`, and `thr.hp.nFeature_RNA`. PlotFilters(ls.Seurat) } } diff --git a/man/plot3D.umap.Rd b/man/plot3D.umap.Rd index 1a609ce..23ca667 100644 --- a/man/plot3D.umap.Rd +++ b/man/plot3D.umap.Rd @@ -5,8 +5,8 @@ \title{plot3D.umap} \usage{ plot3D.umap( - category, obj = combined.obj, + category = GetNamedClusteringRuns(obj)[1], annotate.by = category, suffix = NULL, dotsize = 1.25, @@ -15,11 +15,11 @@ plot3D.umap( ) } \arguments{ +\item{obj}{The Seurat object for which the 3D umap plot will be generated. Default: combined.obj} + \item{category}{The metadata column based on which the 3D UMAP will be plotted. Default: First returned result from GetNamedClusteringRuns(obj) function.} -\item{obj}{The Seurat object for which the 3D umap plot will be generated. Default: combined.obj} - \item{annotate.by}{The cluster or grouping to be used for automatic annotation. Default: First returned result from GetNamedClusteringRuns(obj) function.} diff --git a/man/plotAndSaveHeatmaps.Rd b/man/plotAndSaveHeatmaps.Rd index d24f60d..ba63f8a 100644 --- a/man/plotAndSaveHeatmaps.Rd +++ b/man/plotAndSaveHeatmaps.Rd @@ -53,6 +53,7 @@ The file names will start with the provided \code{file.prefix}, followed by the } \examples{ # Assuming `results` is the output from `calculateAverageMetaData`: +results <- calculateAverageMetaData(obj = combined.obj) plotAndSaveHeatmaps(results, path = "path/to/save/heatmaps", file.prefix = "myData_") } diff --git a/man/scGOEnrichment.Rd b/man/scGOEnrichment.Rd index 1c0cb38..db83102 100644 --- a/man/scGOEnrichment.Rd +++ b/man/scGOEnrichment.Rd @@ -15,6 +15,7 @@ scGOEnrichment( qvalueCutoff = 0.2, save = TRUE, suffix = NULL, + check.gene.symbols = TRUE, ... ) } @@ -38,6 +39,8 @@ scGOEnrichment( \item{save}{Logical. Save the results as a data frame. Default: TRUE.} \item{suffix}{Character. Suffix to append to the output file name. Default: 'GO.Enrichments'.} + +\item{check.gene.symbols}{Logical. Check gene symbols for validity. Default: TRUE.} } \value{ A data frame with GO enrichment results.