From ad464123a5a964b909a7e4ee3b4d3198835186d9 Mon Sep 17 00:00:00 2001 From: igor <6363505+igordot@users.noreply.github.com> Date: Tue, 24 May 2022 16:46:49 -0400 Subject: [PATCH] Check for state markers before diffcyt() DS test calcMedians() throws an uninformative error if no state markers are present --- R/diffcyt_wrapper.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/diffcyt_wrapper.R b/R/diffcyt_wrapper.R index fe91d10..edd956b 100644 --- a/R/diffcyt_wrapper.R +++ b/R/diffcyt_wrapper.R @@ -415,6 +415,9 @@ diffcyt <- function(d_input, experiment_info = NULL, marker_info = NULL, if (verbose) message("calculating features...") d_counts <- calcCounts(d_se) if (analysis_type == "DS") { + if (!("state" %in% colData(d_se)$marker_class)) { + stop("no 'state' markers are present in the object") + } d_medians <- calcMedians(d_se) d_medians_by_cluster_marker <- calcMediansByClusterMarker(d_se) d_medians_by_sample_marker <- calcMediansBySampleMarker(d_se)