-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7b_target_summary.R
44 lines (38 loc) · 1.68 KB
/
7b_target_summary.R
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
HomeFolder <- "/lustre/scratch123/hgi/teams/parts/cf14/crispr_scrnaseq_hipsci/"
section_name <- "7b_target_summary"
date <- "2022-08-15"
ExperimentName <- "Magpie"
# options
args <- commandArgs(trailingOnly = TRUE)
for (ind in 1:length(args)){
arg <- args[[ind]]
if (arg == "--date"){ date <- args[[ind + 1]] }
if (arg == "--home_folder"){ HomeFolder <- args[[ind + 1]] }
if (arg == "--section_name"){ section_name <- args[[ind + 1]] }
if (arg == "--experiment_name"){ ExperimentName <- args[[ind + 1]] }
if (arg == "--padj_th"){ padj_th <- as.numeric(args[[ind + 1]]) }
if (arg == "--abs_lfc_th"){ abs_lfc_th <- as.numeric(args[[ind + 1]]) }
}
# i/o
source(file.path(HomeFolder, "scripts/io/", paste0(ExperimentName, "_io.R")))
outdir <- file.path(OutFolder, section_name)
plotsdir <- file.path(HTMLFolder, "pipeline/", section_name)
if(!dir.exists(outdir)) dir.create(outdir)
if(!dir.exists(plotsdir)) dir.create(plotsdir)
if (!exists("padj_th")){padj_th <- sig_pval_thresh}
if (!exists("abs_lfc_th")){abs_lfc_th <- sig_abs_lfc_thresh}
## LoadData
MagpieGuideMetadata <- fread(GuideMetadataPath)
# define parameters for Rmd
params_list <- list(home_folder = HomeFolder,
date = date,
section_name = section_name,
experiment_name = ExperimentName,
padj_th = sig_pval_thresh,
abs_lfc_th = sig_abs_lfc_thresh)
# run Rmd and create htmls
fnm_html <- paste0(section_name,".html")
rmarkdown::render(paste0(CodeFolder, "/Magpie/pipeline/", section_name, ".Rmd"),
envir = new.env(),
output_file = file.path(plotsdir, fnm_html),
params = params_list)