import packages and
functions
suppressMessages(library(igraph))
suppressMessages(library(ggplot2))
suppressMessages(library(dplyr))
suppressMessages(library(RColorBrewer))
suppressMessages(library(clusterProfiler))
suppressMessages(library(org.Mm.eg.db))
suppressMessages(library(enrichplot))
suppressMessages(library(xlsx))
set.seed(42)
fl.sources <- list.files("../../scripts/utils/", full.names = T)
tmp <- sapply(fl.sources,source)
##
## Attaching package: 'ggpubr'
## The following object is masked from 'package:enrichplot':
##
## color_palette
load two networks
first
g1 <- readRDS('graph_shrinkage_res0.9_s0.15_TexTerm_subset_TFs_v2.rds')
g2 <- readRDS('graph_shrinkage_res0.9_s0.15_TRM_subset_TFs_v2.rds')
gv1 <- igraph::as_data_frame(g1, "vertices")
## This graph was created by an old(er) igraph version.
## Call upgrade_graph() on it to use with the current igraph version
## For now we convert it on the fly...
gv2 <- igraph::as_data_frame(g2, "vertices")
## This graph was created by an old(er) igraph version.
## Call upgrade_graph() on it to use with the current igraph version
## For now we convert it on the fly...
common_tfs <- intersect(gv1$name, gv2$name)
tex_tfs <- setdiff(gv1$name, gv2$name)
trm_tfs <- setdiff(gv2$name, gv1$name)
gsea analysis
L <- list.files(path="./", pattern = "cluster_[0-9]+.txt")
lapply(L, function(x) gsea(x=x, output_file = 'summary_cluster_GO_KEGG.xlsx'))
## 'select()' returned 1:1 mapping between keys and columns
## Reading KEGG annotation online: "https://rest.kegg.jp/link/mmu/pathway"...
## Reading KEGG annotation online: "https://rest.kegg.jp/list/pathway/mmu"...
## 'select()' returned 1:1 mapping between keys and columns
## 'select()' returned 1:1 mapping between keys and columns
## 'select()' returned 1:1 mapping between keys and columns
## 'select()' returned 1:1 mapping between keys and columns
## 'select()' returned 1:1 mapping between keys and columns
## 'select()' returned 1:1 mapping between keys and columns
## 'select()' returned 1:1 mapping between keys and columns
## 'select()' returned 1:1 mapping between keys and columns
## 'select()' returned 1:1 mapping between keys and columns
## [[1]]
## NULL
##
## [[2]]
## NULL
##
## [[3]]
## NULL
##
## [[4]]
## NULL
##
## [[5]]
## NULL
##
## [[6]]
## NULL
##
## [[7]]
## NULL
##
## [[8]]
## NULL
##
## [[9]]
## NULL
##
## [[10]]
## NULL
session info
sessionInfo()
## R version 4.3.1 (2023-06-16)
## Platform: aarch64-apple-darwin20 (64-bit)
## Running under: macOS Sonoma 14.6.1
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: America/Los_Angeles
## tzcode source: internal
##
## attached base packages:
## [1] grid stats4 stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] ggpubr_0.6.0 xlsx_0.6.5 enrichplot_1.20.0
## [4] org.Mm.eg.db_3.17.0 AnnotationDbi_1.62.2 IRanges_2.34.1
## [7] S4Vectors_0.38.1 Biobase_2.60.0 BiocGenerics_0.46.0
## [10] clusterProfiler_4.9.1 RColorBrewer_1.1-3 dplyr_1.1.2
## [13] ggplot2_3.4.2 igraph_1.5.0
##
## loaded via a namespace (and not attached):
## [1] rstudioapi_0.14 jsonlite_1.8.7 magrittr_2.0.3
## [4] farver_2.1.1 rmarkdown_2.23 fs_1.6.2
## [7] zlibbioc_1.46.0 vctrs_0.6.3 memoise_2.0.1
## [10] RCurl_1.98-1.12 ggtree_3.8.0 rstatix_0.7.2
## [13] htmltools_0.5.5 broom_1.0.5 gridGraphics_0.5-1
## [16] sass_0.4.6 bslib_0.5.0 plyr_1.8.8
## [19] cachem_1.0.8 lifecycle_1.0.3 pkgconfig_2.0.3
## [22] Matrix_1.6-5 R6_2.5.1 fastmap_1.1.1
## [25] gson_0.1.0 GenomeInfoDbData_1.2.10 digest_0.6.31
## [28] aplot_0.1.10 colorspace_2.1-0 patchwork_1.1.2
## [31] RSQLite_2.3.1 fansi_1.0.4 httr_1.4.6
## [34] polyclip_1.10-4 abind_1.4-5 compiler_4.3.1
## [37] bit64_4.0.5 withr_2.5.0 downloader_0.4
## [40] backports_1.4.1 BiocParallel_1.34.2 carData_3.0-5
## [43] viridis_0.6.3 DBI_1.1.3 ggforce_0.4.1
## [46] ggsignif_0.6.4 MASS_7.3-60 HDO.db_0.99.1
## [49] tools_4.3.1 ape_5.7-1 scatterpie_0.2.1
## [52] glue_1.6.2 nlme_3.1-162 GOSemSim_2.26.0
## [55] shadowtext_0.1.2 reshape2_1.4.4 fgsea_1.26.0
## [58] generics_0.1.3 gtable_0.3.3 tidyr_1.3.0
## [61] data.table_1.14.8 tidygraph_1.2.3 car_3.1-2
## [64] utf8_1.2.3 XVector_0.40.0 ggrepel_0.9.3
## [67] pillar_1.9.0 stringr_1.5.0 yulab.utils_0.0.6
## [70] rJava_1.0-6 splines_4.3.1 tweenr_2.0.2
## [73] treeio_1.24.1 lattice_0.21-8 bit_4.0.5
## [76] tidyselect_1.2.0 GO.db_3.17.0 Biostrings_2.68.1
## [79] knitr_1.43 gridExtra_2.3 xfun_0.39
## [82] graphlayouts_1.0.0 stringi_1.7.12 lazyeval_0.2.2
## [85] ggfun_0.1.1 yaml_2.3.7 evaluate_0.21
## [88] codetools_0.2-19 xlsxjars_0.6.1 ggraph_2.1.0
## [91] tibble_3.2.1 qvalue_2.32.0 ggplotify_0.1.1
## [94] cli_3.6.1 munsell_0.5.0 jquerylib_0.1.4
## [97] Rcpp_1.0.10 GenomeInfoDb_1.36.1 png_0.1-8
## [100] parallel_4.3.1 blob_1.2.4 DOSE_3.26.1
## [103] bitops_1.0-7 viridisLite_0.4.2 tidytree_0.4.2
## [106] scales_1.2.1 purrr_1.0.1 crayon_1.5.2
## [109] rlang_1.1.1 cowplot_1.1.1 fastmatch_1.1-3
## [112] KEGGREST_1.40.0