Mercurial > repos > greg > ideas
changeset 16:79acab9c6524 draft
Uploaded
author | greg |
---|---|
date | Thu, 10 Aug 2017 14:41:35 -0400 |
parents | 65739ddd00be |
children | e8dd7b5e4e95 |
files | build_matrix.R |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/build_matrix.R Thu Aug 10 14:23:32 2017 -0400 +++ b/build_matrix.R Thu Aug 10 14:41:35 2017 -0400 @@ -5,15 +5,15 @@ option_list <- list( make_option(c("-i", "--input"), action="store", dest="input", help="Input .bed.gz file produced by prepMat"), make_option(c("-o", "--output"), action="store", dest="output", help="Output file"), - make_option(c("-w", "--work_dir"), action="store", dest="work_dir", help="Working directory"), + make_option(c("-w", "--work_dir"), action="store", dest="work_dir", help="Working directory") ) parser <- OptionParser(usage="%prog [options] file", option_list=option_list) args <- parse_args(parser, positional_arguments=TRUE) opt <- args$options -r_matrix = as.matrix(read.table(opt$input)); -status = match(r_matrix[,3], missing); -r_matrix[,3] = paste(opt$work_dir, r_matrix[,1], ".", r_matrix[,2], ".bed.gz", sep=""); -r_matrix = r_matrix[is.na(status)==T,]; -write.table(array(r_matrix, dim = c(length(r_matrix) / 3, 3)), opt$output, quote=F, row.names=F, col.names=F); +r_matrix <- as.matrix(read.table(opt$input)); +status <- match(r_matrix[,3], missing); +r_matrix[,3] <- paste(opt$work_dir, r_matrix[,1], ".", r_matrix[,2], ".bed.gz", sep=""); +r_matrix <- r_matrix[is.na(status)==T,]; +write.table(array(r_matrix, dim=c(length(r_matrix)/3, 3)), opt$output, quote=F, row.names=F, col.names=F);