Mercurial > repos > ethevenot > transformation
view transformation_wrapper.R @ 1:d9e05021553c draft
planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit c4b65942d74d5bdfd46e748c0040a8b5ebe4fd1d
author | ethevenot |
---|---|
date | Sat, 06 Aug 2016 12:02:52 -0400 |
parents | eacea1349a7c |
children | 0ccfc3e15710 |
line wrap: on
line source
#!/usr/bin/env Rscript library(batch) ## parseCommandArgs source_local <- function(fname){ argv <- commandArgs(trailingOnly = FALSE) base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) source(paste(base_dir, fname, sep="/")) } source_local("transformation_script.R") argVc <- unlist(parseCommandArgs(evaluate=FALSE)) ##------------------------------ ## Initializing ##------------------------------ ## options ##-------- strAsFacL <- options()[["stringsAsFactors"]] options(stringsAsFactors=FALSE) ## constants ##---------- modNamC <- "Transformation" ## module name ## log file ##--------- sink(argVc[["information"]]) cat("\nStart of the '", modNamC, "' module: ", format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="") ## loading ##-------- datMN <- t(as.matrix(read.table(argVc[["dataMatrix_in"]], check.names = FALSE, header = TRUE, row.names = 1, sep = "\t"))) metC <- argVc[["method"]] ##------------------------------ ## Computation ##------------------------------ datMN <- transformF(datMN = datMN, ## dataMatrix metC = metC) ## transformation method ##------------------------------ ## Ending ##------------------------------ ## saving ##------- datDF <- cbind.data.frame(dataMatrix = colnames(datMN), as.data.frame(t(datMN))) write.table(datDF, file = argVc[["dataMatrix_out"]], quote = FALSE, row.names = FALSE, sep = "\t") ## ending ##------- cat("\nEnd of the '", modNamC, "' Galaxy module call: ", format(Sys.time(), "%a %d %b %Y %X"), "\n", sep = "") sink() options(stringsAsFactors = strAsFacL) rm(list = ls())