diff ipo4xcmsSet.r @ 2:8e5f667359cb draft default tip

planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
author workflow4metabolomics
date Mon, 11 Sep 2023 22:37:32 +0000
parents ae8de756dfcf
children
line wrap: on
line diff
--- a/ipo4xcmsSet.r	Mon Dec 16 05:26:42 2019 -0500
+++ b/ipo4xcmsSet.r	Mon Sep 11 22:37:32 2023 +0000
@@ -1,33 +1,35 @@
 #!/usr/bin/env Rscript
-#Authors Gildas Le Corguille and Yann Guitton
+# Authors Gildas Le Corguille and Yann Guitton
 
 
 # ----- PACKAGE -----
 cat("\tSESSION INFO\n")
 
-#Import the different functions
-source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) }
+# Import the different functions
+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("lib.r")
 
-pkgs <- c("IPO","batch")
+pkgs <- c("IPO", "batch")
 loadAndDisplayPackages(pkgs)
-cat("\n\n");
-
-
+cat("\n\n")
 # ----- ARGUMENTS -----
 cat("\tARGUMENTS INFO\n")
-args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
-write.table(as.matrix(args), col.names=F, quote=F, sep='\t')
+args <- parseCommandArgs(evaluate = FALSE) # interpretation of arguments given in command line as an R list of objects
+write.table(as.matrix(args), col.names = FALSE, quote = FALSE, sep = "\t")
 
-cat("\n\n");
-
+cat("\n\n")
 # ----- PROCESSING INFILE -----
 cat("\tARGUMENTS PROCESSING INFO\n")
-options(bitmapType='cairo')
+options(bitmapType = "cairo")
 
-samplebyclass = 2
-if (!is.null(args$samplebyclass)){
-  samplebyclass = args$samplebyclass; args$samplebyclass=NULL
+samplebyclass <- 2
+if (!is.null(args$samplebyclass)) {
+  samplebyclass <- args$samplebyclass
+  args$samplebyclass <- NULL
 }
 
 # ----- INFILE PROCESSING -----
@@ -37,7 +39,7 @@
 if (!exists("singlefile")) singlefile <- NULL
 rawFilePath <- getRawfilePathFromArguments(singlefile, NULL, args)
 singlefile <- rawFilePath$singlefile
-directory <- retrieveRawfileInTheWorkingDirectory(singlefile, NULL)
+directory <- retrieveRawfileInWD(singlefile, NULL)
 
 # Check some character issues
 checkXmlStructure(directory)
@@ -51,7 +53,7 @@
 cat("\tMAIN PROCESSING INFO\n")
 
 
-xset = ipo4xcmsSet(directory, "IPO_parameters4xcmsSet.tsv", args, samplebyclass)
+xset <- ipo4xcmsSet(directory, "IPO_parameters4xcmsSet.tsv", args, samplebyclass)
 
 
 
@@ -62,15 +64,14 @@
 
 cat("\tXSET OBJECT INFO\n")
 print(xset)
-#delete the parameters to avoid the passage to the next tool in .RData image
+# delete the parameters to avoid the passage to the next tool in .RData image
 
 
-#saving R data in .Rdata file to save the variables used in the present tool
-objects2save = c("xset", "singlefile")
-save(list=objects2save[objects2save %in% ls()], file="ipo4xcmsSet.RData")
+# saving R data in .Rdata file to save the variables used in the present tool
+objects2save <- c("xset", "singlefile")
+save(list = objects2save[objects2save %in% ls()], file = "ipo4xcmsSet.RData")
 
 cat("\n\n")
 
 
 cat("\tDONE\n")
-