Skip to content

Color and size of nodes and edges dependent on other variables #327

@jcasadogp

Description

@jcasadogp

Hi,

I have realized that the enrichplot from Bioconductor has been substituted by the enrichplot package in this Github repository and some functionalities that were previously available are not anymore.

Before, there where parameters like foldChange or colorEdge that let represent variables such as pvalue, logFC, Count... as the color and/or size of the nodes or edges. Now, I can see that there are some variables like color_category, color_item or color_edge, but they admit one single color.

How can I replicate the previous functionalities in the new package?

This is the object I am trying to visualize:

> edox
#
# over-representation test
#
#...@organism 	 human 
#...@ontology 	 Reactome 
#...@keytype 	 ENTREZID 
#...@gene 	 chr [1:513] "4312" "8318" "10874" "55143" "55388" "991" "6280" "2305" "9493" "1062" "3868" "4605" "9833" "9133" "6279" "10403" "8685" "597" "7153" "23397" "6278" "79733" "259266" "1381" "3627" "27074" "6241" "55165" ...
#...pvalues adjusted by 'BH' with cutoff <0.05 
#...57 enriched terms found
'data.frame':	57 obs. of  12 variables:
 $ ID            : chr  "R-HSA-69620" "R-HSA-69618" "R-HSA-2500257" "R-HSA-141424" ...
 $ Description   : chr  "Cell Cycle Checkpoints" "Mitotic Spindle Checkpoint" "Resolution of Sister Chromatid Cohesion" "Amplification of signal from the kinetochores" ...
 $ GeneRatio     : chr  "38/338" "22/338" "23/338" "20/338" ...
 $ BgRatio       : chr  "292/11146" "112/11146" "127/11146" "96/11146" ...
 $ RichFactor    : num  0.13 0.196 0.181 0.208 0.208 ...
 $ FoldEnrichment: num  4.29 6.48 5.97 6.87 6.87 ...
 $ zScore        : num  10.08 10.3 9.97 10.21 10.21 ...
 $ pvalue        : num  2.01e-14 1.99e-12 3.69e-12 6.57e-12 6.57e-12 ...
 $ p.adjust      : num  1.69e-11 8.40e-10 1.04e-09 1.11e-09 1.11e-09 ...
 $ qvalue        : num  1.52e-11 7.54e-10 9.30e-10 9.93e-10 9.93e-10 ...
 $ geneID        : chr  "CDC45/CDCA8/MCM10/CDC20/CENPE/CCNB2/NDC80/UBE2C/SKA1/CENPM/CENPN/UBE2S/CCNA2/CDK1/ERCC6L/MAD2L1/KIF18A/BIRC5/AU"| __truncated__ "CDCA8/CDC20/CENPE/NDC80/UBE2C/SKA1/CENPM/CENPN/UBE2S/ERCC6L/MAD2L1/KIF18A/BIRC5/AURKB/KIF2C/PLK1/BUB1B/ZWINT/CE"| __truncated__ "CDCA8/CDC20/CENPE/CCNB2/NDC80/SKA1/CENPM/CENPN/CDK1/ERCC6L/MAD2L1/KIF18A/BIRC5/AURKB/CCNB1/KIF2C/PLK1/BUB1B/ZWI"| __truncated__ "CDCA8/CDC20/CENPE/NDC80/SKA1/CENPM/CENPN/ERCC6L/MAD2L1/KIF18A/BIRC5/AURKB/KIF2C/PLK1/BUB1B/ZWINT/CENPU/SPC25/CENPI/TAOK1" ...
 $ Count         : int  38 22 23 20 20 20 28 26 28 21 ...
#...Citation
Guangchuang Yu, Qing-Yu He. ReactomePA: an R/Bioconductor package for reactome pathway analysis and visualization. Molecular BioSystems. 2016, 12(2):477-479 

> head(edox)
                         ID                                                                          Description GeneRatio   BgRatio RichFactor FoldEnrichment    zScore       pvalue     p.adjust       qvalue
R-HSA-69620     R-HSA-69620                                                               Cell Cycle Checkpoints    38/338 292/11146  0.1301370       4.291440 10.078786 2.005501e-14 1.688632e-11 1.515737e-11
R-HSA-69618     R-HSA-69618                                                           Mitotic Spindle Checkpoint    22/338 112/11146  0.1964286       6.477494 10.302678 1.994474e-12 8.396736e-10 7.537013e-10
R-HSA-2500257 R-HSA-2500257                                              Resolution of Sister Chromatid Cohesion    23/338 127/11146  0.1811024       5.972092  9.965420 3.693147e-12 1.036543e-09 9.304139e-10
R-HSA-141424   R-HSA-141424                                        Amplification of signal from the kinetochores    20/338  96/11146  0.2083333       6.870069 10.214648 6.571903e-12 1.106708e-09 9.933950e-10
R-HSA-141444   R-HSA-141444 Amplification  of signal from unattached  kinetochores via a MAD2  inhibitory signal    20/338  96/11146  0.2083333       6.870069 10.214648 6.571903e-12 1.106708e-09 9.933950e-10
R-HSA-9648025 R-HSA-9648025                                           EML4 and NUDC in mitotic spindle formation    20/338 117/11146  0.1709402       5.636980  8.916323 2.886522e-10 4.050752e-08 3.636004e-08
                                                                                                                                                                                                                                      geneID
R-HSA-69620   CDC45/CDCA8/MCM10/CDC20/CENPE/CCNB2/NDC80/UBE2C/SKA1/CENPM/CENPN/UBE2S/CCNA2/CDK1/ERCC6L/MAD2L1/KIF18A/BIRC5/AURKB/CHEK1/CCNB1/MCM5/MCM2/KIF2C/CDC25A/CDC6/PLK1/BUB1B/GTSE1/EXO1/ZWINT/CENPU/SPC25/CENPI/CCNE1/ORC6/ORC1/TAOK1
R-HSA-69618                                                                                             CDCA8/CDC20/CENPE/NDC80/UBE2C/SKA1/CENPM/CENPN/UBE2S/ERCC6L/MAD2L1/KIF18A/BIRC5/AURKB/KIF2C/PLK1/BUB1B/ZWINT/CENPU/SPC25/CENPI/TAOK1
R-HSA-2500257                                                                                      CDCA8/CDC20/CENPE/CCNB2/NDC80/SKA1/CENPM/CENPN/CDK1/ERCC6L/MAD2L1/KIF18A/BIRC5/AURKB/CCNB1/KIF2C/PLK1/BUB1B/ZWINT/CENPU/SPC25/CENPI/TAOK1
R-HSA-141424                                                                                                        CDCA8/CDC20/CENPE/NDC80/SKA1/CENPM/CENPN/ERCC6L/MAD2L1/KIF18A/BIRC5/AURKB/KIF2C/PLK1/BUB1B/ZWINT/CENPU/SPC25/CENPI/TAOK1
R-HSA-141444                                                                                                        CDCA8/CDC20/CENPE/NDC80/SKA1/CENPM/CENPN/ERCC6L/MAD2L1/KIF18A/BIRC5/AURKB/KIF2C/PLK1/BUB1B/ZWINT/CENPU/SPC25/CENPI/TAOK1
R-HSA-9648025                                                                                                       CDCA8/CDC20/CENPE/NDC80/SKA1/CENPM/CENPN/ERCC6L/MAD2L1/KIF18A/BIRC5/AURKB/KIF2C/PLK1/BUB1B/ZWINT/CENPU/SPC25/CENPI/TAOK1
              Count
R-HSA-69620      38
R-HSA-69618      22
R-HSA-2500257    23
R-HSA-141424     20
R-HSA-141444     20
R-HSA-9648025    20
> packageVersion("enrichplot")
[1] '1.26.6'
> getAnywhere(cnetplot)
A single object matching 'cnetplot' was found
It was found in the following places
  package:ReactomePA
  package:enrichplot
  namespace:ggtangle
with value

function (x, layout = igraph::layout_nicely, showCategory = 5, 
    color_category = "#E5C494", size_category = 1, color_item = "#B3B3B3", 
    size_item = 1, color_edge = "grey", size_edge = 0.5, node_label = "all", 
    foldChange = NULL, hilight = "none", hilight_alpha = 0.3, 
    ...) 
{
    UseMethod("cnetplot", x)
}
<bytecode: 0x561f1f7b19b0>
<environment: namespace:ggtangle>
sessionInfo()
R version 4.4.2 (2024-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.1 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0

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

time zone: Etc/UTC
tzcode source: system (glibc)

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

other attached packages:
 [1] DOSE_4.0.1                  graphite_1.52.0             ReactomePA_1.50.0           msigdbr_25.1.0              corrplot_0.95               ggpubr_0.6.1                enrichplot_1.26.6          
 [8] tictoc_1.2.1                ggVennDiagram_1.5.5         RColorBrewer_1.1-3          ggsci_3.2.0                 EnhancedVolcano_1.24.0      ggrepel_0.9.6               mclust_6.1.1               
[15] gridExtra_2.3               DT_0.33                     presto_1.0.0                data.table_1.17.6           reactome.db_1.89.0          EnsDb.Hsapiens.v86_2.99.0   org.Hs.eg.db_3.20.0        
[22] fgsea_1.32.4                edgeR_4.4.2                 limma_3.62.2                ensembldb_2.30.0            AnnotationFilter_1.30.0     GenomicFeatures_1.58.0      AnnotationDbi_1.68.0       
[29] dittoSeq_1.18.0             AnnotationHub_3.14.0        BiocFileCache_2.14.0        dbplyr_2.5.0                rmarkdown_2.29              cowplot_1.2.0               scater_1.34.1              
[36] scran_1.34.0                scuttle_1.16.0              patchwork_1.3.1             SingleCellExperiment_1.28.1 SingleR_2.8.0               SummarizedExperiment_1.36.0 Biobase_2.66.0             
[43] GenomicRanges_1.58.0        GenomeInfoDb_1.42.3         IRanges_2.40.1              S4Vectors_0.44.0            BiocGenerics_0.52.0         MatrixGenerics_1.18.1       matrixStats_1.5.0          
[50] Seurat_5.3.0                SeuratObject_5.1.0          sp_2.2-0                    harmony_1.2.3               Rcpp_1.1.0                  hdf5r_1.3.12                tidyr_1.3.1                
[57] stringr_1.5.1               tibble_3.3.0                readr_2.1.5                 ggplot2_3.5.2               dplyr_1.1.4                

loaded via a namespace (and not attached):
  [1] R.methodsS3_1.8.2         goftest_1.2-3             Biostrings_2.74.1         vctrs_0.6.5               ggtangle_0.0.7            spatstat.random_3.4-1     digest_0.6.37             png_0.1-8                
  [9] deldir_2.0-4              parallelly_1.45.0         MASS_7.3-64               reshape2_1.4.4            httpuv_1.6.16             qvalue_2.38.0             withr_3.0.2               xfun_0.52                
 [17] ggfun_0.1.9               survival_3.8-3            memoise_2.0.1             ggbeeswarm_0.7.2          gson_0.1.0                tidytree_0.4.6            zoo_1.8-14                pbapply_1.7-2            
 [25] R.oo_1.27.1               Formula_1.2-5             KEGGREST_1.46.0           promises_1.3.3            httr_1.4.7                rstatix_0.7.2             restfulr_0.0.16           globals_0.18.0           
 [33] fitdistrplus_1.2-4        rstudioapi_0.17.1         UCSC.utils_1.2.0          miniUI_0.1.2              generics_0.1.4            babelgene_22.9            curl_6.4.0                zlibbioc_1.52.0          
 [41] ggraph_2.2.1              ScaledMatrix_1.14.0       polyclip_1.10-7           GenomeInfoDbData_1.2.13   SparseArray_1.6.2         xtable_1.8-4              evaluate_1.0.4            S4Arrays_1.6.0           
 [49] hms_1.1.3                 irlba_2.3.5.1             colorspace_2.1-1          filelock_1.0.3            ROCR_1.0-11               reticulate_1.42.0         spatstat.data_3.1-6       magrittr_2.0.3           
 [57] lmtest_0.9-40             later_1.4.2               viridis_0.6.5             ggtree_3.14.0             lattice_0.22-6            spatstat.geom_3.4-1       future.apply_1.20.0       scattermore_1.2          
 [65] XML_3.99-0.18             RcppAnnoy_0.0.22          pillar_1.11.0             nlme_3.1-167              compiler_4.4.2            beachmat_2.22.0           RSpectra_0.16-2           stringi_1.8.7            
 [73] tensor_1.5.1              GenomicAlignments_1.42.0  plyr_1.8.9                crayon_1.5.3              abind_1.4-8               BiocIO_1.16.0             gridGraphics_0.5-1        locfit_1.5-9.12          
 [81] graphlayouts_1.2.2        bit_4.6.0                 fastmatch_1.1-6           codetools_0.2-20          BiocSingular_1.22.0       plotly_4.11.0             mime_0.13                 splines_4.4.2            
 [89] fastDummies_1.7.5         sparseMatrixStats_1.18.0  knitr_1.50                blob_1.2.4                BiocVersion_3.20.0        fs_1.6.6                  listenv_0.9.1             DelayedMatrixStats_1.28.1
 [97] ggsignif_0.6.4            ggplotify_0.1.2           Matrix_1.7-3              statmod_1.5.0             tzdb_0.5.0                tweenr_2.0.3              pkgconfig_2.0.3           pheatmap_1.0.13          
[105] tools_4.4.2               cachem_1.1.0              RSQLite_2.4.1             viridisLite_0.4.2         DBI_1.2.3                 fastmap_1.2.0             scales_1.4.0              grid_4.4.2               
[113] ica_1.0-3                 Rsamtools_2.22.0          broom_1.0.8               BiocManager_1.30.26       dotCall64_1.2             graph_1.84.1              carData_3.0-5             RANN_2.6.2               
[121] farver_2.1.2              tidygraph_1.3.1           yaml_2.3.10               rtracklayer_1.66.0        cli_3.6.5                 purrr_1.0.4               lifecycle_1.0.4           uwot_0.2.3               
[129] bluster_1.16.0            backports_1.5.0           BiocParallel_1.40.2       gtable_0.3.6              rjson_0.2.23              ggridges_0.5.6            progressr_0.15.1          parallel_4.4.2           
[137] ape_5.8-1                 jsonlite_2.0.0            RcppHNSW_0.6.0            bitops_1.0-9              bit64_4.6.0-1             assertthat_0.2.1          Rtsne_0.17                yulab.utils_0.2.0        
[145] spatstat.utils_3.1-4      BiocNeighbors_2.0.1       metapod_1.14.0            GOSemSim_2.32.0           dqrng_0.4.1               spatstat.univar_3.1-3     R.utils_2.13.0            lazyeval_0.2.2           
[153] shiny_1.11.1              htmltools_0.5.8.1         GO.db_3.20.0              sctransform_0.4.2         rappdirs_0.3.3            glue_1.8.0                spam_2.11-1               httr2_1.1.2              
[161] XVector_0.46.0            RCurl_1.98-1.17           treeio_1.30.0             igraph_2.1.4              R6_2.6.1                  labeling_0.4.3            cluster_2.1.8             aplot_0.2.8              
[169] DelayedArray_0.32.0       tidyselect_1.2.1          vipor_0.4.7               ProtGenerics_1.38.0       ggforce_0.5.0             car_3.1-3                 future_1.58.0             rsvd_1.0.5               
[177] KernSmooth_2.23-26        htmlwidgets_1.6.4         rlang_1.1.6               spatstat.sparse_3.1-0     spatstat.explore_3.4-3    ggnewscale_0.5.2          beeswarm_0.4.0 

Thank you in advance!!

Julia

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions