Mercurial > repos > ethevenot > checkformat
diff checkFormat_wrapper.R @ 0:0d8099822c49 draft
planemo upload for repository https://github.com/workflow4metabolomics/checkformat.git commit 217d97da5c733c3628997666c73867e81af0a0ee
author | ethevenot |
---|---|
date | Sat, 30 Jul 2016 12:06:35 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/checkFormat_wrapper.R Sat Jul 30 12:06:35 2016 -0400 @@ -0,0 +1,77 @@ +#!/usr/bin/Rscript --vanilla --slave --no-site-file + +library(batch) ## parseCommandArgs + +source_local <- function(fname){ + argv <- commandArgs(trailingOnly = FALSE) + base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) + source(paste(base_dir, fname, sep="/")) +} + +source_local("checkFormat_script.R") + +argVc <- unlist(parseCommandArgs(evaluate = FALSE)) + + +##------------------------------ +## Initializing +##------------------------------ + +## options +##-------- + +strAsFacL <- options()$stringsAsFactors +options(stringsAsFactors = FALSE) + +## constants +##---------- + +modNamC <- "Check Format" ## module name + +## log file +##--------- + +sink(argVc["information"]) + +cat("\nStart of the '", modNamC, "' Galaxy module call: ", + format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="") + + +##------------------------------ +## Computation +##------------------------------ + + +resLs <- readAndCheckF(argVc["dataMatrix_in"], + argVc["sampleMetadata_in"], + argVc["variableMetadata_in"]) +chkL <- resLs[["chkL"]] + + +##------------------------------ +## Ending +##------------------------------ + + +if(chkL) { + + cat("\nTable formats are OK; enjoy your analyses!\n", sep="") + + cat("\nEnd of the '", modNamC, "' Galaxy module call: ", + format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="") + + sink() + +} else { + + sink() + stop("Please check the generated 'information' file") + +} + +## closing +##-------- + +options(stringsAsFactors = strAsFacL) + +rm(list = ls())