From 4c72725213aa04d9efa272e15a73dd212b01d36b Mon Sep 17 00:00:00 2001 From: nbartonicek Date: Sat, 23 Aug 2025 02:08:14 +1000 Subject: [PATCH] Fix profile function --- R/compute_multi_screen_profile.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/R/compute_multi_screen_profile.R b/R/compute_multi_screen_profile.R index 7502a22..b899ebb 100644 --- a/R/compute_multi_screen_profile.R +++ b/R/compute_multi_screen_profile.R @@ -69,7 +69,13 @@ compute_multi_screen_profile <- function(data = NULL, (direction == "up" & .data$log2FC > 0) | (direction == "down" & .data$log2FC < 0) ) %>% - arrange(if (direction == "both") desc(abs(.data$log2FC)) else desc(.data$log2FC)) %>% + arrange( + dplyr::case_when( + direction == "both" ~ -abs(.data$log2FC), + direction == "up" ~ -.data$log2FC, + direction == "down" ~ .data$log2FC + ) + ) %>% slice(seq_len(n_genes_profile)) %>% pull(.data$gene) ) %>% setNames(target)