@@ -314,6 +314,18 @@ MarkersPlot <- function(
314314 sig_mat <- as.data.frame(sig_mat )
315315 rownames(sig_mat ) <- sig_mat $ gene
316316 sig_mat $ gene <- NULL
317+ # There might be some groups failed to run DE analysis
318+ # So we just exclude them
319+ failed_groups <- setdiff(groups , colnames(sig_mat ))
320+ if (length(failed_groups ) > 1 ) {
321+ warning(
322+ " [MarkersPlot] The following groups in `subset_by` '" , subset_by_1 ,
323+ " ' are not found in the markers data frame and will be ignored: " ,
324+ paste(failed_groups , collapse = " , " ),
325+ immediate. = TRUE
326+ )
327+ }
328+ groups <- intersect(groups , colnames(sig_mat ))
317329 sig_mat <- sig_mat [genes , groups , drop = FALSE ]
318330 sig_mat <- as.matrix(sig_mat )
319331
@@ -335,6 +347,18 @@ MarkersPlot <- function(
335347 ds_mat <- as.data.frame(ds_mat )
336348 rownames(ds_mat ) <- ds_mat $ gene
337349 ds_mat $ gene <- NULL
350+ # There might be some groups failed to run DE analysis
351+ # So we just exclude them
352+ failed_groups <- setdiff(groups , colnames(ds_mat ))
353+ if (length(failed_groups ) > 1 ) {
354+ warning(
355+ " [MarkersPlot] The following groups in `subset_by` '" , subset_by_1 ,
356+ " ' are not found in the markers data frame and will be ignored: " ,
357+ paste(failed_groups , collapse = " , " ),
358+ immediate. = TRUE
359+ )
360+ }
361+ groups <- intersect(groups , colnames(ds_mat ))
338362 ds_mat <- ds_mat [genes , groups , drop = FALSE ]
339363 ds_mat <- as.matrix(ds_mat )
340364
0 commit comments