From 66de5bbdffeb8e04a9d948c3fb5014ffebca679b Mon Sep 17 00:00:00 2001 From: lkhilton Date: Wed, 18 Dec 2024 15:24:42 -0800 Subject: [PATCH] Retain input factor levels for splitGeneGroups --- R/prettyOncoplot.R | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/R/prettyOncoplot.R b/R/prettyOncoplot.R index be94626..879ef40 100644 --- a/R/prettyOncoplot.R +++ b/R/prettyOncoplot.R @@ -907,10 +907,14 @@ prettyOncoplot = function( } - if(missing(splitGeneGroups)){ - row_split = rep("", length(genes)) - }else{ - row_split = factor(splitGeneGroups[genes], levels = unique(splitGeneGroups[genes])) + if (missing(splitGeneGroups)) { + row_split <- rep("", length(genes)) + } else { + if(is.factor(splitGeneGroups)){ + row_split <- splitGeneGroups[genes] + } else( + row_split <- factor(splitGeneGroups[genes], levels = unique(splitGeneGroups[genes])) + ) } if(!missing(groupNames)){