From ac5ef3465c46ea72fb01b6180935cc46412be2c0 Mon Sep 17 00:00:00 2001 From: yun Date: Wed, 26 Jun 2024 21:51:12 +0800 Subject: [PATCH] check matrix is compatible with heatmap matrix --- R/eanno.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R/eanno.R b/R/eanno.R index 154f700..973b1ea 100644 --- a/R/eanno.R +++ b/R/eanno.R @@ -319,6 +319,13 @@ methods::setMethod( )) } ) + if (nrow(mat) != nrow(data)) { + cli::cli_abort(paste( + "{.fn @matrix} of {id} must a {.cls matrix}", + "with {nrow(mat)} observation{?s}, but the heatmap", + "contain {nrow(data)} for {which} annotation." + )) + } object@n <- nrow(mat) } object@matrix <- mat