Mercurial > repos > dktanwar > test_r
view tmpnt.R @ 0:cc424daed0b0 draft
Uploaded
author | dktanwar |
---|---|
date | Tue, 24 Oct 2017 07:05:58 -0400 |
parents | |
children |
line wrap: on
line source
## 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")