From 43da156878f641d923e6c8df2e6677a0f100960a Mon Sep 17 00:00:00 2001 From: Guangchuang Yu Date: Wed, 6 Nov 2024 17:24:39 +0800 Subject: [PATCH] supports passing ID to showCategory in `ridgeplot()` (2024-11-06, Wed, #295) --- DESCRIPTION | 4 ++-- NEWS.md | 3 ++- R/ridgeplot.R | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 24d8946..7fc7d94 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: enrichplot Title: Visualization of Functional Enrichment Result -Version: 1.27.1.003 +Version: 1.27.1.004 Authors@R: c( person(given = "Guangchuang", family = "Yu", email = "guangchuangyu@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6485-8781")), person(given = "Chun-Hui", family = "Gao", email = "gaospecial@gmail.com", role = "ctb", comment = c(ORCID = "0000-0002-1445-7939"))) @@ -13,7 +13,7 @@ Imports: ggnewscale, ggplot2, ggrepel (>= 0.9.0), - ggtangle (>= 0.0.4.002), + ggtangle (>= 0.0.4.003), graphics, grid, igraph, diff --git a/NEWS.md b/NEWS.md index 720e8d4..7c424c3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ -# enrichplot 1.27.1.003 +# enrichplot 1.27.1.004 ++ supports passing ID to 'showCategory' in `ridgeplot()` (2024-11-06, Wed, #295) + enhancement of `cnetplot()` (2024-11-06, Wed) - 'node_label' can be a vector of selected items/genes to specify the items to be displayed (#293) - 'node_label' can be 'exclusive' to label genes that are uniquely belongs to categories (#253) diff --git a/R/ridgeplot.R b/R/ridgeplot.R index 3caa12c..f2d22b3 100644 --- a/R/ridgeplot.R +++ b/R/ridgeplot.R @@ -39,6 +39,10 @@ ridgeplot.gseaResult <- function(x, showCategory=30, fill="p.adjust", selected <- seq_len(showCategory) } else if (inherits(showCategory, "character")) { ii <- match(showCategory, x@result$Description) + if (all(is.na(ii))) { + ii <- match(showCategory, x@result$ID) + } + ii <- ii[!is.na(ii)] selected <- x@result[ii, "ID"] } else { warning("showCategory should be a number of pathways or a vector of selected pathways")