Mercurial > repos > bcclaywell > microbiome_community_suite
comparison community.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$CountsFile <- make_option('--CountsFile', type='character') | |
| 17 option_list$SamplesFile <- make_option('--SamplesFile', type='character') | |
| 18 option_list$K <- make_option('--K', type='numeric') | |
| 19 option_list$A <- make_option('--A', type='numeric') | |
| 20 option_list$Transform <- make_option('--Transform', type='character') | |
| 21 option_list$SampleName <- make_option('--SampleName', type='character') | |
| 22 option_list$ColumnClasses <- make_option('--ColumnClasses', type='character') | |
| 23 option_list$OutputFile <- make_option('--OutputFile', type='character') | |
| 24 | |
| 25 | |
| 26 opt <- parse_args(OptionParser(option_list=option_list)) | |
| 27 | |
| 28 suppressPackageStartupMessages(library(microbiomePkg)) | |
| 29 | |
| 30 ## function body not needed here, it is in package | |
| 31 | |
| 32 params <- list() | |
| 33 for(param in names(opt)) | |
| 34 { | |
| 35 if (!param == "help") | |
| 36 params[param] <- opt[param] | |
| 37 } | |
| 38 | |
| 39 setClass("GalaxyRemoteError", contains="character") | |
| 40 wrappedFunction <- function(f) | |
| 41 { | |
| 42 tryCatch(do.call(f, params), | |
| 43 error=function(e) new("GalaxyRemoteError", conditionMessage(e))) | |
| 44 } | |
| 45 | |
| 46 | |
| 47 suppressPackageStartupMessages(library(RGalaxy)) | |
| 48 do.call(community, params) | |
| 49 | |
| 50 ## end warning handler | |
| 51 }, warning = function(w) { | |
| 52 cat(paste("Warning:", conditionMessage(w), "\n")) | |
| 53 invokeRestart("muffleWarning") | |
| 54 }) |
