Mercurial > repos > dktanwar > test_r
comparison tmpnt.R @ 0:cc424daed0b0 draft
Uploaded
author | dktanwar |
---|---|
date | Tue, 24 Oct 2017 07:05:58 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cc424daed0b0 |
---|---|
1 ## How to execute this tool | |
2 # $Rscript test_norm.R --input input.txt --output output.txt | |
3 | |
4 # Send R errors to stderr | |
5 options(show.error.messages = F, error = function(){cat(geterrmessage(), file = stderr()); q("no", 1, F)}) | |
6 | |
7 # Avoid crashing Galaxy with an UTF8 error on German LC settings | |
8 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") | |
9 | |
10 # Import library | |
11 library("getopt") | |
12 library(limma) | |
13 library("edgeR") | |
14 | |
15 options(stringAsfactors = FALSE, useFancyQuotes = FALSE) | |
16 | |
17 # Take in trailing command line arguments | |
18 args <- commandArgs(trailingOnly = TRUE) | |
19 | |
20 # Get options using the spec as defined by the enclosed list | |
21 # Options are read from the default: commandArgs(TRUE) | |
22 option_specification = matrix(c( | |
23 'input', 'i', 2, 'character', | |
24 'output', 'o', 2, 'character' | |
25 ), byrow=TRUE, ncol=4); | |
26 | |
27 # Parse options | |
28 options = getopt(option_specification); | |
29 | |
30 # Print options to stderr for debugging | |
31 cat("\n input: ", options$input) | |
32 cat("\n output: ", options$output) | |
33 | |
34 # Read in the input file | |
35 inp <- read.table(file = options$input, sep = "\t", header = T, stringsAsFactors = FALSE) | |
36 | |
37 # Changes every value in the first column to 0 | |
38 cpm <- inp2 | |
39 | |
40 # Write output to new file which will be recognized by Galaxy | |
41 write.table(cpm, file = options$output, row.names = F, quote = F, sep = "\t") | |
42 | |
43 cat("\n success \n") |