comparison checkformat_wrapper.R @ 3:80a38d36f946 draft

planemo upload for repository https://github.com/workflow4metabolomics/checkformat.git commit 5cf3f6eb62c1396ade1b068a3dd3cc2e3f827e15
author ethevenot
date Thu, 11 Jan 2018 10:24:56 -0500
parents b6a6b4cc932a
children
comparison
equal deleted inserted replaced
2:b6a6b4cc932a 3:80a38d36f946
42 ##------------------------------ 42 ##------------------------------
43 43
44 44
45 resLs <- readAndCheckF(argVc["dataMatrix_in"], 45 resLs <- readAndCheckF(argVc["dataMatrix_in"],
46 argVc["sampleMetadata_in"], 46 argVc["sampleMetadata_in"],
47 argVc["variableMetadata_in"]) 47 argVc["variableMetadata_in"],
48 chkL <- resLs[["chkL"]] 48 as.logical(argVc["makeNameL"]))
49 49
50 50
51 ##------------------------------ 51 ##------------------------------
52 ## Ending 52 ## Ending
53 ##------------------------------ 53 ##------------------------------
54 54
55 55
56 if(chkL) { 56 ## dataMatrix
57 57
58 cat("\nTable formats are OK; enjoy your analyses!\n", sep="") 58 datMN <- resLs[["datMN"]]
59 datDF <- cbind.data.frame(dataMatrix = colnames(datMN),
60 as.data.frame(t(datMN)))
61 write.table(datDF,
62 file = argVc[["dataMatrix_out"]],
63 quote = FALSE,
64 row.names = FALSE,
65 sep = "\t")
59 66
60 cat("\nEnd of the '", modNamC, "' Galaxy module call: ", 67 ## sampleMetadata
61 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
62 68
63 cat("\n\n\n============================================================================") 69 samDF <- resLs[["samDF"]]
64 cat("\nAdditional information about the call:\n") 70 samDF <- cbind.data.frame(sampleMetadata = rownames(samDF),
65 cat("\n1) Parameters:\n") 71 samDF)
66 print(cbind(value = argVc)) 72 write.table(samDF,
67 73 file = argVc["sampleMetadata_out"],
68 cat("\n2) Session Info:\n") 74 quote = FALSE,
69 sessioninfo <- sessionInfo() 75 row.names = FALSE,
70 cat(sessioninfo$R.version$version.string,"\n") 76 sep = "\t")
71 cat("Main packages:\n")
72 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
73 cat("Other loaded packages:\n")
74 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
75
76 cat("============================================================================\n")
77
78 sink()
79
80 } else {
81
82 cat("\n\n\n============================================================================")
83 cat("\nAdditional information about the call:\n")
84 cat("\n1) Parameters:\n")
85 print(cbind(value = argVc))
86
87 cat("\n2) Session Info:\n")
88 sessioninfo <- sessionInfo()
89 cat(sessioninfo$R.version$version.string,"\n")
90 cat("Main packages:\n")
91 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
92 cat("Other loaded packages:\n")
93 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
94
95 cat("============================================================================\n")
96 77
97 sink() 78 ## variableMetadata
98 stop("Please check the generated 'information' file") 79
80 varDF <- resLs[["varDF"]]
81 varDF <- cbind.data.frame(variableMetadata = rownames(varDF),
82 varDF)
83 write.table(varDF,
84 file = argVc["variableMetadata_out"],
85 quote = FALSE,
86 row.names = FALSE,
87 sep = "\t")
88
89 if(resLs[["chkL"]]) {
90
91 if(resLs[["newL"]]) {
92
93 cat("\nWarning: The sample and/or variable names or orders from the input tables have been modified\n(see the information file for details); please use the new output tables for your analyses.\n")
94
95 } else {
96
97 cat("\nThe input tables have a correct format and can be used for your analyses.\n")
98
99 }
99 100
100 } 101 }
102
103 cat("\nEnd of the '", modNamC, "' Galaxy module call: ",
104 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
105
106 cat("\n\n\n============================================================================")
107 cat("\nAdditional information about the call:\n")
108 cat("\n1) Parameters:\n")
109 print(cbind(value = argVc))
110
111 cat("\n2) Session Info:\n")
112 sessioninfo <- sessionInfo()
113 cat(sessioninfo$R.version$version.string,"\n")
114 cat("Main packages:\n")
115 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
116 cat("Other loaded packages:\n")
117 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
118
119 cat("============================================================================\n")
120
121 sink()
122
123 if(!resLs[["chkL"]]) {
124 stop("Please check the generated 'information' file")
125 }
126
101 127
102 ## closing 128 ## closing
103 ##-------- 129 ##--------
104 130
105 options(stringsAsFactors = strAsFacL) 131 options(stringsAsFactors = strAsFacL)