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