-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_h5_merge_by_hash.R
48 lines (39 loc) · 1.22 KB
/
run_h5_merge_by_hash.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
45
46
47
48
library(optparse)
option_list <- list(
make_option(opt_str = c("-i","--in_dir"),
type = "character",
default = NULL,
help = "Input directory containing HDF5 files",
metavar = "character"),
make_option(opt_str = c("-d","--out_dir"),
type = "character",
default = NULL,
help = "Output Directory",
metavar = "character"),
make_option(opt_str = c("-o","--out_html"),
type = "character",
default = NULL,
help = "Output HTML run summary file",
metavar = "character")
)
opt_parser <- OptionParser(option_list = option_list)
args <- parse_args(opt_parser)
if(is.null(args$in_dir)) {
print_help(opt_parser)
stop("No parameters supplied.")
}
if(!dir.exists(args$out_dir)) {
dir.create(args$out_dir)
}
rmd_path <- file.path(args$out_dir,"merge_h5_by_hash.Rmd")
file.copy(system.file("rmarkdown/merge_h5_by_hash.Rmd", package = "H5weaver"),
rmd_path,
overwrite = TRUE)
rmarkdown::render(
input = rmd_path,
params = list(in_dir = args$in_dir,
out_dir = args$out_dir),
output_file = args$out_html,
quiet = TRUE
)
file.remove(rmd_path)