Mercurial > repos > galaxyp > data_manager_custom
view data_manager/customProDB_annotation.R @ 0:3c2c36beddb1 draft default tip
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/data_manager_customProDB commit 141369f97aa2804d2bbfd9ed620ea2a5574994c2-dirty
author | galaxyp |
---|---|
date | Fri, 15 Jan 2016 15:52:56 -0500 |
parents | |
children |
line wrap: on
line source
#!/usr/bin/env Rscript initial.options <- commandArgs(trailingOnly = FALSE) script_parent_dir <- dirname(sub("--file=", "", initial.options[grep("--file=", initial.options)])) ## begin warning handler withCallingHandlers({ library(methods) # Because Rscript does not always do this options('useFancyQuotes' = FALSE) suppressPackageStartupMessages(library("optparse")) suppressPackageStartupMessages(library("RGalaxy")) option_list <- list() option_list$dbkey <- make_option('--dbkey', type='character') option_list$outputFile <- make_option('--outputFile', type='character') opt <- parse_args(OptionParser(option_list=option_list)) customProDB_annotation <- function( dbkey = GalaxyCharacterParam(required=TRUE), outputFile = GalaxyOutput("output","json")) { if (file.exists(outputFile)) { if (file.info(outputFile)$size > 0) { gstop("output file already exists") } else { tryCatch( { file.remove(outputFile) }, error=function(err) { gstop("failed to remove empty existing file") }) } } gstop("what you talkin bout willis?!") } params <- list() for(param in names(opt)) { if (!param == "help") params[param] <- opt[param] } setClass("GalaxyRemoteError", contains="character") wrappedFunction <- function(f) { tryCatch(do.call(f, params), error=function(e) new("GalaxyRemoteError", conditionMessage(e))) } suppressPackageStartupMessages(library(RGalaxy)) do.call(customProDB_annotation, params) ## end warning handler }, warning = function(w) { cat(paste("Warning:", conditionMessage(w), "\n")) invokeRestart("muffleWarning") })