Mercurial > repos > greg > ideas
comparison create_heatmaps.R @ 141:a976dd6fcd1b draft
Uploaded
author | greg |
---|---|
date | Wed, 20 Dec 2017 11:24:23 -0500 |
parents | |
children | 269e7e466b00 |
comparison
equal
deleted
inserted
replaced
140:17e8829bbae2 | 141:a976dd6fcd1b |
---|---|
1 #!/usr/bin/env Rscript | |
2 | |
3 suppressPackageStartupMessages(library("optparse")) | |
4 | |
5 option_list <- list( | |
6 make_option(c("-i", "--input_dir"), action="store", dest="input_dir", help="IDEAS para files directory"), | |
7 make_option(c("-o", "--output_dir"), action="store", dest="output_dir", help="PDF output directory") | |
8 ) | |
9 | |
10 parser <- OptionParser(usage="%prog [options] file", option_list=option_list); | |
11 args <- parse_args(parser, positional_arguments=TRUE); | |
12 opt <- args$options; | |
13 | |
14 source("create_heatmap.R"); | |
15 | |
16 para_files <- list.files(path=opt$input_dir, pattern="\\.para$", full.names=TRUE); | |
17 for (i in 1:length(para_files)) { | |
18 para_file <- para_files[i]; | |
19 para_file_base_name <- strsplit(para_file, split="/")[[1]][2]; | |
20 output_file_base_name <- gsub(".para", "", para_file_base_name); | |
21 output_file_name <- paste(output_file_base_name, "state", i, "pdf", sep="."); | |
22 output_file_path <- paste(opt$output_dir, output_file_name, sep="/"); | |
23 data_frame <- read.table(para_file, comment="!", header=T); | |
24 create_heatmap(data_frame, output_file_path); | |
25 } |