comparison profia_wrapper.R @ 2:3f8ae071bdda draft

planemo upload for repository https://github.com/workflow4metabolomics/profia.git commit 19ed25c048232776369a392ddb8c1860471acd29
author ethevenot
date Mon, 22 Jan 2018 11:32:41 -0500
parents 4753e64cf694
children
comparison
equal deleted inserted replaced
1:4753e64cf694 2:3f8ae071bdda
93 93
94 stpI <- 1 94 stpI <- 1
95 95
96 cat("\n", stpI, ") Peak detection step ('proFIAset'):\n", sep = "") 96 cat("\n", stpI, ") Peak detection step ('proFIAset'):\n", sep = "")
97 97
98 fiaset <- proFIAset(directory, 98 if("sizeMinN" %in% names(argVc) && argVc["sizeMinN"] != "none") {
99 ppm = as.numeric(argVc["ppmN"]), 99 if("scanMaxI" %in% names(argVc) && argVc["scanMaxI"] != "none") {
100 parallel = TRUE) 100 fiaset <- proFIAset(directory,
101 ppm = as.numeric(argVc["ppmN"]),
102 dmz = as.numeric(argVc["dmzN"]),
103 bandCoverage = as.numeric(ifelse("bandCoverageN" %in% names(argVc), argVc["bandCoverageN"], "0.3")),
104 sizeMin = as.numeric(argVc["sizeMinN"]),
105 scanmin = as.numeric(ifelse("scanMinI" %in% names(argVc), argVc["scanMinI"], "1")),
106 scanmax = as.numeric(argVc["scanMaxI"]),
107 parallel = TRUE)
108 } else {
109 fiaset <- proFIAset(directory,
110 ppm = as.numeric(argVc["ppmN"]),
111 dmz = as.numeric(argVc["dmzN"]),
112 bandCoverage = as.numeric(ifelse("bandCoverageN" %in% names(argVc), argVc["bandCoverageN"], "0.3")),
113 sizeMin = as.numeric(argVc["sizeMinN"]),
114 scanmin = as.numeric(ifelse("scanMinI" %in% names(argVc), argVc["scanMinI"], "1")),
115 parallel = TRUE)
116 }
117 } else {
118 if("scanMaxI" %in% names(argVc) && argVc["scanMaxI"] != "none") {
119 fiaset <- proFIAset(directory,
120 ppm = as.numeric(argVc["ppmN"]),
121 dmz = as.numeric(argVc["dmzN"]),
122 bandCoverage = as.numeric(ifelse("bandCoverageN" %in% names(argVc), argVc["bandCoverageN"], "0.3")),
123 scanmin = as.numeric(ifelse("scanMinI" %in% names(argVc), argVc["scanMinI"], "1")),
124 scanmax = as.numeric(argVc["scanMaxI"]),
125 parallel = TRUE)
126 } else {
127 fiaset <- proFIAset(directory,
128 ppm = as.numeric(argVc["ppmN"]),
129 dmz = as.numeric(argVc["dmzN"]),
130 bandCoverage = as.numeric(ifelse("bandCoverageN" %in% names(argVc), argVc["bandCoverageN"], "0.3")),
131 scanmin = as.numeric(ifelse("scanMinI" %in% names(argVc), argVc["scanMinI"], "1")),
132 parallel = TRUE)
133 }
134 }
101 135
102 stpI <- stpI + 1 136 stpI <- stpI + 1
103 137
104 cat("\n", stpI, ") Peak alignment ('group.FIA'):\n", sep = "") 138 cat("\n", stpI, ") Peak alignment ('group.FIA'):\n", sep = "")
105 139
106 fiaset <- group.FIA(fiaset, 140 fiaset <- group.FIA(fiaset,
107 ppmGroup = as.numeric(argVc["ppmGroupN"]), 141 ppmGroup = as.numeric(argVc["ppmGroupN"]),
142 dmz = as.numeric(argVc["dmzGroupN"]),
108 fracGroup = as.numeric(argVc["fracGroupN"])) 143 fracGroup = as.numeric(argVc["fracGroupN"]))
109 144
110 stpI <- stpI + 1 145 stpI <- stpI + 1
111 146
112 cat("\n", stpI, ") Creating the peak table ('makeDataMatrix'):\n", sep = "") 147 cat("\n", stpI, ") Creating the peak table ('makeDataMatrix'):\n", sep = "")
114 fiaset <- makeDataMatrix(fiaset, 149 fiaset <- makeDataMatrix(fiaset,
115 maxo = FALSE) 150 maxo = FALSE)
116 151
117 stpI <- stpI + 1 152 stpI <- stpI + 1
118 153
119 kI <- as.integer(argVc["kI"]) 154
120 155 if(argVc["imputeC"] == "randomForest") {
121 if(kI > 0) { 156
122 157 cat("\n", stpI, ") Imputing missing values ('impute.randomForest'):\n", sep = "")
123 cat("\n", stpI, ") Imputing missing values ('imputeMissingValues.WKNN_TN'):\n", sep = "") 158
124 159 set.seed(123)
125 fiaset <- imputeMissingValues.WKNN_TN(fiaset, 160
126 k = kI) 161 fiaset <- impute.randomForest(fiaset,
162 parallel = FALSE)
163
164 set.seed(NULL)
127 165
128 stpI <- stpI + 1 166 stpI <- stpI + 1
129 } 167 }
168 ###TODO Fix the error message to set 'parallel' to TRUE: You must register a 'foreach' parallel backend to run 'missForest' in parallel. Set 'parallelize' to 'no' to compute serially.
169 ###TODO add the impute.KNN_TN method
170
130 171
131 options(warn = optWrnN) 172 options(warn = optWrnN)
132 173
133 174
134 ##------------------------------ 175 ##------------------------------
203 ##-------- 244 ##--------
204 245
205 cat("\nEnd of '", modNamC, "' Galaxy module call: ", 246 cat("\nEnd of '", modNamC, "' Galaxy module call: ",
206 as.character(Sys.time()), "\n", sep = "") 247 as.character(Sys.time()), "\n", sep = "")
207 248
249 cat("\n\n\n============================================================================")
250 cat("\nAdditional information about the call:\n")
251 cat("\n1) Parameters:\n")
252 print(cbind(value = argVc))
253
254 cat("\n2) Session Info:\n")
255 sessioninfo <- sessionInfo()
256 cat(sessioninfo$R.version$version.string,"\n")
257 cat("Main packages:\n")
258 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
259 cat("Other loaded packages:\n")
260 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
261
262 cat("============================================================================\n")
263
208 sink() 264 sink()
209 265
210 rm(list = ls()) 266 rm(list = ls())