comparison bum.R @ 3:2b80a2596064 draft default tip

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/heinz commit 8007f71281553ddfa45e6f8e1172952d956bb000"
author iuc
date Thu, 11 Jun 2020 07:18:17 -0400
parents e41ec5af7472
children
comparison
equal deleted inserted replaced
2:704c401e0afb 3:2b80a2596064
1 # Author: Cico Zhang 1 # Author: Cico Zhang
2 # Usage: Rscript bum.R --input p-values.txt --output result.txt --verbose TRUE 2 # Usage: Rscript bum.R --input p-values.txt --output result.txt --verbose TRUE
3 3
4 # Set up R error handling to go to stderr 4 # Set up R error handling to go to stderr
5 options(show.error.messages=F, error=function(){cat(geterrmessage(),file=stderr());q("no",1,F)}) 5 err_foo <- function() {
6 6 cat(geterrmessage(), file = stderr());
7 # Avoid crashing Galaxy with an UTF8 error on German LC settings 7 q("no", 1, F)
8 #loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") 8 }
9 options(show.error.messages = F, error = err_foo)
9 10
10 # Import required libraries 11 # Import required libraries
11 suppressPackageStartupMessages({ 12 suppressPackageStartupMessages({
12 library('getopt') 13 library("getopt")
13 library('BioNet') 14 library("BioNet")
14 }) 15 })
15 16
16 # Take in trailing command line arguments 17 # Take in trailing command line arguments
17 args <- commandArgs(trailingOnly = TRUE) 18 args <- commandArgs(trailingOnly = TRUE)
18 19
19 # Get options using the spec as defined by the enclosed list 20 # Get options using the spec as defined by the enclosed list
20 # Read the options from the default: commandArgs(TRUE) 21 # Read the options from the default: commandArgs(TRUE)
21 option_specification <- matrix(c( 22 option_specification <- matrix(c("input", "i", 2, "character",
22 'input', 'i', 2, 'character', 23 "output", "o", 2, "character"
23 'output', 'o', 2, 'character' 24 ), byrow = TRUE, ncol = 4);
24 ), byrow=TRUE, ncol=4);
25 25
26 # Parse options 26 # Parse options
27 options <- getopt(option_specification); 27 options <- getopt(option_specification);
28 28
29 pvals <- read.table(options$input) 29 pvals <- read.table(options$input)
30 bum <- fitBumModel(pvals,plot=FALSE) 30 bum <- fitBumModel(pvals, plot = FALSE)
31 mat <- c(bum$lambda, bum$a) 31 mat <- c(bum$lambda, bum$a)
32 #bumtablename <- paste(options$output,sep="\t") 32 write.table(x = mat, file = options$output, quote = FALSE,
33 write.table(x=mat, file=options$output,quote=FALSE, row.names=FALSE, col.names=FALSE) 33 row.names = FALSE, col.names = FALSE)
34 message ("Parameters have been estimated successfully!") 34 message("Parameters have been estimated successfully!")