ridgeplot showCategory doesn't accept vector of specific pathways
library(clusterProfiler)
library(msigdbr)
data(geneList, package="DOSE")
C3_t2g <- msigdbr(species = "Homo sapiens", category = "C3") %>%
dplyr::select(gs_name, entrez_gene)
em2 <- GSEA(geneList, TERM2GENE = C3_t2g)
set.seed(2020-10-27)
selected_pathways <- sample(em2$Description, 10)
ridgeplot(em2, showCategory = selected_pathways)
Error in seq_len(n) : argument must be coercible to non-negative integer
In addition: Warning messages:
1: In seq_len(n) : first element used of 'length.out' argument
2: In ridgeplot.gseaResult(x, showCategory = showCategory, fill = fill, :
NAs introduced by coercion
https://github.com/YuLab-SMU/enrichplot/blob/master/R/ridgeplot.R#L41-L46
Maybe we will support it in the next version.
I kindly would like support this feature request, also because of this thread at the Bioconductor support pages: https://support.bioconductor.org/p/9146375/
Now supported in v >= 1.23.1
Thanks for adding support for this, but unfortunately it doesn't work yet....
> library(clusterProfiler)
> library(org.Hs.eg.db)
> library(enrichplot)
> library(ggplot2)
>
> data(geneList, package="DOSE")
>
> set.seed(22) # for reproducibility
>
> # generate some results
> ego <- gseGO(geneList = geneList,
+ OrgDb = org.Hs.eg.db,
+ ont = "BP",
+ minGSSize = 100,
+ maxGSSize = 500,
+ eps = 0,
+ pAdjustMethod = "BH",
+ pvalueCutoff = 0.05,
+ verbose = FALSE)
> # show only 4 randomly selected gene sets.
> GOcats4vis <- data.frame(ego)$Description[ sample(1:dim(data.frame(ego))[1], size = 4) ]
> GOcats4vis
[1] "cardiac chamber development" "renal system process"
[3] "kidney epithelium development" "regulation of Wnt signaling pathway"
>
> ## plotting these gene sets in a ridgeplot doesn't work yet...
> ridgeplot(ego, showCategory=GOcats4vis, orderBy = "setSize")
Error in ans[ypos] <- rep(yes, length.out = len)[ypos] :
replacement has length zero
In addition: Warning message:
In rep(yes, length.out = len) : 'x' is NULL so the result will be NULL
>
> ## ... but still does if provided a number.
> ridgeplot(ego, showCategory=8, orderBy = "setSize")
Picking joint bandwidth of 0.281
>
> ## in contrast, dotplot works when specifying gene sets.
> dotplot(ego, showCategory=GOcats4vis, orderBy = "setSize")
>
> packageVersion("enrichplot")
[1] ‘1.23.1’
>
>
>
> ridgeplot(ego, showCategory=GOcats4vis, orderBy = "setSize")
Error in ans[ypos] <- rep(yes, length.out = len)[ypos] :
replacement has length zero
In addition: Warning message:
In rep(yes, length.out = len) : 'x' is NULL so the result will be NULL
> traceback()
17: ifelse(is.na(coord_limits), limits, coord_limits)
16: expand_limits_continuous_trans(range_continuous, expand, coord_limits,
trans)
15: expand_limits_discrete_trans(limits, expand, coord_limits, range_continuous = range_continuous)
14: expand_limits_discrete(limits, expand, coord_limits, range_continuous = scale$range_c$range)
13: expand_limits_scale(scale, expansion, limits, coord_limits = coord_limits)
12: view_scales_from_scale(scale_y, self$limits$y, self$expand)
11: setup_panel_params(..., self = self)
10: self$coord$setup_panel_params(scale_x, scale_y, params = self$coord_params)
9: (function (scale_x, scale_y)
{
self$coord$setup_panel_params(scale_x, scale_y, params = self$coord_params)
})(dots[[1L]][[1L]], dots[[2L]][[1L]])
8: mapply(FUN = f, ..., SIMPLIFY = FALSE)
7: Map(setup_panel_params, scales_x, scales_y)
6: setup_panel_params(..., self = self)
5: layout$setup_panel_params()
4: ggplot_build.ggplot(x)
3: ggplot_build(x)
2: print.ggplot(x)
1: (function (x, ...)
UseMethod("print"))(x)
>
@guidohooiveld Fixed by #263
Again thanks for adding support for this, but it unfortunately it is no longer working
> library(clusterProfiler)
> library(org.Hs.eg.db)
> library(enrichplot)
> library(ggplot2)
> data(geneList, package="DOSE")
> set.seed(22) # for reproducibility
> # generate some results
> ego <- gseGO(geneList = geneList,
+ OrgDb = org.Hs.eg.db,
+ ont = "BP",
+ minGSSize = 100,
+ maxGSSize = 500,
+ eps = 0,
+ pAdjustMethod = "BH",
+ pvalueCutoff = 0.05,
+ verbose = FALSE)
> # show only 4 randomly selected gene sets.
> GOcats4vis <- data.frame(ego)$Description[ sample(1:dim(data.frame(ego))[1], size = 4) ]
> GOcats4vis
[1] "cardiac chamber development" "renal system process" "kidney epithelium development"
[4] "regulation of Wnt signaling pathway"
> ## plotting these gene sets in a ridgeplot doesn't work yet...
> ridgeplot(ego, showCategory=GOcats4vis, orderBy = "setSize")
Error in seq_len(n) : argument must be coercible to non-negative integer
In addition: Warning messages:
1: In seq_len(n) : first element used of 'length.out' argument
2: In ridgeplot.gseaResult(x, showCategory = showCategory, fill = fill, :
NAs introduced by coercion
> traceback()
3: ridgeplot.gseaResult(x, showCategory = showCategory, fill = fill,
core_enrichment = core_enrichment, label_format = label_format,
...)
2: ridgeplot(ego, showCategory = GOcats4vis, orderBy = "setSize")
1: ridgeplot(ego, showCategory = GOcats4vis, orderBy = "setSize")
> ## ... but still does if provided a number.
> ridgeplot(ego, showCategory=8, orderBy = "setSize")
Picking joint bandwidth of 0.281
> ## in contrast, dotplot works when specifying gene sets.
> dotplot(ego, showCategory=GOcats4vis, orderBy = "setSize")
> packageVersion("enrichplot")
[1] ‘1.22.0’
> session_info()
─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.3.2 (2023-10-31)
os macOS Ventura 13.5.2
system aarch64, darwin20
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/New_York
date 2024-02-13
rstudio 2023.06.0+421 Mountain Hydrangea (desktop)
pandoc 3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)
─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
abind 1.4-5 2016-07-21 [1] CRAN (R 4.3.0)
AnnotationDbi * 1.64.1 2023-11-02 [1] Bioconductor
AnnotationHub 3.10.0 2023-10-26 [1] Bioconductor
ape 5.7-1 2023-03-13 [1] CRAN (R 4.3.0)
aplot 0.2.2 2023-10-06 [1] CRAN (R 4.3.1)
ashr * 2.2-63 2023-08-21 [1] CRAN (R 4.3.0)
babelgene 22.9 2022-09-29 [1] CRAN (R 4.3.0)
Biobase * 2.62.0 2023-10-26 [1] Bioconductor
BiocFileCache 2.10.1 2023-10-26 [1] Bioconductor
BiocGenerics * 0.48.1 2023-11-02 [1] Bioconductor
BiocManager 1.30.22 2023-08-08 [1] CRAN (R 4.3.0)
BiocParallel 1.36.0 2023-10-26 [1] Bioconductor
BiocVersion 3.18.1 2023-11-18 [1] Bioconductor 3.18 (R 4.3.2)
biomaRt 2.58.2 2024-01-30 [1] Bioconductor 3.18 (R 4.3.2)
Biostrings 2.70.2 2024-01-28 [1] Bioconductor 3.18 (R 4.3.2)
bit 4.0.5 2022-11-15 [1] CRAN (R 4.3.0)
bit64 4.0.5 2020-08-30 [1] CRAN (R 4.3.0)
bitops 1.0-7 2021-04-24 [1] CRAN (R 4.3.0)
blob 1.2.4 2023-03-17 [1] CRAN (R 4.3.0)
bookdown 0.37 2023-12-01 [1] CRAN (R 4.3.1)
bslib 0.6.1 2023-11-28 [1] CRAN (R 4.3.1)
cachem 1.0.8 2023-05-01 [1] CRAN (R 4.3.0)
cellranger 1.1.0 2016-07-27 [1] CRAN (R 4.3.0)
cli 3.6.2 2023-12-11 [1] CRAN (R 4.3.1)
clusterProfiler * 4.10.0 2023-11-06 [1] Bioconductor
codetools 0.2-19 2023-02-01 [1] CRAN (R 4.3.2)
colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.3.0)
conflicted * 1.2.0 2023-02-01 [1] CRAN (R 4.3.0)
cowplot * 1.1.3 2024-01-22 [1] CRAN (R 4.3.1)
crayon 1.5.2 2022-09-29 [1] CRAN (R 4.3.0)
crosstalk 1.2.1 2023-11-23 [1] CRAN (R 4.3.1)
curl 5.2.0 2023-12-08 [1] CRAN (R 4.3.1)
data.table 1.15.0 2024-01-30 [1] CRAN (R 4.3.2)
DBI 1.2.1 2024-01-12 [1] CRAN (R 4.3.2)
dbplyr 2.4.0 2023-10-26 [1] CRAN (R 4.3.1)
DelayedArray 0.28.0 2023-11-06 [1] Bioconductor
DESeq2 * 1.42.0 2023-10-26 [1] Bioconductor
devtools * 2.4.5 2022-10-11 [1] CRAN (R 4.3.0)
digest 0.6.34 2024-01-11 [1] CRAN (R 4.3.2)
DOSE * 3.28.2 2023-12-10 [1] Bioconductor 3.18 (R 4.3.1)
dplyr * 1.1.4 2023-11-17 [1] CRAN (R 4.3.1)
DT * 0.31 2023-12-09 [1] CRAN (R 4.3.1)
edgeR * 4.0.14 2024-01-30 [1] Bioconductor 3.18 (R 4.3.2)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.3.0)
EnhancedVolcano * 1.13.2 2024-02-05 [1] Github (benjibromberg/EnhancedVolcano@6d1a0f6)
enrichplot * 1.22.0 2023-11-06 [1] Bioconductor
evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.1)
fansi 1.0.6 2023-12-08 [1] CRAN (R 4.3.1)
farver 2.1.1 2022-07-06 [1] CRAN (R 4.3.0)
fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0)
fastmatch 1.1-4 2023-08-18 [1] CRAN (R 4.3.0)
fgsea 1.28.0 2023-10-26 [1] Bioconductor
filelock 1.0.3 2023-12-11 [1] CRAN (R 4.3.1)
forcats * 1.0.0 2023-01-29 [1] CRAN (R 4.3.0)
fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.0)
generics 0.1.3 2022-07-05 [1] CRAN (R 4.3.0)
GenomeInfoDb * 1.38.5 2023-12-28 [1] Bioconductor 3.18 (R 4.3.2)
GenomeInfoDbData 1.2.11 2023-12-12 [1] Bioconductor
GenomicRanges * 1.54.1 2023-10-30 [1] Bioconductor
ggbreak * 0.1.2 2023-06-26 [1] CRAN (R 4.3.0)
ggforce 0.4.1 2022-10-04 [1] CRAN (R 4.3.0)
ggfun 0.1.4 2024-01-19 [1] CRAN (R 4.3.1)
ggplot2 * 3.4.4 2023-10-12 [1] CRAN (R 4.3.1)
ggplotify 0.1.2 2023-08-09 [1] CRAN (R 4.3.0)
ggraph 2.1.0 2022-10-09 [1] CRAN (R 4.3.0)
ggrepel * 0.9.5 2024-01-10 [1] CRAN (R 4.3.2)
ggridges 0.5.6 2024-01-23 [1] CRAN (R 4.3.1)
ggtree 3.10.0 2023-11-06 [1] Bioconductor
glue 1.7.0 2024-01-09 [1] CRAN (R 4.3.2)
GO.db 3.18.0 2023-12-12 [1] Bioconductor
GOSemSim 2.28.1 2024-01-20 [1] Bioconductor 3.18 (R 4.3.2)
graph 1.80.0 2023-10-26 [1] Bioconductor
graphite 1.48.0 2023-10-26 [1] Bioconductor
graphlayouts 1.1.0 2024-01-19 [1] CRAN (R 4.3.1)
grateful * 0.2.4 2023-10-22 [1] CRAN (R 4.3.1)
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.3.0)
gridGraphics 0.5-1 2020-12-13 [1] CRAN (R 4.3.0)
gson 0.1.0 2023-03-07 [1] CRAN (R 4.3.0)
gtable 0.3.4 2023-08-21 [1] CRAN (R 4.3.0)
HDO.db 0.99.1 2023-07-12 [1] Bioconductor
hms 1.1.3 2023-03-21 [1] CRAN (R 4.3.0)
htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.1)
htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.3.1)
httpuv 1.6.14 2024-01-26 [1] CRAN (R 4.3.1)
httr 1.4.7 2023-08-15 [1] CRAN (R 4.3.0)
igraph 2.0.1.1 2024-01-30 [1] CRAN (R 4.3.1)
interactiveDisplayBase 1.40.0 2023-10-26 [1] Bioconductor
invgamma 1.1 2017-05-07 [1] CRAN (R 4.3.0)
IRanges * 2.36.0 2023-10-26 [1] Bioconductor
irlba 2.3.5.1 2022-10-03 [1] CRAN (R 4.3.0)
jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.3.0)
jsonlite 1.8.8 2023-12-04 [1] CRAN (R 4.3.1)
KEGGgraph * 1.62.0 2023-10-26 [1] Bioconductor
KEGGREST 1.42.0 2023-10-26 [1] Bioconductor
knitr 1.45 2023-10-30 [1] CRAN (R 4.3.1)
labeling 0.4.3 2023-08-29 [1] CRAN (R 4.3.0)
later 1.3.2 2023-12-06 [1] CRAN (R 4.3.1)
lattice 0.22-5 2023-10-24 [1] CRAN (R 4.3.1)
lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.3.0)
lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.1)
limma * 3.58.1 2023-11-02 [1] Bioconductor
locfit 1.5-9.8 2023-06-11 [1] CRAN (R 4.3.0)
lubridate * 1.9.3 2023-09-27 [1] CRAN (R 4.3.1)
magick * 2.8.2 2023-12-20 [1] CRAN (R 4.3.1)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0)
MASS 7.3-60.0.1 2024-01-13 [1] CRAN (R 4.3.2)
Matrix 1.6-5 2024-01-11 [1] CRAN (R 4.3.1)
MatrixGenerics * 1.14.0 2023-10-26 [1] Bioconductor
matrixStats * 1.2.0 2023-12-11 [1] CRAN (R 4.3.1)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.3.0)
mime 0.12 2021-09-28 [1] CRAN (R 4.3.0)
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.3.1)
mixsqp 0.3-54 2023-12-20 [1] CRAN (R 4.3.1)
msigdbr * 7.5.1 2022-03-30 [1] CRAN (R 4.3.0)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.3.0)
nlme 3.1-164 2023-11-27 [1] CRAN (R 4.3.1)
org.Bt.eg.db * 3.18.0 2023-12-12 [1] Bioconductor
org.Hs.eg.db * 3.18.0 2023-12-12 [1] Bioconductor
Orthology.eg.db * 3.18.0 2024-01-28 [1] Bioconductor
patchwork 1.2.0 2024-01-08 [1] CRAN (R 4.3.2)
pathview * 1.42.0 2023-10-26 [1] Bioconductor
pheatmap * 1.0.12 2019-01-04 [1] CRAN (R 4.3.0)
pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.0)
pkgbuild 1.4.3 2023-12-10 [1] CRAN (R 4.3.1)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.0)
pkgload 1.3.4 2024-01-16 [1] CRAN (R 4.3.2)
plyr 1.8.9 2023-10-02 [1] CRAN (R 4.3.1)
png 0.1-8 2022-11-29 [1] CRAN (R 4.3.0)
polyclip 1.10-6 2023-09-27 [1] CRAN (R 4.3.1)
prettyunits 1.2.0 2023-09-24 [1] CRAN (R 4.3.1)
profvis 0.3.8 2023-05-02 [1] CRAN (R 4.3.0)
progress 1.2.3 2023-12-06 [1] CRAN (R 4.3.1)
promises 1.2.1 2023-08-10 [1] CRAN (R 4.3.0)
purrr * 1.0.2 2023-08-10 [1] CRAN (R 4.3.0)
qvalue 2.34.0 2023-10-26 [1] Bioconductor
R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.0)
rappdirs 0.3.3 2021-01-31 [1] CRAN (R 4.3.0)
RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.3.0)
Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.3.2)
RCurl 1.98-1.14 2024-01-09 [1] CRAN (R 4.3.2)
reactome.db 1.86.2 2023-12-12 [1] Bioconductor
ReactomePA * 1.46.0 2023-10-26 [1] Bioconductor
readr * 2.1.5 2024-01-10 [1] CRAN (R 4.3.2)
readxl 1.4.3 2023-07-06 [1] CRAN (R 4.3.0)
remotes 2.4.2.1 2023-07-18 [1] CRAN (R 4.3.0)
reshape2 1.4.4 2020-04-09 [1] CRAN (R 4.3.0)
Rgraphviz 2.46.0 2023-10-26 [1] Bioconductor
rlang 1.1.3 2024-01-10 [1] CRAN (R 4.3.2)
rmarkdown 2.25 2023-09-18 [1] CRAN (R 4.3.1)
rmdformats * 1.0.4 2022-05-17 [1] CRAN (R 4.3.0)
RSQLite 2.3.5 2024-01-21 [1] CRAN (R 4.3.1)
rstudioapi * 0.15.0 2023-07-07 [1] CRAN (R 4.3.0)
S4Arrays 1.2.0 2023-10-26 [1] Bioconductor
S4Vectors * 0.40.2 2023-11-25 [1] Bioconductor 3.18 (R 4.3.2)
sass 0.4.8 2023-12-06 [1] CRAN (R 4.3.1)
scales 1.3.0 2023-11-28 [1] CRAN (R 4.3.1)
scatterpie 0.2.1 2023-06-07 [1] CRAN (R 4.3.0)
scico * 1.5.0 2023-08-14 [1] CRAN (R 4.3.0)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)
shadowtext 0.1.3 2024-01-19 [1] CRAN (R 4.3.1)
shiny 1.8.0 2023-11-17 [1] CRAN (R 4.3.1)
SparseArray 1.2.3 2023-12-25 [1] Bioconductor 3.18 (R 4.3.2)
SPIA * 2.54.0 2023-10-26 [1] Bioconductor
SQUAREM 2021.1 2021-01-13 [1] CRAN (R 4.3.0)
statmod 1.5.0 2023-01-06 [1] CRAN (R 4.3.0)
stringi 1.8.3 2023-12-11 [1] CRAN (R 4.3.1)
stringr * 1.5.1 2023-11-14 [1] CRAN (R 4.3.1)
SummarizedExperiment * 1.32.0 2023-11-06 [1] Bioconductor
tibble * 3.2.1 2023-03-20 [1] CRAN (R 4.3.0)
tidygraph 1.3.1 2024-01-30 [1] CRAN (R 4.3.1)
tidyr * 1.3.1 2024-01-24 [1] CRAN (R 4.3.1)
tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.3.0)
tidytree 0.4.6 2023-12-12 [1] CRAN (R 4.3.1)
tidyverse * 2.0.0 2023-02-22 [1] CRAN (R 4.3.0)
timechange 0.3.0 2024-01-18 [1] CRAN (R 4.3.1)
treeio 1.26.0 2023-11-06 [1] Bioconductor
truncnorm 1.0-9 2023-03-20 [1] CRAN (R 4.3.0)
tweenr 2.0.2 2022-09-06 [1] CRAN (R 4.3.0)
tximport * 1.30.0 2023-10-26 [1] Bioconductor
tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.3.0)
urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.3.0)
usethis * 2.2.2 2023-07-06 [1] CRAN (R 4.3.0)
utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.1)
vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.1)
viridis 0.6.5 2024-01-29 [1] CRAN (R 4.3.2)
viridisLite 0.4.2 2023-05-02 [1] CRAN (R 4.3.0)
withr 3.0.0 2024-01-16 [1] CRAN (R 4.3.2)
xfun 0.41 2023-11-01 [1] CRAN (R 4.3.1)
XML 3.99-0.16.1 2024-01-22 [1] CRAN (R 4.3.1)
xml2 1.3.6 2023-12-04 [1] CRAN (R 4.3.1)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.3.0)
XVector 0.42.0 2023-10-26 [1] Bioconductor
yaml 2.3.8 2023-12-11 [1] CRAN (R 4.3.1)
yulab.utils 0.1.4 2024-01-28 [1] CRAN (R 4.3.2)
zlibbioc 1.48.0 2023-10-26 [1] Bioconductor
[1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
You will have to update enrichplot; note that the fix is not available in v1.22 (= release version) that you are using.
> BiocManager::install(c('YuLab-SMU/enrichplot'), force=TRUE)
>
> packageVersion("enrichplot")
[1] ‘1.23.1.992’
>
After running your code I then get:
Oh thanks @guidohooiveld!!
I totally didn't realize it was only available through the git release so far! Much appreciated!!!