Next changeset 1:6bcf6f6a347d (2017-10-24) |
Commit message:
Uploaded |
added:
tmpnt.R |
b |
diff -r 000000000000 -r cc424daed0b0 tmpnt.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tmpnt.R Tue Oct 24 07:05:58 2017 -0400 |
b |
@@ -0,0 +1,43 @@ +## How to execute this tool +# $Rscript test_norm.R --input input.txt --output output.txt + +# Send R errors to stderr +options(show.error.messages = F, error = function(){cat(geterrmessage(), file = stderr()); q("no", 1, F)}) + +# Avoid crashing Galaxy with an UTF8 error on German LC settings +loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") + +# Import library +library("getopt") +library(limma) +library("edgeR") + +options(stringAsfactors = FALSE, useFancyQuotes = FALSE) + +# Take in trailing command line arguments +args <- commandArgs(trailingOnly = TRUE) + +# Get options using the spec as defined by the enclosed list +# Options are read from the default: commandArgs(TRUE) +option_specification = matrix(c( + 'input', 'i', 2, 'character', + 'output', 'o', 2, 'character' +), byrow=TRUE, ncol=4); + +# Parse options +options = getopt(option_specification); + +# Print options to stderr for debugging +cat("\n input: ", options$input) +cat("\n output: ", options$output) + +# Read in the input file +inp <- read.table(file = options$input, sep = "\t", header = T, stringsAsFactors = FALSE) + +# Changes every value in the first column to 0 +cpm <- inp2 + +# Write output to new file which will be recognized by Galaxy +write.table(cpm, file = options$output, row.names = F, quote = F, sep = "\t") + +cat("\n success \n") |