diff --git a/R/plots.R b/R/plots.R index 8507b8e..8f07840 100644 --- a/R/plots.R +++ b/R/plots.R @@ -172,6 +172,9 @@ plot_classes <- function(obj, #' @template param_obj #' @param features A vector of genes (features) to colour by. #' @template param_fast +#' @param verbose feat ignores gene names not present in your object and +#' warns you about them by default. `verbose`=FALSE will suppress the warning +#' (not recommended in interactive use). #' @param ... Arguments passed to cowplot's \link[cowplot]{plot_grid} function, #' for example ncol or rel_widths. #' @@ -184,7 +187,7 @@ plot_classes <- function(obj, #' @importFrom ggplot2 element_blank element_rect element_text #' @examples #' feat(simulated_umis, "CD3E") -feat <- function(obj, features, fast=NULL, ...) { +feat <- function(obj, features, fast=NULL, verbose=TRUE, ...) { check_obj(obj) if(is.null(fast)) fast <- ifelse(ncol(obj$raw)>10e3, TRUE, FALSE) @@ -213,7 +216,7 @@ feat <- function(obj, features, fast=NULL, ...) { features <- unique(features) does_exist<- features %in% rownames(obj$raw) if(sum(does_exist)==0) stop("None of the supplied features were found in your object.") - if(sum(does_exist) < length(does_exist)) { + if(verbose && (sum(does_exist) < length(does_exist))) { cat("These features were not found and will be ignored: ", "\n", paste(features[!does_exist], sep=", "), diff --git a/man/feat.Rd b/man/feat.Rd index ddc3392..5db3a33 100644 --- a/man/feat.Rd +++ b/man/feat.Rd @@ -4,7 +4,7 @@ \alias{feat} \title{Feature plots: Color gene expression in 2D embeddings} \usage{ -feat(obj, features, fast = NULL, ...) +feat(obj, features, fast = NULL, verbose = TRUE, ...) } \arguments{ \item{obj}{A cellpypes object, see section \strong{cellpypes Objects} below.} @@ -15,6 +15,10 @@ feat(obj, features, fast = NULL, ...) (using the scattermore package). If NULL (default), cellpypes decides automatically and fast plotting is done for more than 10k cells.} +\item{verbose}{feat ignores gene names not present in your object and +warns you about them by default. \code{verbose}=FALSE will suppress the warning +(not recommended in interactive use).} + \item{...}{Arguments passed to cowplot's \link[cowplot]{plot_grid} function, for example ncol or rel_widths.} }