Skip to content

Commit

Permalink
introduced verbose to feat
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixTheStudent committed May 18, 2022
1 parent 5f8092d commit 6f8ca3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions R/plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#'
Expand All @@ -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)
Expand Down Expand Up @@ -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=", "),
Expand Down
6 changes: 5 additions & 1 deletion man/feat.Rd

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

0 comments on commit 6f8ca3e

Please sign in to comment.