From 8a014e869e37556a46b192094eac505d2ac62eb9 Mon Sep 17 00:00:00 2001 From: Insaynoah <74536546+Insaynoah@users.noreply.github.com> Date: Thu, 27 Jun 2024 11:51:26 +0300 Subject: [PATCH] error when rank is null and more than 100 features --- R/plotAbundance.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/plotAbundance.R b/R/plotAbundance.R index adc4b769..fcbab9a7 100644 --- a/R/plotAbundance.R +++ b/R/plotAbundance.R @@ -185,16 +185,16 @@ setMethod("plotAbundance", signature = c("SummarizedExperiment"), rank <- "Feature" rowData(x)[[ rank ]] <- rownames(x) } - # If more than 500 features, revert to first taxonomic rank - if(is.null(rank) && nrow(assay(x,assay.type=assay_name))>500){ - rank = taxonomyRanks(x)[1] - } abund_data <- .get_abundance_data(x, rank, assay.type, order_rank_by, use_relative) order_sample_by <- .norm_order_sample_by(order_sample_by, unique(abund_data$colour_by), x) + if(is.null(rank) && nrow(assay(x,assay.type=assay_name))>100){ + stop("The data contains more than 100 rows. + The abundance plot cannot be created.", call. = FALSE) + } features_data <- NULL if(!is.null(features) || !is.null(order_sample_by)){ features_data <- .get_features_data(features, order_sample_by, x)