# HG changeset patch # User greg # Date 1516649728 18000 # Node ID 91c5dbb14a13d0bb0fdf3350e23b743044f560eb # Parent f060a0fbd4fe528381f0e8e0f2fd8d2d83b19b15 Uploaded diff -r f060a0fbd4fe -r 91c5dbb14a13 ideas_preprocessor.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ideas_preprocessor.R Mon Jan 22 14:35:28 2018 -0500 @@ -0,0 +1,62 @@ +#!/usr/bin/env Rscript + +suppressPackageStartupMessages(library("data.table")) +suppressPackageStartupMessages(library("optparse")) + +option_list <- list( + make_option(c("--bed_input"), action="store", dest="bed_input", defaul=NULL, help="Chromosome windows positions file"), + make_option(c("--exclude_input"), action="store", dest="exclude_input", defaul=NULL, help="File(s) containing regions to exclude"), + make_option(c("--bychr"), action="store_true", dest="bychr", defaul=FALSE, help="Separate files by chromosome"), + make_option(c("--chrom_len_file"), action="store", dest="chrom_len_file", default=NULL, help="Chromosome lengths file"), + make_option(c("--output"), action="store", dest="output", help="Primary output dataset"), + make_option(c("--output_files_path"), action="store", dest="output_files_path", help="Primary output dataset extra files path"), + make_option(c("--prep_input_config"), action="store", dest="prep_input_config", help="Preprocessing input config file"), + make_option(c("--reads_per_bp"), action="store", dest="reads_per_bp", type="integer", help="Calculate the signal in each genomic window"), + make_option(c("--restrict_to_chroms"), action="store", dest="restrict_to_chroms", default=NULL, help="Restrict processing to specified chromosomes"), + make_option(c("--standardize_datasets"), action="store_true", dest="standardize_datasets", default=FALSE, help="Standardize all datasets"), + make_option(c("--window_size"), action="store", dest="window_size", type="integer", default=NULL, help="Window size in base pairs") +) + +parser <- OptionParser(usage="%prog [options] file", option_list=option_list) +args <- parse_args(parser, positional_arguments=TRUE) +opt <- args$options + +create_primary_html = function(output, output_files_path) { + tmp_files = list.files(path=output_files_path); + s <- paste('
', sep="\n"); + s <- paste(s, '