• Data Setup
    • Import DGElist Data
  • KEGG Analysis
  • Pathway specific heatmaps
  • Export Data

Last updated: 2023-01-21

Checks: 7 0

Knit directory: SRB_2022/1_analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(12345) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 01a61cb. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  .gitignore

Unstaged changes:
    Modified:   0_data/RDS_objects/dge.rds
    Modified:   0_data/RDS_objects/enrichGO.rds
    Modified:   0_data/RDS_objects/enrichGO_sig.rds
    Modified:   0_data/RDS_objects/fc.rds
    Modified:   0_data/RDS_objects/lfc.rds
    Modified:   0_data/RDS_objects/lmTreat.rds
    Modified:   0_data/RDS_objects/lmTreat_all.rds
    Modified:   0_data/RDS_objects/lmTreat_sig.rds
    Modified:   0_data/RDS_objects/pub.rds
    Deleted:    1_analysis/mmu04613.pv.multi.png
    Deleted:    1_analysis/mmu04658.pv.multi.png
    Deleted:    1_analysis/mmu04659.pv.multi.png
    Deleted:    1_analysis/mmu04660.pv.multi.png
    Deleted:    1_analysis/mmu04710.pv.multi.png
    Deleted:    1_analysis/mmu05235.pv.multi.png
    Deleted:    1_analysis/testGraph.gml
    Modified:   2_plots/de/heat_down_1.05.svg
    Modified:   2_plots/de/heat_down_1.1.svg
    Modified:   2_plots/de/heat_down_1.5.svg
    Modified:   2_plots/de/heat_up_1.05.svg
    Modified:   2_plots/de/heat_up_1.1.svg
    Modified:   2_plots/de/heat_up_1.5.svg
    Modified:   2_plots/de/ma_1.05.png
    Modified:   2_plots/de/ma_1.1.png
    Modified:   2_plots/de/ma_1.5.png
    Modified:   2_plots/de/pval_1.05.svg
    Modified:   2_plots/de/pval_1.1.svg
    Modified:   2_plots/de/pval_1.5.svg
    Modified:   2_plots/de/vol_1.05.png
    Modified:   2_plots/de/vol_1.1.png
    Modified:   2_plots/de/vol_1.5.png
    Modified:   2_plots/go/bp_dot_1.05.svg
    Modified:   2_plots/go/bp_dot_1.1.svg
    Modified:   2_plots/go/bp_dot_1.5.svg
    Modified:   2_plots/go/cc_dot_1.05.svg
    Modified:   2_plots/go/cc_dot_1.1.svg
    Modified:   2_plots/go/cc_dot_1.5.svg
    Modified:   2_plots/go/mf_dot_1.05.svg
    Modified:   2_plots/go/mf_dot_1.1.svg
    Modified:   2_plots/go/mf_dot_1.5.svg
    Modified:   2_plots/go/upset_1.05.svg
    Modified:   2_plots/go/upset_1.1.svg
    Modified:   2_plots/go/upset_1.5.svg
    Modified:   2_plots/ipa/Cardiovascular System.svg
    Modified:   2_plots/ipa/Cell-To-Cell Signaling.svg
    Modified:   2_plots/ipa/Cellular Movement.svg
    Modified:   2_plots/ipa/diseaseAndFunction.svg
    Modified:   2_plots/ipa/pathways.svg
    Modified:   2_plots/ipa/upstream_2.svg
    Modified:   2_plots/kegg/heat_1.05_Cytokine-cytokine receptor interaction.svg
    Modified:   2_plots/kegg/heat_1.05_Focal adhesion.svg
    Modified:   2_plots/kegg/heat_1.05_Hematopoietic cell lineage.svg
    Modified:   2_plots/kegg/heat_1.05_Leukocyte transendothelial migration.svg
    Modified:   2_plots/kegg/heat_1.05_PI3K-Akt signaling pathway.svg
    Modified:   2_plots/kegg/heat_1.05_Vascular smooth muscle contraction.svg
    Modified:   2_plots/kegg/heat_1.1_Cytokine-cytokine receptor interaction.svg
    Modified:   2_plots/kegg/heat_1.1_Focal adhesion.svg
    Modified:   2_plots/kegg/heat_1.1_Hematopoietic cell lineage.svg
    Modified:   2_plots/kegg/heat_1.1_Leukocyte transendothelial migration.svg
    Modified:   2_plots/kegg/heat_1.1_PI3K-Akt signaling pathway.svg
    Modified:   2_plots/kegg/heat_1.1_Vascular smooth muscle contraction.svg
    Modified:   2_plots/kegg/heat_1.5_Cytokine-cytokine receptor interaction.svg
    Modified:   2_plots/kegg/heat_1.5_Focal adhesion.svg
    Modified:   2_plots/kegg/heat_1.5_Hematopoietic cell lineage.svg
    Modified:   2_plots/kegg/heat_1.5_Leukocyte transendothelial migration.svg
    Modified:   2_plots/kegg/heat_1.5_PI3K-Akt signaling pathway.svg
    Modified:   2_plots/kegg/heat_1.5_Vascular smooth muscle contraction.svg
    Modified:   2_plots/kegg/kegg_dot_1.05.svg
    Modified:   2_plots/kegg/kegg_dot_1.1.svg
    Modified:   2_plots/kegg/kegg_dot_1.5.svg
    Modified:   2_plots/kegg/mmu04060.png
    Modified:   2_plots/kegg/mmu04060.xml
    Modified:   2_plots/kegg/mmu04151.xml
    Modified:   2_plots/kegg/mmu04270.xml
    Modified:   2_plots/kegg/mmu04510.xml
    Modified:   2_plots/kegg/mmu04640.png
    Modified:   2_plots/kegg/mmu04640.xml
    Modified:   2_plots/kegg/mmu04670.xml
    Deleted:    2_plots/kegg/pv_1.05_mmu04060.png
    Deleted:    2_plots/kegg/pv_1.05_mmu04151.png
    Deleted:    2_plots/kegg/pv_1.05_mmu04270.png
    Deleted:    2_plots/kegg/pv_1.05_mmu04510.png
    Deleted:    2_plots/kegg/pv_1.05_mmu04640.png
    Deleted:    2_plots/kegg/pv_1.05_mmu04670.png
    Deleted:    2_plots/kegg/pv_1.1_mmu04060.png
    Deleted:    2_plots/kegg/pv_1.1_mmu04151.png
    Deleted:    2_plots/kegg/pv_1.1_mmu04270.png
    Deleted:    2_plots/kegg/pv_1.1_mmu04510.png
    Deleted:    2_plots/kegg/pv_1.1_mmu04640.png
    Deleted:    2_plots/kegg/pv_1.1_mmu04670.png
    Deleted:    2_plots/kegg/pv_1.5_mmu04060.png
    Deleted:    2_plots/kegg/pv_1.5_mmu04151.png
    Deleted:    2_plots/kegg/pv_1.5_mmu04270.png
    Deleted:    2_plots/kegg/pv_1.5_mmu04510.png
    Deleted:    2_plots/kegg/pv_1.5_mmu04640.png
    Deleted:    2_plots/kegg/pv_1.5_mmu04670.png
    Modified:   2_plots/kegg/upset_kegg_1.05.svg
    Modified:   2_plots/kegg/upset_kegg_1.1.svg
    Modified:   2_plots/kegg/upset_kegg_1.5.svg
    Modified:   2_plots/qc/PCA_IntvsCont.svg
    Modified:   2_plots/qc/counts_after_filtering_3_3.svg
    Modified:   2_plots/qc/counts_before_after_filtering_3_3.svg
    Modified:   2_plots/qc/counts_before_filtering.svg
    Modified:   2_plots/qc/library_size.svg
    Modified:   2_plots/reactome/react_dot_1.05.svg
    Modified:   2_plots/reactome/react_dot_1.1.svg
    Modified:   2_plots/reactome/react_dot_1.5.svg
    Modified:   2_plots/reactome/upset_react_1.05.svg
    Modified:   2_plots/reactome/upset_react_1.1.svg
    Modified:   2_plots/reactome/upset_react_1.5.svg
    Modified:   3_output/enrichGO_sig.xlsx
    Modified:   3_output/enrichKEGG_all.xlsx
    Modified:   3_output/enrichKEGG_sig.xlsx
    Modified:   3_output/lmTreat_all.xlsx
    Modified:   3_output/lmTreat_fc1.5_voom2_all_fdr.xlsx
    Modified:   3_output/lmTreat_sig.xlsx
    Modified:   3_output/reactome_all.xlsx
    Modified:   3_output/reactome_sig.xlsx
    Modified:   README.md
    Modified:   SRB_2022.Rproj
    Deleted:    test plz delete me.Rmd
    Deleted:    test-plz-delete-me.html

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (1_analysis/kegg.Rmd) and HTML (docs/kegg.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 159f352 tranmanhha135 2023-01-21 adding for pathview
html 159f352 tranmanhha135 2023-01-21 adding for pathview
Rmd 4d51a4e tranmanhha135 2023-01-20 test png
html 4d51a4e tranmanhha135 2023-01-20 test png
html 691cf34 Ha Manh Tran 2023-01-20 Build site.
Rmd 7f6bab2 Ha Manh Tran 2023-01-20 workflowr::wflow_publish(here::here("1_analysis/*.Rmd"))
Rmd b6cf190 tranmanhha135 2023-01-19 quick commit
Rmd 3119fad tranmanhha135 2022-11-05 build website
html 3119fad tranmanhha135 2022-11-05 build website

Data Setup

# working with data
library(dplyr)
library(magrittr)
library(readr)
library(tibble)
library(reshape2)
library(tidyverse)
library(KEGGREST)

# Visualisation:
library(kableExtra)
library(ggplot2)
library(grid)
library(pander)
library(viridis)
library(cowplot)
library(pheatmap)

# Custom ggplot
library(ggplotify)
library(ggpubr)
library(ggbiplot)
library(ggrepel)

# Bioconductor packages:
library(edgeR)
library(limma)
library(Glimma)
library(clusterProfiler)
library(org.Mm.eg.db)
library(enrichplot)
library(pathview)

theme_set(theme_minimal())
pub <- readRDS(here::here("0_data/RDS_objects/pub.rds"))

Import DGElist Data

DGElist object containing the raw feature count, sample metadata, and gene metadata, created in the Set Up stage.

# load DGElist previously created in the set up
dge <- readRDS(here::here("0_data/RDS_objects/dge.rds"))
fc <- readRDS(here::here("0_data/RDS_objects/fc.rds"))
lfc <- readRDS(here::here("0_data/RDS_objects/lfc.rds"))
lmTreat <- readRDS(here::here("0_data/RDS_objects/lmTreat.rds"))
lmTreat_sig <- readRDS(here::here("0_data/RDS_objects/lmTreat_sig.rds"))

KEGG Analysis

KEGG enrichment analysis is performed with the significant DE genes that have absolute FC > 1.5 ( genes from Limma). Top 30 most significant KEGG are displayed. All enriched KEGG pathways are exported

# chosing the pathways of interest
kegg_id <- c("mmu04670", "mmu04640", "mmu04270", "mmu04151", "mmu04510", "mmu04060")
kegg_pathway <- KEGGREST::keggGet(kegg_id)
enrichKEGG <- list()
enrichKEGG_all <- list()
enrichKEGG_sig <- list()
for (i in 1:length(fc)) {
  x <- fc[i] %>% as.character()
  # find enriched KEGG pathways
  enrichKEGG[[x]] <- clusterProfiler::enrichKEGG(
    gene = lmTreat_sig[[x]]$entrezid,
    keyType = "kegg",
    organism = "mmu",
    pvalueCutoff = 0.05,
    pAdjustMethod = "none"
  )

  enrichKEGG[[x]] <- enrichKEGG[[x]] %>% 
    clusterProfiler::setReadable(OrgDb = org.Mm.eg.db, keyType = "ENTREZID")
   
  enrichKEGG_all[[x]] <- enrichKEGG[[x]]@result

  # filter the significant and print top 30
  enrichKEGG_sig[[x]] <- enrichKEGG_all[[x]] %>%
    dplyr::filter(pvalue <= 0.05) %>%
    separate(col = BgRatio, sep = "/", into = c("Total", "Universe")) %>%
    dplyr::mutate(
      logPval = -log(pvalue, 10),
      GeneRatio = Count / as.numeric(Total)
    ) %>%
    dplyr::select(c("Description", "GeneRatio", "pvalue", "logPval", "p.adjust", "qvalue", "geneID", "Count"))
  
  # # at the beginnning of a word (after 35 characters), add a newline. shorten the y axis for dot plot 
  # enrichKEGG_sig[[x]]$Description <- sub(pattern = "(.{1,35})(?:$| )", 
  #                                      replacement = "\\1\n", 
  #                                      x = enrichKEGG_sig[[x]]$Description)
  # 
  # # remove the additional newline at the end of the string
  # enrichKEGG_sig[[x]]$Description <- sub(pattern = "\n$", 
  #                                      replacement = "", 
  #                                      x = enrichKEGG_sig[[x]]$Description)
}
p=1
enrichKEGG_sig[[p]] %>%
  kable(caption = "Significantly enriched KEGG pathways") %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Significantly enriched KEGG pathways
Description GeneRatio pvalue logPval p.adjust qvalue geneID Count
mmu04713 Circadian entrainment 0.2448980 0.0000000 7.941626 0.0000000 0.0000025 Kcnj3/Gria4/Cacna1c/Ryr1/Gnai1/Gucy1a2/Grin2b/Adcy3/Gngt2/Plcb1/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Gng11/Gng2/Adcyap1r1/Rps6ka5/Plcb2/Ryr3/Cacna1h/Gnb5/Gng7/Gnb4 24
mmu04514 Cell adhesion molecules 0.1868132 0.0000000 7.697813 0.0000000 0.0000025 Itga4/Lrrc4c/Ptprd/Nlgn1/Cdh2/Itgb7/Lrrc4b/Icam1/Jam3/Cldn8/Slitrk3/Ptprm/Cdh5/Cd226/Itgal/Esam/H2-Ab1/Nlgn3/Nfasc/H2-Ob/Sele/Pecam1/H2-Eb1/Neo1/Cldn5/H2-Aa/Ntng1/Itga8/Spn/Cldn1/Cd4/Vcan/Nlgn2/Jam2 34
mmu04724 Glutamatergic synapse 0.2123894 0.0000002 6.671493 0.0000002 0.0000174 Slc1a3/Kcnj3/Gria4/Cacna1c/Grik1/Gnai1/Grin2b/Adcy3/Shank2/Gngt2/Plcb1/Adcy4/Adcy7/Gng11/Grik2/Gng2/Plcb2/Slc38a1/Dlg4/Gnb5/Gng7/Gnb4/Cacna1a/Pld2 24
mmu04371 Apelin signaling pathway 0.1897810 0.0000007 6.160273 0.0000007 0.0000424 Ryr1/Slc8a1/Nos3/Gnai1/Mef2c/Adcy3/Gngt2/Pik3r6/Plcb1/Slc8a3/Adcy4/Adcy7/Gng11/Aplnr/Agtr1a/Gng2/Myl3/Plcb2/Ryr3/Akt3/Ccn2/Gnb5/Gng7/Apln/Gnb4/Lipe 26
mmu05414 Dilated cardiomyopathy 0.2127660 0.0000021 5.671588 0.0000021 0.0001045 Cacna1c/Sgcd/Itga4/Igf1/Slc8a1/Itgb7/Cacna2d1/Adcy3/Itga1/Slc8a3/Adcy4/Adcy7/Lama2/Itga7/Myl3/Cacng7/Sgcb/Itga8/Itgb4/Cacnb4 20
mmu04340 Hedgehog signaling pathway 0.2586207 0.0000031 5.503784 0.0000031 0.0001117 Gli1/Ihh/Hhip/Evc2/Ptch2/Evc/Kif7/Ccnd2/Gli3/Lrp2/Gpr161/Arrb1/Arrb2/Ptch1/Iqce 15
mmu04015 Rap1 signaling pathway 0.1542056 0.0000032 5.496372 0.0000032 0.0001117 Hgf/Angpt1/Kdr/Igf1/Evl/Rasgrp3/Gnai1/Pfn2/Lpar4/Grin2b/Prkd1/Adcy3/Tek/Plcb1/Rasgrp2/Kit/Adcy4/Adcy7/Itgal/Vegfc/Magi2/Pard6g/Kitl/Arap3/Tln2/Plcb2/Akt3/Apbb1ip/Lat/Pdgfrb/Lcp2/F2r/Sipa1 33
mmu05032 Morphine addiction 0.2087912 0.0000051 5.289652 0.0000051 0.0001574 Kcnj3/Gnai1/Pde1b/Adcy3/Gngt2/Adcy4/Adcy7/Gabra4/Gng11/Pde1a/Gng2/Arrb1/Arrb2/Gnb5/Gng7/Gnb4/Gabbr1/Pde8a/Cacna1a 19
mmu04022 cGMP-PKG signaling pathway 0.1618497 0.0000070 5.157122 0.0000070 0.0001788 Cacna1c/Adra1a/Slc8a1/Nos3/Gnai1/Ednrb/Mef2c/Gucy1a2/Adcy3/Pik3r6/Plcb1/Slc8a3/Trpc6/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Agtr1a/Kcnma1/Ednra/Bdkrb2/Nfatc4/Plcb2/Pde5a/Akt3/Atp2b4/Atp1a2/Irs1 28
mmu05412 Arrhythmogenic right ventricular cardiomyopathy 0.2207792 0.0000073 5.137196 0.0000073 0.0001788 Cacna1c/Lef1/Sgcd/Itga4/Slc8a1/Cdh2/Itgb7/Cacna2d1/Itga1/Slc8a3/Lama2/Itga7/Cacng7/Sgcb/Itga8/Itgb4/Cacnb4 17
mmu04512 ECM-receptor interaction 0.2045455 0.0000123 4.911452 0.0000123 0.0002734 Itga4/Col4a6/Thbs3/Npnt/Cd44/Lamc3/Lama4/Itgb7/Fn1/Itga1/Col9a2/Frem1/Lama2/Itga7/Sv2c/Itga8/Itgb4/Col4a5 18
mmu04020 Calcium signaling pathway 0.1416667 0.0000150 4.823136 0.0000150 0.0003071 Hgf/Cacna1c/Kdr/Ryr1/Adra1a/Slc8a1/Nos3/P2rx2/Ednrb/Pde1b/Adcy3/Cacna1e/Ptgfr/Plcb1/Slc8a3/Adcy4/Adcy7/Vegfc/Cd38/Agtr1a/Pde1a/Ednra/Bdkrb2/Htr2a/Plcb2/Asph/Ryr3/Cacna1h/Ptger3/Atp2b4/Pdgfrb/Cacna1a/F2r/Camk1 34
mmu04924 Renin secretion 0.2105263 0.0000255 4.594023 0.0000255 0.0004805 Cacna1c/Gnai1/Gucy1a2/Pde1b/Edn3/Plcb1/Gucy1b1/Gucy1a1/Agtr1a/Pde1a/Kcnma1/Ednra/Adcyap1r1/Plcb2/Clca2/Ptger2 16
mmu04926 Relaxin signaling pathway 0.1705426 0.0000292 4.535161 0.0000292 0.0005109 Col4a6/Nos3/Gnai1/Ednrb/Mmp2/Shc3/Adcy3/Gngt2/Plcb1/Adcy4/Adcy7/Gng11/Vegfc/Gng2/Arrb1/Plcb2/Arrb2/Akt3/Gnb5/Gng7/Gnb4/Col4a5 22
mmu04725 Cholinergic synapse 0.1785714 0.0000338 4.471504 0.0000338 0.0005521 Kcnj3/Cacna1c/Gnai1/Kcnq5/Adcy3/Gngt2/Pik3r6/Plcb1/Adcy4/Adcy7/Gng11/Gng2/Plcb2/Fyn/Akt3/Gnb5/Gng7/Gnb4/Kcnq4/Cacna1a 20
mmu04510 Focal adhesion 0.1442786 0.0000452 4.345003 0.0000452 0.0006582 Hgf/Itga4/Kdr/Igf1/Col4a6/Thbs3/Lamc3/Lama4/Ccnd2/Itgb7/Fn1/Shc3/Pip5k1b/Itga1/Col9a2/Lama2/Vegfc/Itga7/Parvg/Parvb/Flnc/Tln2/Fyn/Akt3/Pdgfrb/Cav1/Itga8/Itgb4/Col4a5 29
mmu04360 Axon guidance 0.1491713 0.0000456 4.340829 0.0000456 0.0006582 Epha8/Efnb3/Sema5a/Lrrc4c/Dcc/Plxnb1/Sema5b/Nrp1/Sema7a/Gnai1/Cxcl12/Trpc6/Gdf7/Epha3/Sema3g/Pard6g/Nfatc4/Epha7/Neo1/Ptch1/Fyn/Unc5c/Ngef/Sema6a/Ntng1/Bmp7/Slit3 27
mmu04014 Ras signaling pathway 0.1361702 0.0000590 4.229098 0.0000590 0.0007718 Hgf/Angpt1/Pla2g10/Kdr/Igf1/Ets1/Rasgrp3/Shc3/Rasa3/Grin2b/Tek/Gngt2/Rasgrp2/Flt3/Kit/Gng11/Vegfc/Igf2/Gng2/Kitl/Pla1a/Akt3/Gnb5/Gng7/Ets2/Syngap1/Zap70/Gnb4/Lat/Pdgfrb/Pld2/Rasal3 32
mmu04728 Dopaminergic synapse 0.1629630 0.0000598 4.223382 0.0000598 0.0007718 Kcnj3/Gria4/Cacna1c/Maob/Drd4/Gnai1/Scn1a/Grin2b/Maoa/Gngt2/Plcb1/Gng11/Gng2/Arrb1/Plcb2/Arrb2/Akt3/Gnb5/Gng7/Gnb4/Cacna1a/Kif5a 22
mmu04974 Protein digestion and absorption 0.1759259 0.0000653 4.185073 0.0000653 0.0008008 Col11a1/Col26a1/Col14a1/Col4a6/Slc8a1/Pga5/Col16a1/Slc36a4/Slc8a3/Col9a2/Col13a1/Mme/Col5a2/Col15a1/Atp1a2/Slc7a7/Col23a1/Col18a1/Col4a5 19
mmu05410 Hypertrophic cardiomyopathy 0.1868132 0.0000722 4.141373 0.0000722 0.0008434 Cacna1c/Sgcd/Itga4/Igf1/Slc8a1/Itgb7/Cacna2d1/Itga1/Slc8a3/Lama2/Itga7/Myl3/Cacng7/Sgcb/Itga8/Itgb4/Cacnb4 17
mmu04151 PI3K-Akt signaling pathway 0.1197772 0.0000781 4.107568 0.0000781 0.0008702 Hgf/Angpt1/Itga4/Kdr/Igf1/Col4a6/Thbs3/Nos3/Lamc3/Lama4/Ccnd2/Itgb7/Fn1/Areg/Lpar4/Tek/Gngt2/Pik3r6/Itga1/Col9a2/Flt3/Kit/Gng11/Lama2/Vegfc/Magi2/Igf2/Gng2/Itga7/Kitl/Akt3/Gnb5/Gng7/Gnb4/Pdgfrb/Il2rg/Itga8/Itgb4/F2r/Il7r/Myc/Col4a5/Irs1 43
mmu04970 Salivary secretion 0.1882353 0.0001066 3.972271 0.0001066 0.0011249 Adra1a/Gucy1a2/Adcy3/Plcb1/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Cd38/Lyz2/Kcnma1/Plcb2/Ryr3/Lyz1/Atp2b4/Atp1a2 16
mmu04640 Hematopoietic cell lineage 0.1808511 0.0001101 3.958300 0.0001101 0.0011249 Itga4/Cd44/Il11ra1/Cd3g/Itga1/Flt3/Cd1d1/Kit/Mme/H2-Ab1/Cd38/H2-Ob/Kitl/H2-Eb1/H2-Aa/Il7r/Cd4 17
mmu04062 Chemokine signaling pathway 0.1406250 0.0001280 3.892793 0.0001280 0.0012557 Cxcl15/Gnai1/Shc3/Itk/Adcy3/Cxcr3/Cxcl12/Gngt2/Pik3r6/Plcb1/Dock2/Rasgrp2/Adcy4/Adcy7/Gng11/Gng2/Xcl1/Arrb1/Plcb2/Arrb2/Stat5b/Xcr1/Fgr/Akt3/Gnb5/Gng7/Gnb4 27
mmu04727 GABAergic synapse 0.1797753 0.0001872 3.727651 0.0001872 0.0017661 Cacna1c/Abat/Gnai1/Adcy3/Gngt2/Adcy4/Adcy7/Gabra4/Gng11/Gng2/Slc38a1/Gnb5/Gng7/Gnb4/Gabbr1/Cacna1a 16
mmu00514 Other types of O-glycan biosynthesis 0.2325581 0.0003602 3.443503 0.0003602 0.0032716 St6gal2/Gxylt2/B4galt2/Galnt16/Lfng/Eogt/Galntl6/Pomt2/Mfng/Galnt18 10
mmu04921 Oxytocin signaling pathway 0.1437908 0.0003857 3.413717 0.0003857 0.0033788 Kcnj3/Cacna1c/Ryr1/Nos3/Gnai1/Cacna2d1/Mef2c/Gucy1a2/Adcy3/Pik3r6/Plcb1/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Cd38/Nfatc4/Cacng7/Plcb2/Ryr3/Cacnb4/Camk1 22
mmu04330 Notch signaling pathway 0.2000000 0.0004286 3.367967 0.0004286 0.0036247 Aph1b/Lfng/Jag2/Heyl/Dtx3/Tle1/Mfng/Psen1/Maml3/Tle2/Hey2/Numbl 12
mmu04670 Leukocyte transendothelial migration 0.1525424 0.0006285 3.201671 0.0006285 0.0051385 Itga4/Gnai1/Mmp2/Icam1/Itk/Jam3/Cxcl12/Cldn8/Cdh5/Thy1/Msn/Itgal/Esam/Pecam1/Cldn5/Cldn1/Sipa1/Jam2 18
mmu04072 Phospholipase D signaling pathway 0.1409396 0.0006807 3.167044 0.0006807 0.0053855 Shc3/Pip5k1b/Lpar4/Adcy3/Ptgfr/Pik3r6/Plcb1/Plpp3/Kit/Adcy4/Adcy7/Dgkb/Agtr1a/Kitl/Plcb2/Fyn/Akt3/Plpp1/Pdgfrb/Pld2/F2r 21
mmu04310 Wnt signaling pathway 0.1345029 0.0007521 3.123698 0.0007521 0.0057648 Sfrp2/Wnt6/Lef1/Apcdd1/Wnt11/Nkd1/Ccnd2/Plcb1/Peg12/Wnt9a/Znrf3/Prickle2/Daam2/Prickle1/Nfatc4/Plcb2/Tle1/Fzd2/Psen1/Nkd2/Tle2/Ror1/Myc 23
mmu04010 MAPK signaling pathway 0.1156463 0.0008208 3.085778 0.0008208 0.0061001 Hgf/Cacna1c/Angpt1/Kdr/Igf1/Rasgrp3/Cacna2d1/Areg/Mef2c/Tek/Mapk8ip1/Cacna1e/Rasgrp2/Rps6ka2/Flt3/Kit/Vegfc/Igf2/Kitl/Rps6ka5/Arrb1/Cacng7/Flnc/Arrb2/Irak4/Cacna1h/Akt3/Pdgfrb/Map4k2/Cacna1a/Mknk2/Cacnb4/Myc/Ptpn7 34
mmu04261 Adrenergic signaling in cardiomyocytes 0.1346154 0.0012437 2.905269 0.0012437 0.0087751 Cacna1c/Adra1a/Slc8a1/Scn4b/Gnai1/Cacna2d1/Adcy3/Pik3r6/Plcb1/Slc8a3/Adcy4/Adcy7/Agtr1a/Myl3/Rps6ka5/Cacng7/Plcb2/Akt3/Atp2b4/Atp1a2/Cacnb4 21
mmu04611 Platelet activation 0.1440000 0.0012522 2.902311 0.0012522 0.0087751 Nos3/Gnai1/Gucy1a2/Adcy3/Pik3r6/Plcb1/Rasgrp2/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Tln2/Plcb2/Fyn/Akt3/Apbb1ip/Lcp2/F2r 18
mmu04658 Th1 and Th2 cell differentiation 0.1590909 0.0016263 2.788812 0.0016263 0.0110794 Cd3g/Jag2/H2-Ab1/H2-Ob/H2-Eb1/Stat5b/Nfkbie/H2-Aa/Zap70/Lat/Il12rb1/Il2rg/Maml3/Cd4 14
mmu05205 Proteoglycans in cancer 0.1219512 0.0018821 2.725347 0.0018821 0.0124762 Ihh/Hgf/Wnt6/Wnt11/Hoxd10/Kdr/Igf1/Hcls1/Cd44/Gpc3/Fn1/Mmp2/Ank2/Wnt9a/Msn/Igf2/Twist2/Flnc/Ptch1/Fzd2/Akt3/Cav1/Lum/Myc/Twist1 25
mmu05217 Basal cell carcinoma 0.1746032 0.0023593 2.627208 0.0023593 0.0152279 Gli1/Wnt6/Hhip/Lef1/Wnt11/Ptch2/Kif7/Gli3/Wnt9a/Ptch1/Fzd2 11
mmu04024 cAMP signaling pathway 0.1160714 0.0030919 2.509779 0.0030919 0.0194441 Gli1/Gria4/Cacna1c/Hhip/Vipr2/Gnai1/Grin2b/Adcy3/Edn3/Gli3/Htr1b/Adcy4/Adcy7/Ednra/Adcyap1r1/Arap3/Ptch1/Akt3/Ptger3/Atp2b4/Atp1a2/Gabbr1/Lipe/Pld2/F2r/Ptger2 26
mmu04726 Serotonergic synapse 0.1297710 0.0051167 2.291010 0.0051167 0.0310394 Kcnj3/Cacna1c/Maob/Kcnd2/Gnai1/Maoa/Gngt2/Plcb1/Htr1b/Gng11/Gng2/Htr2a/Plcb2/Gnb5/Gng7/Gnb4/Cacna1a 17
mmu04730 Long-term depression 0.1666667 0.0051888 2.284935 0.0051888 0.0310394 Ryr1/Igf1/Gnai1/Gucy1a2/Plcb1/Gucy1b1/Gucy1a1/Plcb2/Gnaz/Cacna1a 10
mmu04916 Melanogenesis 0.1400000 0.0054246 2.265636 0.0054246 0.0316772 Wnt6/Lef1/Wnt11/Gnai1/Ednrb/Adcy3/Plcb1/Wnt9a/Kit/Adcy4/Adcy7/Kitl/Plcb2/Fzd2 14
mmu04933 AGE-RAGE signaling pathway in diabetic complications 0.1386139 0.0059306 2.226903 0.0059306 0.0332161 Col4a6/Nos3/Fn1/Mmp2/Icam1/Plcb1/Vegfc/Agtr1a/Nox4/Sele/Plcb2/Stat5b/Akt3/Col4a5 14
mmu02010 ABC transporters 0.1730769 0.0060942 2.215082 0.0060942 0.0332161 Abcg2/Abca5/Abcg1/Abca8b/Abcd2/Abcb1a/Abcc5/Abcg3/Abcg4 9
mmu04672 Intestinal immune network for IgA production 0.1860465 0.0060944 2.215071 0.0060944 0.0332161 Itga4/Itgb7/Cxcl12/Tnfsf13b/H2-Ab1/H2-Ob/H2-Eb1/H2-Aa 8
mmu04925 Aldosterone synthesis and secretion 0.1372549 0.0064738 2.188842 0.0064738 0.0345169 Kcnk3/Cacna1c/Prkd1/Adcy3/Plcb1/Adcy4/Adcy7/Agtr1a/Plcb2/Cacna1h/Atp2b4/Atp1a2/Lipe/Camk1 14
mmu04742 Taste transduction 0.1413043 0.0066924 2.174421 0.0066924 0.0349232 Cacna1c/P2rx2/Pde1b/Plcb1/Htr1b/Scn2a/Adcy4/Gabra4/Pde1a/Plcb2/Scn3a/Gabbr1/Cacna1a 13
mmu04540 Gap junction 0.1395349 0.0099204 2.003472 0.0099204 0.0506896 Gnai1/Gucy1a2/Adcy3/Plcb1/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Tubb4a/Htr2a/Plcb2/Pdgfrb 12
mmu00533 Glycosaminoglycan biosynthesis - keratan sulfate 0.2857143 0.0107649 1.967990 0.0107649 0.0532021 Chst2/B4galt2/St3gal2/Chst1 4
mmu05323 Rheumatoid arthritis 0.1379310 0.0108459 1.964733 0.0108459 0.0532021 Angpt1/Icam1/Tek/Cxcl12/Tnfsf13b/Itgal/H2-Ab1/H2-Ob/Atp6v0e2/H2-Eb1/H2-Aa/Atp6v1b2 12
mmu04270 Vascular smooth muscle contraction 0.1180556 0.0128851 1.889912 0.0128851 0.0619656 Cacna1c/Pla2g10/Adra1a/Gucy1a2/Adcy3/Edn3/Plcb1/Calca/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Agtr1a/Kcnma1/Ednra/Plcb2/Calcrl 17
mmu00260 Glycine, serine and threonine metabolism 0.1750000 0.0140499 1.852327 0.0140499 0.0644879 Maob/Cbs/Maoa/Gamt/Cth/Phgdh/Sardh 7
mmu00230 Purine metabolism 0.1194030 0.0140591 1.852041 0.0140591 0.0644879 Nme4/Gucy1a2/Pde1b/Adcy3/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Enpp1/Pde1a/Hddc3/Lacc1/Pde5a/Impdh1/Pde8a/Papss2 16
mmu04390 Hippo signaling pathway 0.1146497 0.0141984 1.847760 0.0141984 0.0644879 Wnt6/Lef1/Wnt11/Nkd1/Ccnd2/Areg/Gdf7/Wnt9a/Dlg2/Pard6g/Dlg4/Fzd2/Ccn2/Dlg5/Lats2/Nkd2/Bmp7/Myc 18
mmu04723 Retrograde endocannabinoid signaling 0.1148649 0.0165797 1.780422 0.0165797 0.0739345 Kcnj3/Gria4/Cacna1c/Gnai1/Adcy3/Gngt2/Plcb1/Adcy4/Adcy7/Gabra4/Gng11/Gng2/Plcb2/Gnb5/Gng7/Gnb4/Cacna1a 17
mmu04927 Cortisol synthesis and secretion 0.1388889 0.0183049 1.737432 0.0183049 0.0801700 Kcnk3/Cacna1c/Adcy3/Plcb1/Adcy4/Adcy7/Agtr1a/Plcb2/Cacna1h/Pde8a 10
mmu04659 Th17 cell differentiation 0.1238095 0.0193130 1.714151 0.0193130 0.0831011 Cd3g/H2-Ab1/Il27ra/H2-Ob/H2-Eb1/Stat5b/Nfkbie/H2-Aa/Zap70/Lat/Il12rb1/Il2rg/Cd4 13
mmu04929 GnRH secretion 0.1428571 0.0207490 1.683004 0.0207490 0.0877406 Kcnj3/Cacna1c/Plcb1/Arrb1/Plcb2/Arrb2/Cacna1h/Akt3/Gabbr1 9
mmu00601 Glycosphingolipid biosynthesis - lacto and neolacto series 0.1923077 0.0247723 1.606034 0.0247723 0.1029783 B4galt2/B3galnt1/Ggta1/B3gnt5/St3gal4 5
mmu05100 Bacterial invasion of epithelial cells 0.1315789 0.0258348 1.587794 0.0258348 0.1049646 Hcls1/Fn1/Shc3/Septin3/Arhgap10/Arhgef26/Elmo2/Cav1/Actr3b/Septin6 10
mmu04260 Cardiac muscle contraction 0.1264368 0.0261060 1.583260 0.0261060 0.1049646 Cacna1c/Slc8a1/Cacna2d1/Slc9a7/Slc8a3/Myl3/Cacng7/Asph/Cox4i2/Atp1a2/Cacnb4 11
mmu05416 Viral myocarditis 0.1250000 0.0281445 1.550607 0.0281445 0.1113354 Sgcd/Icam1/Lama2/Itgal/H2-Ab1/H2-Ob/H2-Eb1/Fyn/H2-Aa/Sgcb/Cav1 11
mmu04810 Regulation of actin cytoskeleton 0.0995671 0.0289684 1.538075 0.0289684 0.1127759 Itga4/Itgb7/Fn1/Pip5k1b/Pfn2/Lpar4/Cxcl12/Itga1/Msn/Abi2/Itgal/Itga7/Scin/Nckap1l/Bdkrb2/Fgd1/Akt3/Pdgfrb/Cyfip2/Actr3b/Itga8/Itgb4/F2r 23
mmu04923 Regulation of lipolysis in adipocytes 0.1403509 0.0312306 1.505419 0.0312306 0.1196831 Gnai1/Adcy3/Adcy4/Adcy7/Akt3/Ptger3/Lipe/Irs1 8
mmu00061 Fatty acid biosynthesis 0.2105263 0.0321493 1.492829 0.0321493 0.1213082 Acsl6/Acacb/Acsl1/Olah 4
mmu00565 Ether lipid metabolism 0.1458333 0.0354397 1.450510 0.0354397 0.1316978 Pla2g10/Plpp3/Lpcat1/Plpp1/Pld2/Enpp2/Pafah2 7
mmu00062 Fatty acid elongation 0.1724138 0.0380928 1.419157 0.0380928 0.1394443 Elovl4/Them5/Echs1/Acot7/Hacd1 5
mmu04961 Endocrine and other factor-regulated calcium reabsorption 0.1311475 0.0444025 1.352593 0.0444025 0.1601513 Slc8a1/Plcb1/Slc8a3/Pth1r/Bdkrb2/Plcb2/Atp2b4/Atp1a2 8
mmu01212 Fatty acid metabolism 0.1290323 0.0481897 1.317046 0.0481897 0.1706710 Acsl6/Fads2/Fads1/Elovl4/Echs1/Cpt1c/Acsl1/Hacd1 8
mmu04350 TGF-beta signaling pathway 0.1145833 0.0487108 1.312375 0.0487108 0.1706710 Nog/Fst/Id3/Id4/Gdf7/Tgif2/Smad9/Neo1/Zfyve9/Bmp7/Myc 11
mmu04928 Parathyroid hormone synthesis, secretion and action 0.1111111 0.0496358 1.304205 0.0496358 0.1711656 Mmp16/Gnai1/Mef2c/Adcy3/Plcb1/Pth1r/Adcy4/Adcy7/Arrb1/Plcb2/Arrb2/Pld2 12
kegg_dot <- list()
upset=list()
for (i in 1:length(fc)) {
  x <- fc[i] %>% as.character()

  # dot plot, save
  kegg_dot[[x]] <- ggplot(enrichKEGG_sig[[x]][1:15, ]) +
    geom_point(aes(x = GeneRatio, y = reorder(Description, GeneRatio), colour = logPval, size = Count)) +
    scale_color_gradient(low = "dodgerblue3", high = "firebrick3", limits = c(0, NA)) +
    scale_size(range = c(1.5,5)) +
    ggtitle("KEGG Pathways") +
    ylab(label = "") +
    xlab(label = "Gene Ratio") +
    labs(color = expression("-log"[10] * "Pvalue"), size = "Gene Counts")
  ggsave(filename = paste0("kegg_dot_", fc[i], ".svg"), plot = kegg_dot[[x]] + pub, path = here::here("2_plots/kegg/"), 
         width = 250, height = 130, units = "mm")
  
  upset[[x]] <- upsetplot(x = enrichKEGG[[x]], 10)
  ggsave(filename = paste0("upset_kegg_", fc[i], ".svg"), plot = upset[[x]], path = here::here("2_plots/kegg/"), 
         width = 170, height = 130, units = "mm")
}

kegg_dot[[p]]

upset[[p]]

p=p+1
enrichKEGG_sig[[p]] %>%
  kable(caption = "Significantly enriched KEGG pathways") %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Significantly enriched KEGG pathways
Description GeneRatio pvalue logPval p.adjust qvalue geneID Count
mmu04713 Circadian entrainment 0.2448980 0.0000000 9.095929 0.0000000 0.0000002 Kcnj3/Gria4/Cacna1c/Ryr1/Gnai1/Gucy1a2/Grin2b/Adcy3/Gngt2/Plcb1/Gucy1b1/Gucy1a1/Adcy4/Gng11/Adcy7/Adcyap1r1/Gng2/Rps6ka5/Plcb2/Ryr3/Cacna1h/Gng7/Gnb5/Gnb4 24
mmu04371 Apelin signaling pathway 0.1897810 0.0000000 7.301574 0.0000000 0.0000061 Ryr1/Nos3/Slc8a1/Gnai1/Mef2c/Adcy3/Gngt2/Pik3r6/Slc8a3/Plcb1/Adcy4/Gng11/Aplnr/Adcy7/Agtr1a/Myl3/Gng2/Plcb2/Ryr3/Ccn2/Apln/Gng7/Akt3/Gnb5/Gnb4/Lipe 26
mmu04724 Glutamatergic synapse 0.2035398 0.0000001 7.108825 0.0000001 0.0000063 Kcnj3/Slc1a3/Gria4/Grik1/Cacna1c/Gnai1/Grin2b/Adcy3/Shank2/Gngt2/Plcb1/Adcy4/Gng11/Adcy7/Grik2/Gng2/Plcb2/Slc38a1/Dlg4/Gng7/Gnb5/Gnb4/Cacna1a 23
mmu05414 Dilated cardiomyopathy 0.2127660 0.0000003 6.587888 0.0000003 0.0000157 Sgcd/Cacna1c/Itga4/Igf1/Slc8a1/Itgb7/Cacna2d1/Adcy3/Slc8a3/Itga1/Adcy4/Lama2/Adcy7/Itga7/Myl3/Cacng7/Sgcb/Itga8/Itgb4/Cacnb4 20
mmu04514 Cell adhesion molecules 0.1593407 0.0000004 6.353176 0.0000004 0.0000216 Itga4/Lrrc4c/Ptprd/Nlgn1/Cdh2/Lrrc4b/Itgb7/Icam1/Jam3/Cldn8/Slitrk3/Cdh5/Ptprm/Cd226/Nlgn3/Esam/Itgal/H2-Ab1/Nfasc/Sele/H2-Ob/Pecam1/H2-Eb1/Cldn5/Neo1/H2-Aa/Ntng1/Itga8/Cldn1 29
mmu05412 Arrhythmogenic right ventricular cardiomyopathy 0.2207792 0.0000012 5.925876 0.0000012 0.0000481 Lef1/Sgcd/Cacna1c/Itga4/Slc8a1/Cdh2/Itgb7/Cacna2d1/Slc8a3/Itga1/Lama2/Itga7/Cacng7/Sgcb/Itga8/Itgb4/Cacnb4 17
mmu04022 cGMP-PKG signaling pathway 0.1560694 0.0000017 5.773851 0.0000017 0.0000585 Cacna1c/Adra1a/Nos3/Slc8a1/Gnai1/Ednrb/Mef2c/Gucy1a2/Adcy3/Pik3r6/Slc8a3/Plcb1/Gucy1b1/Trpc6/Gucy1a1/Adcy4/Adcy7/Agtr1a/Kcnma1/Ednra/Bdkrb2/Plcb2/Pde5a/Nfatc4/Atp2b4/Akt3/Atp1a2 27
mmu05032 Morphine addiction 0.1978022 0.0000031 5.503107 0.0000031 0.0000919 Kcnj3/Gnai1/Pde1b/Adcy3/Gngt2/Gabra4/Adcy4/Gng11/Adcy7/Pde1a/Gng2/Arrb1/Arrb2/Gng7/Gnb5/Gnb4/Gabbr1/Cacna1a 18
mmu04340 Hedgehog signaling pathway 0.2413793 0.0000034 5.468399 0.0000034 0.0000919 Gli1/Ihh/Hhip/Evc2/Ptch2/Evc/Kif7/Ccnd2/Gli3/Lrp2/Gpr161/Arrb1/Ptch1/Arrb2 14
mmu04725 Cholinergic synapse 0.1785714 0.0000047 5.324639 0.0000047 0.0001151 Kcnj3/Cacna1c/Gnai1/Kcnq5/Adcy3/Gngt2/Pik3r6/Plcb1/Adcy4/Gng11/Adcy7/Gng2/Plcb2/Fyn/Gng7/Akt3/Gnb5/Gnb4/Kcnq4/Cacna1a 20
mmu04512 ECM-receptor interaction 0.1931818 0.0000082 5.084669 0.0000082 0.0001819 Itga4/Col4a6/Npnt/Thbs3/Lamc3/Cd44/Lama4/Itgb7/Fn1/Itga1/Col9a2/Frem1/Lama2/Itga7/Sv2c/Itga8/Itgb4 17
mmu04926 Relaxin signaling pathway 0.1627907 0.0000124 4.906907 0.0000124 0.0002129 Col4a6/Nos3/Gnai1/Ednrb/Mmp2/Shc3/Adcy3/Gngt2/Plcb1/Adcy4/Gng11/Adcy7/Vegfc/Gng2/Arrb1/Plcb2/Arrb2/Gng7/Akt3/Gnb5/Gnb4 21
mmu04015 Rap1 signaling pathway 0.1355140 0.0000125 4.904430 0.0000125 0.0002129 Hgf/Angpt1/Kdr/Igf1/Evl/Rasgrp3/Gnai1/Pfn2/Grin2b/Lpar4/Prkd1/Tek/Adcy3/Plcb1/Rasgrp2/Adcy4/Kit/Adcy7/Itgal/Vegfc/Magi2/Arap3/Pard6g/Kitl/Plcb2/Tln2/Akt3/Lat/Apbb1ip 29
mmu04062 Chemokine signaling pathway 0.1406250 0.0000126 4.901255 0.0000126 0.0002129 Cxcl15/Gnai1/Shc3/Itk/Cxcr3/Cxcl12/Adcy3/Gngt2/Pik3r6/Plcb1/Rasgrp2/Dock2/Adcy4/Gng11/Adcy7/Xcl1/Gng2/Arrb1/Plcb2/Xcr1/Arrb2/Gng7/Fgr/Stat5b/Akt3/Gnb5/Gnb4 27
mmu05410 Hypertrophic cardiomyopathy 0.1868132 0.0000131 4.881540 0.0000131 0.0002129 Sgcd/Cacna1c/Itga4/Igf1/Slc8a1/Itgb7/Cacna2d1/Slc8a3/Itga1/Lama2/Itga7/Myl3/Cacng7/Sgcb/Itga8/Itgb4/Cacnb4 17
mmu04020 Calcium signaling pathway 0.1291667 0.0000167 4.776965 0.0000167 0.0002540 Hgf/Cacna1c/Ryr1/Kdr/Adra1a/Nos3/Slc8a1/P2rx2/Ednrb/Pde1b/Adcy3/Cacna1e/Ptgfr/Slc8a3/Plcb1/Adcy4/Adcy7/Vegfc/Pde1a/Cd38/Agtr1a/Ednra/Bdkrb2/Htr2a/Plcb2/Asph/Ryr3/Cacna1h/Ptger3/Atp2b4/Cacna1a 31
mmu04970 Salivary secretion 0.1882353 0.0000213 4.671419 0.0000213 0.0002884 Adra1a/Gucy1a2/Adcy3/Plcb1/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Cd38/Lyz2/Kcnma1/Plcb2/Ryr3/Lyz1/Atp2b4/Atp1a2 16
mmu04924 Renin secretion 0.1973684 0.0000213 4.670649 0.0000213 0.0002884 Cacna1c/Gnai1/Gucy1a2/Pde1b/Edn3/Plcb1/Gucy1b1/Gucy1a1/Pde1a/Agtr1a/Kcnma1/Ednra/Adcyap1r1/Plcb2/Clca2 15
mmu04728 Dopaminergic synapse 0.1555556 0.0000253 4.597276 0.0000253 0.0003235 Kcnj3/Gria4/Maob/Cacna1c/Drd4/Gnai1/Scn1a/Grin2b/Maoa/Gngt2/Plcb1/Gng11/Gng2/Arrb1/Plcb2/Arrb2/Gng7/Akt3/Gnb5/Gnb4/Cacna1a 21
mmu04510 Focal adhesion 0.1343284 0.0000291 4.536132 0.0000291 0.0003538 Hgf/Itga4/Kdr/Igf1/Col4a6/Thbs3/Lamc3/Lama4/Itgb7/Ccnd2/Fn1/Shc3/Pip5k1b/Itga1/Col9a2/Lama2/Vegfc/Parvg/Itga7/Parvb/Flnc/Tln2/Fyn/Akt3/Cav1/Itga8/Itgb4 27
mmu04360 Axon guidance 0.1381215 0.0000358 4.446679 0.0000358 0.0004084 Epha8/Efnb3/Sema5a/Lrrc4c/Dcc/Plxnb1/Sema5b/Sema7a/Nrp1/Gnai1/Cxcl12/Gdf7/Trpc6/Epha3/Sema3g/Pard6g/Epha7/Ptch1/Nfatc4/Neo1/Fyn/Unc5c/Sema6a/Ngef/Ntng1 25
mmu04974 Protein digestion and absorption 0.1666667 0.0000372 4.429015 0.0000372 0.0004084 Col11a1/Col26a1/Col14a1/Col4a6/Slc8a1/Pga5/Col16a1/Slc36a4/Slc8a3/Col9a2/Col13a1/Mme/Col5a2/Col15a1/Atp1a2/Col23a1/Slc7a7/Col18a1 18
mmu04727 GABAergic synapse 0.1797753 0.0000386 4.413099 0.0000386 0.0004084 Cacna1c/Abat/Gnai1/Adcy3/Gngt2/Gabra4/Adcy4/Gng11/Adcy7/Gng2/Slc38a1/Gng7/Gnb5/Gnb4/Gabbr1/Cacna1a 16
mmu04014 Ras signaling pathway 0.1234043 0.0000728 4.137934 0.0000728 0.0007375 Hgf/Angpt1/Pla2g10/Kdr/Igf1/Rasgrp3/Ets1/Shc3/Rasa3/Grin2b/Tek/Gngt2/Rasgrp2/Flt3/Gng11/Kit/Vegfc/Igf2/Gng2/Pla1a/Kitl/Gng7/Ets2/Akt3/Zap70/Gnb5/Lat/Syngap1/Gnb4 29
mmu04921 Oxytocin signaling pathway 0.1372549 0.0001631 3.787545 0.0001631 0.0015864 Kcnj3/Cacna1c/Ryr1/Nos3/Gnai1/Cacna2d1/Mef2c/Gucy1a2/Adcy3/Pik3r6/Plcb1/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Cd38/Cacng7/Plcb2/Ryr3/Nfatc4/Cacnb4 21
mmu04261 Adrenergic signaling in cardiomyocytes 0.1346154 0.0002149 3.667725 0.0002149 0.0020100 Cacna1c/Adra1a/Slc8a1/Scn4b/Gnai1/Cacna2d1/Adcy3/Pik3r6/Slc8a3/Plcb1/Adcy4/Adcy7/Agtr1a/Myl3/Rps6ka5/Cacng7/Plcb2/Atp2b4/Akt3/Atp1a2/Cacnb4 21
mmu04640 Hematopoietic cell lineage 0.1595745 0.0002688 3.570545 0.0002688 0.0024209 Itga4/Cd44/Il11ra1/Cd3g/Itga1/Flt3/Mme/Cd1d1/Kit/H2-Ab1/Cd38/H2-Ob/Kitl/H2-Eb1/H2-Aa 15
mmu04151 PI3K-Akt signaling pathway 0.1030641 0.0003520 3.453452 0.0003520 0.0030569 Hgf/Angpt1/Itga4/Kdr/Igf1/Col4a6/Thbs3/Nos3/Lamc3/Lama4/Areg/Itgb7/Ccnd2/Fn1/Lpar4/Tek/Gngt2/Pik3r6/Itga1/Col9a2/Flt3/Gng11/Kit/Lama2/Vegfc/Magi2/Igf2/Itga7/Gng2/Kitl/Gng7/Akt3/Gnb5/Gnb4/Il2rg/Itga8/Itgb4 37
mmu05217 Basal cell carcinoma 0.1746032 0.0008023 3.095668 0.0008023 0.0067270 Gli1/Wnt6/Hhip/Lef1/Wnt11/Ptch2/Kif7/Gli3/Wnt9a/Ptch1/Fzd2 11
mmu04670 Leukocyte transendothelial migration 0.1355932 0.0010931 2.961322 0.0010931 0.0088602 Itga4/Gnai1/Mmp2/Icam1/Itk/Cxcl12/Jam3/Cldn8/Cdh5/Thy1/Msn/Esam/Itgal/Pecam1/Cldn5/Cldn1 16
mmu04726 Serotonergic synapse 0.1297710 0.0012723 2.895414 0.0012723 0.0099796 Kcnj3/Maob/Cacna1c/Kcnd2/Gnai1/Maoa/Gngt2/Plcb1/Htr1b/Gng11/Htr2a/Gng2/Plcb2/Gng7/Gnb5/Gnb4/Cacna1a 17
mmu04916 Melanogenesis 0.1400000 0.0016114 2.792795 0.0016114 0.0122446 Wnt6/Lef1/Wnt11/Gnai1/Ednrb/Adcy3/Plcb1/Wnt9a/Adcy4/Kit/Adcy7/Kitl/Plcb2/Fzd2 14
mmu04730 Long-term depression 0.1666667 0.0019805 2.703220 0.0019805 0.0144529 Ryr1/Igf1/Gnai1/Gucy1a2/Plcb1/Gucy1b1/Gucy1a1/Plcb2/Gnaz/Cacna1a 10
mmu04611 Platelet activation 0.1280000 0.0020209 2.694455 0.0020209 0.0144529 Nos3/Gnai1/Gucy1a2/Adcy3/Pik3r6/Plcb1/Rasgrp2/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Plcb2/Tln2/Fyn/Akt3/Apbb1ip 16
mmu04072 Phospholipase D signaling pathway 0.1208054 0.0021127 2.675165 0.0021127 0.0145056 Shc3/Lpar4/Pip5k1b/Adcy3/Ptgfr/Pik3r6/Plcb1/Plpp3/Adcy4/Kit/Adcy7/Dgkb/Agtr1a/Kitl/Plcb2/Fyn/Akt3/Plpp1 18
mmu04742 Taste transduction 0.1413043 0.0021476 2.668049 0.0021476 0.0145056 Cacna1c/P2rx2/Pde1b/Plcb1/Htr1b/Gabra4/Scn2a/Adcy4/Pde1a/Plcb2/Scn3a/Gabbr1/Cacna1a 13
mmu00514 Other types of O-glycan biosynthesis 0.1860465 0.0027027 2.568200 0.0027027 0.0172944 St6gal2/Gxylt2/B4galt2/Galnt16/Lfng/Eogt/Galntl6/Mfng 8
mmu04672 Intestinal immune network for IgA production 0.1860465 0.0027027 2.568200 0.0027027 0.0172944 Itga4/Itgb7/Cxcl12/Tnfsf13b/H2-Ab1/H2-Ob/H2-Eb1/H2-Aa 8
mmu04010 MAPK signaling pathway 0.0986395 0.0029078 2.536442 0.0029078 0.0181293 Hgf/Angpt1/Cacna1c/Kdr/Igf1/Rasgrp3/Areg/Cacna2d1/Mef2c/Tek/Mapk8ip1/Cacna1e/Rasgrp2/Rps6ka2/Flt3/Kit/Vegfc/Igf2/Rps6ka5/Kitl/Arrb1/Cacng7/Flnc/Irak4/Cacna1h/Arrb2/Akt3/Cacna1a/Cacnb4 29
mmu05205 Proteoglycans in cancer 0.1073171 0.0032991 2.481605 0.0032991 0.0200551 Ihh/Hgf/Wnt6/Wnt11/Hoxd10/Kdr/Igf1/Cd44/Hcls1/Gpc3/Fn1/Mmp2/Ank2/Wnt9a/Msn/Igf2/Twist2/Ptch1/Flnc/Fzd2/Akt3/Cav1 22
mmu04270 Vascular smooth muscle contraction 0.1180556 0.0035371 2.451354 0.0035371 0.0209774 Cacna1c/Pla2g10/Adra1a/Gucy1a2/Adcy3/Edn3/Calca/Plcb1/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Agtr1a/Kcnma1/Ednra/Plcb2/Calcrl 17
mmu04310 Wnt signaling pathway 0.1111111 0.0041787 2.378956 0.0041787 0.0239016 Sfrp2/Wnt6/Lef1/Apcdd1/Wnt11/Nkd1/Ccnd2/Plcb1/Peg12/Wnt9a/Prickle2/Znrf3/Daam2/Prickle1/Tle1/Plcb2/Nfatc4/Fzd2/Nkd2 19
mmu04658 Th1 and Th2 cell differentiation 0.1363636 0.0042268 2.373993 0.0042268 0.0239016 Cd3g/Jag2/H2-Ab1/H2-Ob/H2-Eb1/Nfkbie/H2-Aa/Stat5b/Zap70/Lat/Il12rb1/Il2rg 12
mmu04024 cAMP signaling pathway 0.1026786 0.0046820 2.329568 0.0046820 0.0253449 Gli1/Gria4/Hhip/Cacna1c/Vipr2/Gnai1/Grin2b/Adcy3/Edn3/Gli3/Htr1b/Adcy4/Adcy7/Ednra/Adcyap1r1/Arap3/Ptch1/Ptger3/Atp2b4/Akt3/Atp1a2/Gabbr1/Lipe 23
mmu04723 Retrograde endocannabinoid signaling 0.1148649 0.0046905 2.328785 0.0046905 0.0253449 Kcnj3/Gria4/Cacna1c/Gnai1/Adcy3/Gngt2/Plcb1/Gabra4/Adcy4/Gng11/Adcy7/Gng2/Plcb2/Gng7/Gnb5/Gnb4/Cacna1a 17
mmu04933 AGE-RAGE signaling pathway in diabetic complications 0.1287129 0.0049110 2.308831 0.0049110 0.0259597 Col4a6/Nos3/Fn1/Mmp2/Icam1/Plcb1/Vegfc/Nox4/Sele/Agtr1a/Plcb2/Stat5b/Akt3 13
mmu04925 Aldosterone synthesis and secretion 0.1274510 0.0053431 2.272203 0.0053431 0.0276432 Kcnk3/Cacna1c/Prkd1/Adcy3/Plcb1/Adcy4/Adcy7/Agtr1a/Plcb2/Cacna1h/Atp2b4/Atp1a2/Lipe 13
mmu00533 Glycosaminoglycan biosynthesis - keratan sulfate 0.2857143 0.0067409 2.171279 0.0067409 0.0341482 Chst2/B4galt2/St3gal2/Chst1 4
mmu02010 ABC transporters 0.1538462 0.0089348 2.048914 0.0089348 0.0443382 Abcg2/Abca5/Abcg1/Abca8b/Abcd2/Abcb1a/Abcc5/Abcg3 8
mmu04929 GnRH secretion 0.1428571 0.0092723 2.032814 0.0092723 0.0450925 Kcnj3/Cacna1c/Plcb1/Arrb1/Plcb2/Cacna1h/Arrb2/Akt3/Gabbr1 9
mmu04540 Gap junction 0.1279070 0.0097385 2.011509 0.0097385 0.0464312 Gnai1/Gucy1a2/Adcy3/Plcb1/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Tubb4a/Htr2a/Plcb2 11
mmu04260 Cardiac muscle contraction 0.1264368 0.0105916 1.975040 0.0105916 0.0485929 Cacna1c/Slc8a1/Cacna2d1/Slc9a7/Slc8a3/Myl3/Cacng7/Asph/Cox4i2/Atp1a2/Cacnb4 11
mmu05323 Rheumatoid arthritis 0.1264368 0.0105916 1.975040 0.0105916 0.0485929 Angpt1/Icam1/Tek/Cxcl12/Tnfsf13b/Itgal/H2-Ab1/H2-Ob/Atp6v0e2/H2-Eb1/H2-Aa 11
mmu05416 Viral myocarditis 0.1250000 0.0115008 1.939271 0.0115008 0.0517873 Sgcd/Icam1/Lama2/Itgal/H2-Ab1/H2-Ob/H2-Eb1/Fyn/H2-Aa/Sgcb/Cav1 11
mmu00601 Glycosphingolipid biosynthesis - lacto and neolacto series 0.1923077 0.0146653 1.833709 0.0146653 0.0648361 B3galnt1/B4galt2/Ggta1/B3gnt5/St3gal4 5
mmu04659 Th17 cell differentiation 0.1142857 0.0167183 1.776807 0.0167183 0.0725928 Cd3g/Il27ra/H2-Ab1/H2-Ob/H2-Eb1/Nfkbie/H2-Aa/Stat5b/Zap70/Lat/Il12rb1/Il2rg 12
mmu04390 Hippo signaling pathway 0.1019108 0.0178407 1.748587 0.0178407 0.0761073 Wnt6/Lef1/Wnt11/Nkd1/Areg/Ccnd2/Gdf7/Wnt9a/Dlg2/Pard6g/Ccn2/Fzd2/Dlg4/Dlg5/Lats2/Nkd2 16
mmu00230 Purine metabolism 0.1044776 0.0211764 1.674148 0.0211764 0.0874342 Nme4/Gucy1a2/Pde1b/Adcy3/Gucy1b1/Gucy1a1/Adcy4/Adcy7/Pde1a/Enpp1/Hddc3/Lacc1/Pde5a/Impdh1 14
mmu04927 Cortisol synthesis and secretion 0.1250000 0.0212151 1.673355 0.0212151 0.0874342 Kcnk3/Cacna1c/Adcy3/Plcb1/Adcy4/Adcy7/Agtr1a/Plcb2/Cacna1h 9
mmu04961 Endocrine and other factor-regulated calcium reabsorption 0.1311475 0.0223555 1.650616 0.0223555 0.0905986 Slc8a1/Slc8a3/Plcb1/Pth1r/Bdkrb2/Plcb2/Atp2b4/Atp1a2 8
mmu04810 Regulation of actin cytoskeleton 0.0909091 0.0241445 1.617182 0.0241445 0.0962447 Itga4/Itgb7/Fn1/Pfn2/Lpar4/Pip5k1b/Cxcl12/Itga1/Msn/Abi2/Itgal/Scin/Bdkrb2/Itga7/Nckap1l/Fgd1/Akt3/Actr3b/Cyfip2/Itga8/Itgb4 21
mmu04918 Thyroid hormone synthesis 0.1216216 0.0249269 1.603331 0.0249269 0.0970532 Ttr/Adcy3/Plcb1/Lrp2/Adcy4/Adcy7/Plcb2/Gpx7/Atp1a2 9
mmu00260 Glycine, serine and threonine metabolism 0.1500000 0.0251456 1.599538 0.0251456 0.0970532 Maob/Cbs/Maoa/Gamt/Cth/Phgdh 6
mmu00380 Tryptophan metabolism 0.1346154 0.0278565 1.555074 0.0278565 0.1058362 Cyp1b1/Maob/Maoa/Kyat1/Dhtkd1/Echs1/Aox4 7
mmu04923 Regulation of lipolysis in adipocytes 0.1228070 0.0431941 1.364576 0.0431941 0.1573957 Gnai1/Adcy3/Adcy4/Adcy7/Ptger3/Akt3/Lipe 7
mmu05144 Malaria 0.1228070 0.0431941 1.364576 0.0431941 0.1573957 Hgf/Thbs3/Icam1/Gypc/Itgal/Sele/Pecam1 7
mmu04915 Estrogen signaling pathway 0.0970149 0.0433690 1.362821 0.0433690 0.1573957 Krt23/Kcnj3/Nos3/Gnai1/Mmp2/Shc3/Adcy3/Plcb1/Adcy4/Adcy7/Plcb2/Akt3/Gabbr1 13
mmu04934 Cushing syndrome 0.0925926 0.0448593 1.348148 0.0448593 0.1581074 Kcnk3/Wnt6/Lef1/Wnt11/Cacna1c/Gnai1/Adcy3/Plcb1/Wnt9a/Adcy4/Adcy7/Agtr1a/Plcb2/Cacna1h/Fzd2 15
mmu04928 Parathyroid hormone synthesis, secretion and action 0.1018519 0.0448655 1.348087 0.0448655 0.1581074 Mmp16/Gnai1/Mef2c/Adcy3/Plcb1/Pth1r/Adcy4/Adcy7/Arrb1/Plcb2/Arrb2 11
kegg_dot[[p]]

upset[[p]]

p=p+1
enrichKEGG_sig[[p]] %>%
  kable(caption = "Significantly enriched KEGG pathways") %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Significantly enriched KEGG pathways
Description GeneRatio pvalue logPval p.adjust qvalue geneID Count
mmu04340 Hedgehog signaling pathway 0.1379310 0.0000027 5.566527 0.0000027 0.0005883 Gli1/Ihh/Hhip/Ptch2/Evc2/Evc/Lrp2/Kif7 8
mmu05217 Basal cell carcinoma 0.1111111 0.0000495 4.305328 0.0000495 0.0044503 Gli1/Wnt6/Hhip/Wnt11/Lef1/Ptch2/Kif7 7
mmu04512 ECM-receptor interaction 0.0909091 0.0000616 4.210629 0.0000616 0.0044503 Col4a6/Lamc3/Itga4/Npnt/Cd44/Col9a2/Frem1/Lama4 8
mmu04360 Axon guidance 0.0607735 0.0001109 3.955120 0.0001109 0.0060112 Epha8/Efnb3/Sema5a/Dcc/Lrrc4c/Sema5b/Plxnb1/Gnai1/Sema7a/Cxcl12/Gdf7 11
mmu05205 Proteoglycans in cancer 0.0487805 0.0012850 2.891099 0.0012850 0.0506002 Ihh/Hgf/Wnt6/Wnt11/Hoxd10/Igf1/Kdr/Gpc3/Cd44/Mmp2 10
mmu04974 Protein digestion and absorption 0.0648148 0.0014001 2.853840 0.0014001 0.0506002 Col11a1/Col26a1/Col14a1/Col4a6/Pga5/Col9a2/Slc8a3 7
mmu04020 Calcium signaling pathway 0.0416667 0.0040661 2.390824 0.0040661 0.1259569 Hgf/Ryr1/Adra1a/Kdr/Ednrb/Nos3/P2rx2/Ptgfr/Cacna1e/Slc8a3 10
mmu04728 Dopaminergic synapse 0.0518519 0.0049253 2.307566 0.0049253 0.1335021 Kcnj3/Maob/Gria4/Drd4/Scn1a/Gnai1/Grin2b 7
mmu05412 Arrhythmogenic right ventricular cardiomyopathy 0.0649351 0.0067287 2.172067 0.0067287 0.1597633 Lef1/Sgcd/Itga4/Cdh2/Slc8a3 5
mmu04080 Neuroactive ligand-receptor interaction 0.0332481 0.0075343 2.122958 0.0075343 0.1597633 Grid1/Grik1/Vipr2/Gria4/Adra1a/Drd4/Ednrb/Calca/Edn3/P2rx2/Ptgfr/Grin2b/Gabra4 13
mmu04724 Glutamatergic synapse 0.0530973 0.0081045 2.091274 0.0081045 0.1597633 Kcnj3/Slc1a3/Grik1/Gria4/Gnai1/Grin2b 6
mmu04510 Focal adhesion 0.0398010 0.0127867 1.893241 0.0127867 0.2310583 Hgf/Col4a6/Igf1/Lamc3/Itga4/Kdr/Col9a2/Lama4 8
mmu04713 Circadian entrainment 0.0510204 0.0178954 1.747258 0.0178954 0.2793284 Kcnj3/Gria4/Ryr1/Gnai1/Grin2b 5
mmu04015 Rap1 signaling pathway 0.0373832 0.0180343 1.743901 0.0180343 0.2793284 Hgf/Angpt1/Igf1/Kdr/Gnai1/Evl/Grin2b/Rasgrp3 8
mmu04916 Melanogenesis 0.0500000 0.0193626 1.713036 0.0193626 0.2799084 Wnt6/Wnt11/Lef1/Ednrb/Gnai1 5
mmu04151 PI3K-Akt signaling pathway 0.0306407 0.0234769 1.629359 0.0234769 0.3022251 Hgf/Angpt1/Col4a6/Igf1/Lamc3/Areg/Itga4/Kdr/Nos3/Col9a2/Lama4 11
mmu05033 Nicotine addiction 0.0750000 0.0236939 1.625364 0.0236939 0.3022251 Gria4/Grin2b/Gabra4 3
mmu00910 Nitrogen metabolism 0.1176471 0.0278455 1.555244 0.0278455 0.3354493 Car4/Car8 2
mmu04390 Hippo signaling pathway 0.0382166 0.0350594 1.455195 0.0350594 0.4001241 Wnt6/Wnt11/Lef1/Areg/Nkd1/Gdf7 6
mmu05030 Cocaine addiction 0.0625000 0.0379529 1.420754 0.0379529 0.4114899 Maob/Gnai1/Grin2b 3
mmu04979 Cholesterol metabolism 0.0600000 0.0420678 1.376050 0.0420678 0.4343844 Apob/Lrp2/Soat1 3
mmu04310 Wnt signaling pathway 0.0350877 0.0496570 1.304019 0.0496570 0.4584936 Wnt6/Sfrp2/Wnt11/Lef1/Apcdd1/Nkd1 6
mmu04926 Relaxin signaling pathway 0.0387597 0.0498596 1.302251 0.0498596 0.4584936 Col4a6/Ednrb/Nos3/Gnai1/Mmp2 5
kegg_dot[[p]]

upset[[p]]

Pathway specific heatmaps

p=1
q=1
# create df with normalised read counts with an additional entrezid column for binding
logCPM <- cpm(dge, prior.count = 3, log = TRUE)
logCPM <- logCPM[,1:7]
logCPM <- cbind(logCPM, dge$genes$entrezid)
rownames(logCPM) <- dge$genes$gene_name
colnames(logCPM) <- c("Control 1", "Control 2", "Control 4", "Intact 1", "Intact 2", "Intact 3", "Intact 4", "entrezid")

### full pathway method
# complete_pathway <- kegg_pathway[[1]]$GENE %>% as.data.frame()
# complete_pathway <- focal_adhesion[seq(1, nrow(focal_adhesion), 2),]
# match_complete_pathway <- logCPM[,"entrezid"] %in% complete_pathway


# df for heatmap annotation of sample group
anno <- as.factor(dge$samples$group) %>% as.data.frame() 
anno <- anno[1:7,] %>% as.data.frame()
colnames(anno) <- "Sample Groups"
anno$`Sample Groups` <- gsub("CONT", "Control", anno$`Sample Groups`)
anno$`Sample Groups` <- gsub("INT", "Intact", anno$`Sample Groups`)
rownames(anno) <- colnames(logCPM[, 1:7])

# setting colour of sample group annotation

# original sample colours
# anno_colours <- c("#66C2A5", "#FC8D62")

# new sample colours
anno_colours <- c("#f8766d", "#a3a500")

names(anno_colours) <- c("Control", "Intact")
matrix <- list()
display_matrix <- list()
kegg_heat=list()

my_palette <- colorRampPalette(c(
  rgb(32,121,226, maxColorValue = 255),
  # rgb(144,203,180, maxColorValue = 255), 
  rgb(254,248,239, maxColorValue = 255), 
  # rgb(251,192,52, maxColorValue = 255), 
  rgb(226,46,45, maxColorValue = 255)))(n = 201)

for (i in 1:length(fc)) {
  x <- fc[i] %>% as.character()
  
  for (j in 1:length(kegg_id)) {
    y <- kegg_pathway[[j]]$PATHWAY_MAP
    
    partial <- enrichKEGG_all[[x]][, c("ID", "geneID")]
    partial <- partial[kegg_id[j], "geneID"] %>% as.data.frame()
    partial <- separate_rows(partial, ., sep = "/")
    colnames(partial) <- "entrezid"

    # heatmap matrix
    match <- rownames(logCPM) %in% partial$entrezid
    matrix[[x]][[y]] <- logCPM[match, c("Control 1", "Control 2", "Control 4", "Intact 1", "Intact 2", "Intact 3", "Intact 4")] %>% as.data.frame()
    
    # changing the colname to  numeric for some reason, cant remember
    
    matrix[[x]][[y]][, c("Control 1", "Control 2", "Control 4", "Intact 1", "Intact 2", "Intact 3", "Intact 4")] <- as.numeric(as.character(unlist(matrix[[x]][[y]][, c("Control 1", "Control 2", "Control 4", "Intact 1", "Intact 2", "Intact 3", "Intact 4")])))

    # display matrix
    match2 <- lmTreat_sig[[x]][, "entrezid"] %in% partial$entrezid
    display_matrix[[x]][[y]] <- lmTreat_sig[[x]][match2, c("gene_name", "logFC", "P.Value", "adj.P.Val", "description")] %>%
      as.data.frame()
    colnames(display_matrix[[x]][[y]]) <- c("Gene Name", "logFC", "P Value", "Adjusted P Value", "Description")
    
    ## Heatmap
    kegg_heat[[x]][[y]] <- pheatmap(
      mat = matrix[[x]][[y]],
      ### Publish
      show_colnames = T,
      main = paste0(y, "\n"),
      legend = F,
      annotation_legend = F,
      fontsize = 8,
      fontsize_col = 9,
      fontsize_number = 7,
      fontsize_row = 8,
      treeheight_row = 25,
      treeheight_col = 10,
      cluster_cols = T,
      clustering_distance_rows = "euclidean",
      legend_breaks = c(seq(-3, 11, by = .5), 1.4),
      legend_labels = c(seq(-3, 11, by = .5), "Z-Score"),
      angle_col = 90,
      cutree_cols = 2,
      cutree_rows = 2,
      color = my_palette,
      scale = "row",
      border_color = NA,
      annotation_col = anno,
      annotation_colors = list("Sample Groups" = anno_colours),
      annotation_names_col = F,
      annotation = T,
      silent = T,
      
      labels_row = as.expression(lapply(rownames(matrix[[x]][[y]]), function(a) bquote(italic(.(a)))))
      
      ) %>% as.ggplot()
    
    # save
    ggsave(filename = paste0("heat_", x, "_", y, ".svg"), 
           plot = kegg_heat[[x]][[y]], 
           path = here::here("2_plots/kegg/"),
           width = 166,
           height = 250,
           units = "mm")}
}
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description
# adjusting the kegg id to suit the parameters of the pathview funtion
adj.keggID <- gsub("mmu", "", kegg_id)

for (i in 1:length(fc)) {
  x <- fc[i] %>% as.character()
  
  # extract the logFC from the DE gene list
  pathview_table <- dplyr::select(.data = lmTreat_sig[[x]], c("logFC")) %>% as.matrix()

  # run pathview with Ensembl ID instead of entrezID
  pathview <- pathview(
    gene.data = pathview_table[, 1],
    gene.idtype = "ENSEMBL",
    pathway.id = adj.keggID,
    species = "mmu",
    out.suffix = "pv",
    kegg.dir = here::here("2_plots/kegg/"),
    kegg.native = T
  )

  # move the result file to the plot directory
  file.rename(
    from = paste0("mmu", adj.keggID, ".pv.png"),
    to = here::here(paste0("docs/figure/kegg.Rmd/pv_", x, "_", kegg_id, ".png"))
  )
}
[1] "Note: 166 of 1629 unique input IDs unmapped."
[1] "Note: 151 of 1447 unique input IDs unmapped."
[1] "Note: 63 of 388 unique input IDs unmapped."

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

p=p+1
q=1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

p=p+1
q=1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

q=q+1
kegg_heat[[p]][[q]]

display_matrix[[p]][[q]] %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  scroll_box(height = "600px")
Gene Name logFC P Value Adjusted P Value Description

Pathview

Export Data

# save to csv
writexl::write_xlsx(x = enrichKEGG_all, here::here("3_output/enrichKEGG_all.xlsx"))
writexl::write_xlsx(x = enrichKEGG_sig, here::here("3_output/enrichKEGG_sig.xlsx"))

sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.utf8  LC_CTYPE=English_Australia.utf8   
[3] LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.utf8    

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

other attached packages:
 [1] pathview_1.36.1       enrichplot_1.16.2     org.Mm.eg.db_3.15.0  
 [4] AnnotationDbi_1.58.0  IRanges_2.30.1        S4Vectors_0.34.0     
 [7] Biobase_2.56.0        BiocGenerics_0.42.0   clusterProfiler_4.4.4
[10] Glimma_2.6.0          edgeR_3.38.4          limma_3.52.4         
[13] ggrepel_0.9.1         ggbiplot_0.55         scales_1.2.1         
[16] plyr_1.8.7            ggpubr_0.4.0          ggplotify_0.1.0      
[19] pheatmap_1.0.12       cowplot_1.1.1         viridis_0.6.2        
[22] viridisLite_0.4.1     pander_0.6.5          kableExtra_1.3.4     
[25] KEGGREST_1.36.3       forcats_0.5.2         stringr_1.4.1        
[28] purrr_0.3.5           tidyr_1.2.1           ggplot2_3.3.6        
[31] tidyverse_1.3.2       reshape2_1.4.4        tibble_3.1.8         
[34] readr_2.1.3           magrittr_2.0.3        dplyr_1.0.10         

loaded via a namespace (and not attached):
  [1] utf8_1.2.2                  tidyselect_1.2.0           
  [3] RSQLite_2.2.18              htmlwidgets_1.5.4          
  [5] BiocParallel_1.30.3         scatterpie_0.1.8           
  [7] munsell_0.5.0               ragg_1.2.3                 
  [9] codetools_0.2-18            withr_2.5.0                
 [11] colorspace_2.0-3            GOSemSim_2.22.0            
 [13] highr_0.9                   knitr_1.40                 
 [15] rstudioapi_0.14             ggsignif_0.6.3             
 [17] DOSE_3.22.1                 labeling_0.4.2             
 [19] MatrixGenerics_1.8.1        KEGGgraph_1.56.0           
 [21] git2r_0.30.1                GenomeInfoDbData_1.2.8     
 [23] polyclip_1.10-0             bit64_4.0.5                
 [25] farver_2.1.1                rprojroot_2.0.3            
 [27] downloader_0.4              treeio_1.20.2              
 [29] vctrs_0.4.2                 generics_0.1.3             
 [31] xfun_0.33                   R6_2.5.1                   
 [33] GenomeInfoDb_1.32.4         graphlayouts_0.8.2         
 [35] locfit_1.5-9.6              bitops_1.0-7               
 [37] cachem_1.0.6                fgsea_1.22.0               
 [39] gridGraphics_0.5-1          DelayedArray_0.22.0        
 [41] assertthat_0.2.1            promises_1.2.0.1           
 [43] ggraph_2.1.0                googlesheets4_1.0.1        
 [45] gtable_0.3.1                tidygraph_1.2.2            
 [47] workflowr_1.7.0             rlang_1.0.6                
 [49] genefilter_1.78.0           systemfonts_1.0.4          
 [51] splines_4.2.1               lazyeval_0.2.2             
 [53] rstatix_0.7.0               gargle_1.2.1               
 [55] broom_1.0.1                 yaml_2.3.5                 
 [57] abind_1.4-5                 modelr_0.1.9               
 [59] backports_1.4.1             httpuv_1.6.6               
 [61] qvalue_2.28.0               tools_4.2.1                
 [63] ellipsis_0.3.2              jquerylib_0.1.4            
 [65] RColorBrewer_1.1-3          Rcpp_1.0.9                 
 [67] zlibbioc_1.42.0             RCurl_1.98-1.9             
 [69] SummarizedExperiment_1.26.1 haven_2.5.1                
 [71] here_1.0.1                  fs_1.5.2                   
 [73] data.table_1.14.2           DO.db_2.9                  
 [75] reprex_2.0.2                googledrive_2.0.0          
 [77] whisker_0.4                 matrixStats_0.62.0         
 [79] patchwork_1.1.2             hms_1.1.2                  
 [81] evaluate_0.17               xtable_1.8-4               
 [83] XML_3.99-0.11               readxl_1.4.1               
 [85] gridExtra_2.3               ggupset_0.3.0              
 [87] compiler_4.2.1              writexl_1.4.0              
 [89] shadowtext_0.1.2            crayon_1.5.2               
 [91] htmltools_0.5.3             ggfun_0.0.7                
 [93] later_1.3.0                 tzdb_0.3.0                 
 [95] geneplotter_1.74.0          aplot_0.1.8                
 [97] lubridate_1.8.0             DBI_1.1.3                  
 [99] tweenr_2.0.2                dbplyr_2.2.1               
[101] MASS_7.3-57                 Matrix_1.5-1               
[103] car_3.1-0                   cli_3.4.1                  
[105] parallel_4.2.1              igraph_1.3.5               
[107] GenomicRanges_1.48.0        pkgconfig_2.0.3            
[109] xml2_1.3.3                  ggtree_3.4.4               
[111] svglite_2.1.0               annotate_1.74.0            
[113] bslib_0.4.0                 webshot_0.5.4              
[115] XVector_0.36.0              rvest_1.0.3                
[117] yulab.utils_0.0.5           digest_0.6.29              
[119] graph_1.74.0                Biostrings_2.64.1          
[121] rmarkdown_2.17              cellranger_1.1.0           
[123] fastmatch_1.1-3             tidytree_0.4.1             
[125] curl_4.3.3                  nlme_3.1-157               
[127] lifecycle_1.0.3             jsonlite_1.8.2             
[129] carData_3.0-5               fansi_1.0.3                
[131] pillar_1.8.1                lattice_0.20-45            
[133] fastmap_1.1.0               httr_1.4.4                 
[135] survival_3.3-1              GO.db_3.15.0               
[137] glue_1.6.2                  png_0.1-7                  
[139] Rgraphviz_2.40.0            bit_4.0.4                  
[141] ggforce_0.4.1               stringi_1.7.8              
[143] sass_0.4.2                  blob_1.2.3                 
[145] textshaping_0.3.6           org.Hs.eg.db_3.15.0        
[147] DESeq2_1.36.0               memoise_2.0.1              
[149] ape_5.6-2