Mercurial > repos > ethevenot > checkformat
comparison checkformat_wrapper.R @ 1:e194eec8e70c draft
planemo upload for repository https://github.com/workflow4metabolomics/checkformat.git commit 8ebfbfa8d9449c9bbfbf569851a30b1e33df0b3f
author | ethevenot |
---|---|
date | Sat, 06 Aug 2016 11:54:28 -0400 |
parents | |
children | b6a6b4cc932a |
comparison
equal
deleted
inserted
replaced
0:0d8099822c49 | 1:e194eec8e70c |
---|---|
1 #!/usr/bin/env Rscript | |
2 | |
3 library(batch) ## parseCommandArgs | |
4 | |
5 source_local <- function(fname){ | |
6 argv <- commandArgs(trailingOnly = FALSE) | |
7 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) | |
8 source(paste(base_dir, fname, sep="/")) | |
9 } | |
10 | |
11 source_local("checkformat_script.R") | |
12 | |
13 argVc <- unlist(parseCommandArgs(evaluate = FALSE)) | |
14 | |
15 | |
16 ##------------------------------ | |
17 ## Initializing | |
18 ##------------------------------ | |
19 | |
20 ## options | |
21 ##-------- | |
22 | |
23 strAsFacL <- options()$stringsAsFactors | |
24 options(stringsAsFactors = FALSE) | |
25 | |
26 ## constants | |
27 ##---------- | |
28 | |
29 modNamC <- "Check Format" ## module name | |
30 | |
31 ## log file | |
32 ##--------- | |
33 | |
34 sink(argVc["information"]) | |
35 | |
36 cat("\nStart of the '", modNamC, "' Galaxy module call: ", | |
37 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="") | |
38 | |
39 | |
40 ##------------------------------ | |
41 ## Computation | |
42 ##------------------------------ | |
43 | |
44 | |
45 resLs <- readAndCheckF(argVc["dataMatrix_in"], | |
46 argVc["sampleMetadata_in"], | |
47 argVc["variableMetadata_in"]) | |
48 chkL <- resLs[["chkL"]] | |
49 | |
50 | |
51 ##------------------------------ | |
52 ## Ending | |
53 ##------------------------------ | |
54 | |
55 | |
56 if(chkL) { | |
57 | |
58 cat("\nTable formats are OK; enjoy your analyses!\n", sep="") | |
59 | |
60 cat("\nEnd of the '", modNamC, "' Galaxy module call: ", | |
61 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="") | |
62 | |
63 sink() | |
64 | |
65 } else { | |
66 | |
67 sink() | |
68 stop("Please check the generated 'information' file") | |
69 | |
70 } | |
71 | |
72 ## closing | |
73 ##-------- | |
74 | |
75 options(stringsAsFactors = strAsFacL) | |
76 | |
77 rm(list = ls()) |