Mercurial > repos > greg > ideas_preprocessor
comparison ideas_preprocessor.R @ 18:504226a7eb75 draft
Uploaded
author | greg |
---|---|
date | Tue, 30 Jan 2018 13:21:00 -0500 |
parents | ce2021cd68d2 |
children | 99102499271a |
comparison
equal
deleted
inserted
replaced
17:6ff92012abb7 | 18:504226a7eb75 |
---|---|
20 make_option(c("--bychr"), action="store_true", dest="bychr", defaul=FALSE, help="Separate files by chromosome"), | 20 make_option(c("--bychr"), action="store_true", dest="bychr", defaul=FALSE, help="Separate files by chromosome"), |
21 make_option(c("--chrom_len_file"), action="store", dest="chrom_len_file", default=NULL, help="Chromosome lengths file"), | 21 make_option(c("--chrom_len_file"), action="store", dest="chrom_len_file", default=NULL, help="Chromosome lengths file"), |
22 make_option(c("--ideaspre_input_config"), action="store", dest="ideaspre_input_config", help="Preprocessing input config file"), | 22 make_option(c("--ideaspre_input_config"), action="store", dest="ideaspre_input_config", help="Preprocessing input config file"), |
23 make_option(c("--output"), action="store", dest="output", help="Primary output dataset"), | 23 make_option(c("--output"), action="store", dest="output", help="Primary output dataset"), |
24 make_option(c("--output_files_path"), action="store", dest="output_files_path", help="Primary output dataset extra files path"), | 24 make_option(c("--output_files_path"), action="store", dest="output_files_path", help="Primary output dataset extra files path"), |
25 make_option(c("--output_hid"), action="store", dest="output_hid", help="Primary output dataset hid"), | |
26 make_option(c("--reads_per_bp"), action="store", dest="reads_per_bp", type="integer", help="Calculate the signal in each genomic window"), | 25 make_option(c("--reads_per_bp"), action="store", dest="reads_per_bp", type="integer", help="Calculate the signal in each genomic window"), |
27 make_option(c("--restrict_to_chroms"), action="store", dest="restrict_to_chroms", default=NULL, help="Restrict processing to specified chromosomes"), | 26 make_option(c("--restrict_to_chroms"), action="store", dest="restrict_to_chroms", default=NULL, help="Restrict processing to specified chromosomes"), |
28 make_option(c("--standardize_datasets"), action="store_true", dest="standardize_datasets", default=FALSE, help="Standardize all datasets"), | 27 make_option(c("--standardize_datasets"), action="store_true", dest="standardize_datasets", default=FALSE, help="Standardize all datasets"), |
29 make_option(c("--chromosome_windows"), action="store", dest="chromosome_windows", default=NULL, help="Windows positions by chroms config file"), | 28 make_option(c("--chromosome_windows"), action="store", dest="chromosome_windows", default=NULL, help="Windows positions by chroms config file"), |
30 make_option(c("--window_size"), action="store", dest="window_size", type="integer", default=NULL, help="Window size in base pairs") | 29 make_option(c("--window_size"), action="store", dest="window_size", type="integer", default=NULL, help="Window size in base pairs") |
32 | 31 |
33 parser <- OptionParser(usage="%prog [options] file", option_list=option_list) | 32 parser <- OptionParser(usage="%prog [options] file", option_list=option_list) |
34 args <- parse_args(parser, positional_arguments=TRUE) | 33 args <- parse_args(parser, positional_arguments=TRUE) |
35 opt <- args$options | 34 opt <- args$options |
36 | 35 |
37 create_primary_html = function(output, output_hid, output_files_path) { | 36 create_primary_html = function(output, output_files_path) { |
38 files = list.files(path=output_files_path); | 37 files = list.files(path=output_files_path); |
39 s <- paste('<html><head></head><body>', sep="\n"); | 38 s <- paste('<html><head></head><body>', sep="\n"); |
40 s <- paste(s, '<h3>History item ', output_hid, ' files prepared for IDEAS</h3>\n', sep=""); | 39 s <- paste(s, '<h3>Files prepared for IDEAS</h3>\n', sep=""); |
41 s <- paste(s, '<ul>\n', sep=""); | 40 s <- paste(s, '<ul>\n', sep=""); |
42 for (i in 1:length(files)) { | 41 for (i in 1:length(files)) { |
43 s <- paste(s, '<li><a href="', files[i], '">', files[i], '</a></li>\n', sep=""); | 42 s <- paste(s, '<li><a href="', files[i], '">', files[i], '</a></li>\n', sep=""); |
44 } | 43 } |
45 s <- paste(s, '</ul>\n</body>\n</html>', sep=""); | 44 s <- paste(s, '</ul>\n</body>\n</html>', sep=""); |
115 # Move chromosome_windows.txt to the output directory. | 114 # Move chromosome_windows.txt to the output directory. |
116 to_path = paste(opt$output_files_path, opt$chromosome_windows, sep="/"); | 115 to_path = paste(opt$output_files_path, opt$chromosome_windows, sep="/"); |
117 file.rename(opt$chromosome_windows, to_path); | 116 file.rename(opt$chromosome_windows, to_path); |
118 } | 117 } |
119 # Create the primary HTML dataset. | 118 # Create the primary HTML dataset. |
120 create_primary_html(opt$output, opt$output_hid, opt$output_files_path); | 119 create_primary_html(opt$output, opt$output_files_path); |