-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathfacets_suite.R
29 lines (24 loc) · 1.17 KB
/
facets_suite.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
#!/usr/bin/env Rscript
suppressPackageStartupMessages(library("optparse"))
suppressPackageStartupMessages(library("dplyr"))
suppressPackageStartupMessages(library("readr"))
suppressPackageStartupMessages(library("magrittr"))
if (!interactive()) {
options(warn = -1, error = quote({ traceback(); q('no', status = 1) }))
}
args_list <- list(make_option("--option", default = NA, type = 'character', help = "type of analysis"),
make_option("--sample_pairs", default = NA, type = 'character', help = "sample pairs"))
parser <- OptionParser(usage = "%prog", option_list = args_list)
arguments <- parse_args(parser, positional_arguments = T)
opt <- arguments$options
if (as.numeric(opt$option) == 1) {
sample_names = unlist(strsplit(as.character(opt$sample_pairs), split = " ", fixed = TRUE))
CN = list()
for (i in 1:length(sample_names)) {
CN[[i]] = readr::read_tsv(file = paste0("facets_suite/", sample_names[i], "/", sample_names[i], ".gene_level.txt"),
col_names = TRUE, col_types = cols(.default = col_character())) %>%
readr::type_convert()
}
CN = do.call(rbind, CN)
readr::write_tsv(x = CN, path = "facets_suite/summary.txt", col_names = TRUE, append = FALSE)
}