Mercurial > repos > ethevenot > biosigner
comparison biosigner_wrapper.R @ 3:fa80bd02055f draft default tip
planemo upload for repository https://github.com/workflow4metabolomics/biosigner.git commit 23d58cfd97411ad5d272971896914ce99e30b0ab
| author | ethevenot |
|---|---|
| date | Tue, 06 Jun 2017 11:44:00 -0400 |
| parents | b2414be87d4b |
| children |
comparison
equal
deleted
inserted
replaced
| 2:b2414be87d4b | 3:fa80bd02055f |
|---|---|
| 1 #!/usr/bin/env Rscript | 1 #!/usr/bin/Rscript --vanilla --slave --no-site-file |
| 2 | |
| 2 | 3 |
| 3 library(batch) ## parseCommandArgs | 4 library(batch) ## parseCommandArgs |
| 4 | 5 |
| 5 argVc <- unlist(parseCommandArgs(evaluate=FALSE)) | 6 argVc <- unlist(parseCommandArgs(evaluate=FALSE)) |
| 6 | 7 |
| 129 tierMC <- bsnLs@tierMC | 130 tierMC <- bsnLs@tierMC |
| 130 | 131 |
| 131 if(!is.null(tierMC)) { | 132 if(!is.null(tierMC)) { |
| 132 plot(bsnLs, | 133 plot(bsnLs, |
| 133 tierMaxC = tierMaxC, | 134 tierMaxC = tierMaxC, |
| 134 file.pdfC = argVc["figure_tier"], | 135 file.pdfC = "figure_tier.pdf", |
| 135 .sinkC = argVc["information"]) | 136 .sinkC = argVc["information"]) |
| 137 file.rename("figure_tier.pdf", argVc["figure_tier"]) | |
| 136 plot(bsnLs, | 138 plot(bsnLs, |
| 137 tierMaxC = tierMaxC, | 139 tierMaxC = tierMaxC, |
| 138 typeC = "boxplot", | 140 typeC = "boxplot", |
| 139 file.pdfC = argVc["figure_boxplot"], | 141 file.pdfC = "figure_boxplot.pdf", |
| 140 .sinkC = argVc["information"]) | 142 .sinkC = argVc["information"]) |
| 143 file.rename("figure_boxplot.pdf", argVc["figure_boxplot"]) | |
| 141 } else { | 144 } else { |
| 142 pdf(argVc["figure_tier"]) | 145 pdf(argVc["figure_tier"]) |
| 143 plot(1, bty = "n", type = "n", | 146 plot(1, bty = "n", type = "n", |
| 144 xaxt = "n", yaxt = "n", xlab = "", ylab = "") | 147 xaxt = "n", yaxt = "n", xlab = "", ylab = "") |
| 145 text(mean(par("usr")[1:2]), mean(par("usr")[3:4]), | 148 text(mean(par("usr")[1:2]), mean(par("usr")[3:4]), |
| 167 tierVc <- tierFullVc[1:which(tierFullVc == tierMaxC)] | 170 tierVc <- tierFullVc[1:which(tierFullVc == tierMaxC)] |
| 168 | 171 |
| 169 if(sum(tierMC %in% tierVc)) { | 172 if(sum(tierMC %in% tierVc)) { |
| 170 cat("\nSignificant features from '", paste(tierVc, collapse = "', '"), "' tiers:\n", sep = "") | 173 cat("\nSignificant features from '", paste(tierVc, collapse = "', '"), "' tiers:\n", sep = "") |
| 171 print(tierMC[apply(tierMC, 1, function(rowVc) sum(rowVc %in% tierVc) > 0), , | 174 print(tierMC[apply(tierMC, 1, function(rowVc) sum(rowVc %in% tierVc) > 0), , |
| 172 drop = FALSE]) | 175 drop = FALSE]) |
| 173 | |
| 174 cat("\nAccuracy:\n") | 176 cat("\nAccuracy:\n") |
| 175 print(round(getAccuracyMN(bsnLs), 3)) | 177 print(round(getAccuracyMN(bsnLs), 3)) |
| 176 } else | 178 } else |
| 177 cat("\nNo significant variable found for any classifier\n") | 179 cat("\nNo significant variable found for any classifier\n") |
| 178 | 180 |
| 214 ##-------- | 216 ##-------- |
| 215 | 217 |
| 216 cat("\nEnd of '", modNamC, "' Galaxy module call: ", | 218 cat("\nEnd of '", modNamC, "' Galaxy module call: ", |
| 217 as.character(Sys.time()), "\n", sep = "") | 219 as.character(Sys.time()), "\n", sep = "") |
| 218 | 220 |
| 221 cat("\n\n\n============================================================================") | |
| 222 | |
| 223 cat("\nAdditional information about the call:\n") | |
| 224 | |
| 225 cat("\n1) Parameters:\n") | |
| 226 print(cbind(value = argVc)) | |
| 227 | |
| 228 cat("\n2) Session Info:\n") | |
| 229 sessioninfo <- sessionInfo() | |
| 230 cat(sessioninfo$R.version$version.string,"\n") | |
| 231 cat("Main packages:\n") | |
| 232 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n") | |
| 233 cat("Other loaded packages:\n") | |
| 234 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n") | |
| 235 | |
| 236 cat("============================================================================\n") | |
| 237 | |
| 219 sink() | 238 sink() |
| 220 | 239 |
| 221 options(stringsAsFactors = strAsFacL) | 240 options(stringsAsFactors = strAsFacL) |
| 222 | 241 |
| 223 rm(list = ls()) | 242 rm(list = ls()) |
| 224 |
