From ebc5e868f5f1cd275f541577abeb83a70d5d8f68 Mon Sep 17 00:00:00 2001 From: enblacar Date: Wed, 21 Aug 2024 15:38:36 +0200 Subject: [PATCH] Now the named lists in do_DotPlot are plotted in the right order. --- R/do_DotPlot.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/do_DotPlot.R b/R/do_DotPlot.R index 6a62c01..6697d5c 100644 --- a/R/do_DotPlot.R +++ b/R/do_DotPlot.R @@ -270,10 +270,11 @@ do_DotPlot <- function(sample, # Get the length of the longest list. max_len <- max(lengths(features.use)) # Get a padded list - df.map <- as.data.frame(lapply(features.use, function(x) c(x, rep(NA, max_len - length(x))))) %>% + df.map <- as.data.frame(lapply(features.use, function(x) c(x, rep(NA, max_len - length(x)))), check.names = FALSE) %>% tidyr::pivot_longer(cols = dplyr::everything(), names_to = "Name", - values_to = "Gene") + values_to = "Gene") %>% + dplyr::mutate("Name" = factor(.data$Name, levels = names(features))) features.use <- unique(unlist(unname(features)))[!duplicated(unique(unlist(unname(features))))]