enrichplot icon indicating copy to clipboard operation
enrichplot copied to clipboard

Error when splitting treeplot

Open TJonCooper opened this issue 2 years ago • 1 comments

library(clusterProfiler)
data(geneList, package="DOSE")
gene <- names(geneList)[abs(geneList) > 2]
ego3 <- gseGO(geneList     = geneList,
              OrgDb        = org.Hs.eg.db,
              ont          = "CC",
              minGSSize    = 100,
              maxGSSize    = 500,
              pvalueCutoff = 0.05,
              verbose      = FALSE)

If I want to split a resulting plot by the NES sign, this works:

dotplot(ego3, showCategory=25, split=".sign") + facet_grid(.~.sign)

But this does not:

treeplot(ego3, showCategory=25, split=".sign") + facet_grid(.~.sign)

Error in `combine_vars()`:
! At least one layer must contain all faceting variables: `.sign`.
* Plot is missing `.sign`
* Layer 1 is missing `.sign`
* Layer 2 is missing `.sign`
* Layer 3 is missing `.sign`
* Layer 4 is missing `.sign`
* Layer 5 is missing `.sign`
* Layer 6 is missing `.sign`
* Layer 7 is missing `.sign`
* Layer 8 is missing `.sign`
* Layer 9 is missing `.sign`
Run `rlang::last_error()` to see where the error occurred.
Warning message:
Ignoring unknown parameters: align 

Backtrace:
 1. base `<fn>`(x)
 2. ggplot2:::print.ggplot(x)
 4. ggplot2:::ggplot_build.ggplot(x)
 5. layout$setup(data, plot$data, plot$plot_env)
 6. ggplot2 f(..., self = self)
 7. self$facet$compute_layout(data, self$facet_params)
 8. ggplot2 f(...)
 9. ggplot2::combine_vars(data, params$plot_env, cols, drop = params$drop)
Run `rlang::last_trace()` to see the full context.

Any fix for this?

sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 21.10

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_GB.UTF-8      
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats4    parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] enrichplot_1.15.3      org.Hs.eg.db_3.12.0    AnnotationDbi_1.52.0   IRanges_2.24.1         S4Vectors_0.28.1       clusterProfiler_3.18.1 DOSE_3.16.0            SeuratObject_4.0.4    
 [9] Biobase_2.50.0         BiocGenerics_0.36.1   

loaded via a namespace (and not attached):
 [1] nlme_3.1-152        ggtree_2.4.2        bit64_4.0.5         RColorBrewer_1.1-2  tools_4.0.4         utf8_1.2.2          R6_2.5.1            lazyeval_0.2.2      DBI_1.1.2           colorspace_2.0-3   
[11] tidyselect_1.1.2    gridExtra_2.3       bit_4.0.4           compiler_4.0.4      cli_3.2.0           scatterpie_0.1.7    labeling_0.4.2      shadowtext_0.1.1    scales_1.1.1        stringr_1.4.0      
[21] digest_0.6.29       yulab.utils_0.0.4   pkgconfig_2.0.3     fastmap_1.1.0       rlang_1.0.2         rstudioapi_0.13     RSQLite_2.2.10      gridGraphics_0.5-1  farver_2.1.0        generics_0.1.2     
[31] jsonlite_1.8.0      BiocParallel_1.24.1 GOSemSim_2.16.1     dplyr_1.0.8         magrittr_2.0.2      ggplotify_0.1.0     GO.db_3.12.1        patchwork_1.1.1     Matrix_1.4-0        Rcpp_1.0.8.2       
[41] munsell_0.5.0       fansi_1.0.2         ggnewscale_0.4.6    ape_5.6-2           viridis_0.6.2       lifecycle_1.0.1     stringi_1.7.6       ggraph_2.0.5        MASS_7.3-53.1       plyr_1.8.6         
[51] qvalue_2.22.0       grid_4.0.4          blob_1.2.2          ggrepel_0.9.1       DO.db_2.9           crayon_1.5.0        lattice_0.20-41     graphlayouts_0.8.0  splines_4.0.4       pillar_1.7.0       
[61] fgsea_1.16.0        igraph_1.2.11       reshape2_1.4.4      fastmatch_1.1-3     glue_1.6.2          ggfun_0.0.5         downloader_0.4      data.table_1.14.2   BiocManager_1.30.16 treeio_1.14.4      
[71] vctrs_0.3.8         tweenr_1.0.2        gtable_0.3.0        purrr_0.3.4         polyclip_1.10-0     tidyr_1.2.0         assertthat_0.2.1    cachem_1.0.6        ggplot2_3.3.5       ggforce_0.3.3      
[81] tidygraph_1.2.0     tidytree_0.3.9      viridisLite_0.4.0   tibble_3.1.6        aplot_0.1.2         rvcheck_0.1.8       memoise_2.0.1       ellipsis_0.3.2     

TJonCooper avatar Mar 16 '22 16:03 TJonCooper

@TJonCooper The treeplot does not support faceting yet.

huerqiang avatar Mar 20 '22 06:03 huerqiang