1+ # ## Below is quarto voodoo to make sure the environment is saved and loaded between pages, because quarto is KM, not MK
2+
3+ # Load common environment if it exists
4+ if (file.exists(here :: here(" data/env.RData" ))) {
5+ load(here :: here(" data/env.RData" ))
6+ }
7+
8+ # Hook knitr to save common environment on each document render end
9+ local({
10+ hook_old <- knitr :: knit_hooks $ get(" document" ) # Grab current hook
11+ knitr :: knit_hooks $ set(
12+ document = function (x ) {
13+ save.image(file = here :: here(" data/env.RData" )) # Save environment
14+ hook_old(x ) # Important: call the original hook, or everything will break
15+ }
16+ )
17+ })
18+
19+ # ## End of quarto voodoo
20+
21+ # ##Helper lines may be uncommented to install packages manually!
22+
23+ # if (!require("BiocManager", quietly = TRUE))
24+ # install.packages("BiocManager")
25+ #
26+ # BiocManager::install("org.Hs.eg.db", force = TRUE)
27+ # BiocManager::install("topGO", force = TRUE)
28+ # renv::install("IOR-Bioinformatics/PCSF", force = TRUE)
29+ # renv::install("CogDisResLab/Kinograte", force = TRUE)
30+
31+ # ##Load all packages statistically for renv
32+ suppressPackageStartupMessages({
33+ library(here )
34+ library(babelgene )
35+ library(tidyverse )
36+ library(kinograte )
37+ library(HGNChelper )
38+ library(creedenzymatic )
39+ library(DT )
40+ library(htmltools )
41+ library(enrichR )
42+ library(ggnetwork )
43+ library(igraph )
44+ library(intergraph )
45+ library(network )
46+ library(scatterpie )
47+ library(fgsea )
48+ library(PAVER )
49+ library(ggprism )
50+ library(svglite )
51+ library(httr )
52+ library(jsonlite )
53+ })
54+
55+ knitr :: opts_chunk $ set(
56+ comment = " #>" ,
57+ cache = FALSE ,
58+ echo = FALSE ,
59+ message = FALSE ,
60+ warning = FALSE
61+ )
62+
63+ options(readr.show_col_types = FALSE )
64+
65+ set.seed(123 )
66+
67+ # Quiet any noisy function
68+ quiet <- function (x ) {
69+ sink(tempfile())
70+ on.exit(sink())
71+ invisible (force(x ))
72+ }
73+
74+ # Make a formatted HTML table
75+ make_table <- function (df , caption = NULL ) {
76+ DT :: datatable(
77+ df ,
78+ rownames = FALSE ,
79+ caption = tags $ caption(style = ' text-align: left;' , caption ),
80+ options = list (
81+ scrollX = TRUE ,
82+ scrollY = TRUE ,
83+ paging = TRUE ,
84+ fixedHeader = TRUE ,
85+ pageLength = 10
86+ )
87+ ) %> % formatStyle(names(df ), " white-space" = " nowrap" )
88+ }
0 commit comments