Mercurial > repos > bcclaywell > microbiome_community_suite
comparison descriptiveStatistics.R @ 0:12b4f093e6c4 draft default tip
planemo upload commit 2774930eebe258ecd56c8f1c5ddabf5092282ab9
| author | bcclaywell |
|---|---|
| date | Mon, 12 Oct 2015 16:46:15 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:12b4f093e6c4 |
|---|---|
| 1 #!/usr/bin/env Rscript | |
| 2 | |
| 3 ## begin warning handler | |
| 4 withCallingHandlers({ | |
| 5 | |
| 6 library(methods) # Because Rscript does not always do this | |
| 7 | |
| 8 options('useFancyQuotes' = FALSE) | |
| 9 | |
| 10 suppressPackageStartupMessages(library("optparse")) | |
| 11 suppressPackageStartupMessages(library("RGalaxy")) | |
| 12 | |
| 13 | |
| 14 option_list <- list() | |
| 15 | |
| 16 option_list$CommunityFile <- make_option('--CommunityFile', type='character') | |
| 17 option_list$Attributes <- make_option('--Attributes', type='character') | |
| 18 option_list$OutputFile <- make_option('--OutputFile', type='character') | |
| 19 | |
| 20 | |
| 21 opt <- parse_args(OptionParser(option_list=option_list)) | |
| 22 | |
| 23 suppressPackageStartupMessages(library(microbiomePkg)) | |
| 24 | |
| 25 ## function body not needed here, it is in package | |
| 26 | |
| 27 params <- list() | |
| 28 for(param in names(opt)) | |
| 29 { | |
| 30 if (!param == "help") | |
| 31 params[param] <- opt[param] | |
| 32 } | |
| 33 | |
| 34 setClass("GalaxyRemoteError", contains="character") | |
| 35 wrappedFunction <- function(f) | |
| 36 { | |
| 37 tryCatch(do.call(f, params), | |
| 38 error=function(e) new("GalaxyRemoteError", conditionMessage(e))) | |
| 39 } | |
| 40 | |
| 41 | |
| 42 suppressPackageStartupMessages(library(RGalaxy)) | |
| 43 do.call(descriptiveStatistics, params) | |
| 44 | |
| 45 ## end warning handler | |
| 46 }, warning = function(w) { | |
| 47 cat(paste("Warning:", conditionMessage(w), "\n")) | |
| 48 invokeRestart("muffleWarning") | |
| 49 }) |
