-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_h5_split_by_hash.R
74 lines (65 loc) · 2.22 KB
/
run_h5_split_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
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
library(optparse)
option_list <- list(
make_option(opt_str = c("-i","--in_h5"),
type = "character",
default = NULL,
help = "Input filtered_feature_bc_matrix.h5 file",
metavar = "character"),
make_option(opt_str = c("-l","--in_mol"),
type = "character",
default = NULL,
help = "Input molecule_info.h5 file (Ignored/Deprecated)",
metavar = "character"),
make_option(opt_str = c("-m","--in_mat"),
type = "character",
default = NULL,
help = "Input HTO count matrix file",
metavar = "character"),
make_option(opt_str = c("-c","--in_tbl"),
type = "character",
default = NULL,
help = "Input HTO category table file",
metavar = "character"),
make_option(opt_str = c("-w","--in_well"),
type = "character",
default = NULL,
help = "Well",
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_h5)) {
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,
paste0(args$in_well,
"_split_h5_by_hash.Rmd"))
file.copy(system.file("rmarkdown/split_h5_by_hash.Rmd", package = "H5weaver"),
rmd_path,
overwrite = TRUE)
rmarkdown::render(
input = rmd_path,
params = list(in_h5 = args$in_h5,
in_mol = args$in_mol,
in_mat = args$in_mat,
in_tbl = args$in_tbl,
in_well = args$in_well,
out_dir = args$out_dir),
output_file = args$out_html,
quiet = TRUE
)
file.remove(rmd_path)