Mercurial > repos > ethevenot > multivariate
diff multivariate_wrapper.R @ 4:5526f8258e8a draft default tip
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
author | ethevenot |
---|---|
date | Wed, 28 Feb 2018 09:59:25 -0500 |
parents | e91de3b04320 |
children |
line wrap: on
line diff
--- a/multivariate_wrapper.R Sat Oct 22 03:02:47 2016 -0400 +++ b/multivariate_wrapper.R Wed Feb 28 09:59:25 2018 -0500 @@ -2,6 +2,41 @@ library(batch) ## parseCommandArgs +# Constants +argv <- commandArgs(trailingOnly = FALSE) +script.path <- sub("--file=","",argv[grep("--file=",argv)]) +prog.name <- basename(script.path) + +# Print help +if (length(grep('-h', argv)) >0) { + cat("Usage:", prog.name, + "dataMatrix_in myDataMatrix.tsv", + "sampleMetadata_in mySampleData.tsv", + "variableMetadata_in myVariableMetadata.tsv", + "respC ...", + "predI ...", + "orthoI ...", + "testL ...", + "typeC ...", + "parAsColC ...", + "parCexN ...", + "parPc1I ...", + "parPc2I ...", + "parMahalC ...", + "parLabVc ...", + "algoC ...", + "crossvalI ...", + "log10L ...", + "permI ...", + "scaleC ...", + "sampleMetadata_out mySampleMetadata_out.tsv", + "variableMetadata_out myVariableMetadata_out.tsv", + "figure figure.pdf", + "information information.txt", + "\n") + quit(status = 0) +} + ######## # MAIN # ######## @@ -45,7 +80,7 @@ if(!tesL) { - sink(NULL) + sink() stpTxtC <- ifelse(is.na(txtC), paste0(tesC, " is FALSE"), txtC) @@ -74,20 +109,23 @@ check.names = FALSE, header = TRUE, row.names = 1, - sep = "\t"))) + sep = "\t", + comment.char = ""))) samDF <- read.table(argVc["sampleMetadata_in"], check.names = FALSE, header = TRUE, row.names = 1, - sep = "\t") + sep = "\t", + comment.char = "") flgF("identical(rownames(xMN), rownames(samDF))", txtC = "Sample names (or number) in the data matrix (first row) and sample metadata (first column) are not identical; use the 'Check Format' module in the 'Quality Control' section") varDF <- read.table(argVc["variableMetadata_in"], check.names = FALSE, header = TRUE, row.names = 1, - sep = "\t") + sep = "\t", + comment.char = "") flgF("identical(colnames(xMN), rownames(varDF))", txtC = "Variable names (or number) in the data matrix (first column) and sample metadata (first column) are not identical; use the 'Check Format' module in the 'Quality Control' section") flgF("argVc['respC'] == 'none' || (argVc['respC'] %in% colnames(samDF))", @@ -427,8 +465,8 @@ sep = "\t") # Output ropLs -if ( ! is.null(argVc['ropls_out'])) - save(ropLs, file = argVc['ropls_out']) +if (!is.null(argVc['ropls_out']) && !is.na(argVc['ropls_out'])) + save(ropLs, file = argVc['ropls_out']) ## Closing ##-------- @@ -436,6 +474,21 @@ cat("\nEnd of '", modNamC, "' Galaxy module call: ", as.character(Sys.time()), "\n", sep = "") +cat("\n\n\n============================================================================") +cat("\nAdditional information about the call:\n") +cat("\n1) Parameters:\n") +print(cbind(value = argVc)) + +cat("\n2) Session Info:\n") +sessioninfo <- sessionInfo() +cat(sessioninfo$R.version$version.string,"\n") +cat("Main packages:\n") +for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n") +cat("Other loaded packages:\n") +for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n") + +cat("============================================================================\n") + sink() options(stringsAsFactors = strAsFacL)