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