diff CAMERA_combinexsAnnos.r @ 4:4c4945bce185 draft

"planemo upload commit c1e276cf53b3c54d4702ab26d4f40a525a720998"
author workflow4metabolomics
date Thu, 22 Apr 2021 10:27:58 +0000
parents 139ff66b0b5d
children 2443150161b4
line wrap: on
line diff
--- a/CAMERA_combinexsAnnos.r	Mon Mar 30 10:21:30 2020 -0400
+++ b/CAMERA_combinexsAnnos.r	Thu Apr 22 10:27:58 2021 +0000
@@ -4,18 +4,20 @@
 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="/")) }
+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("CAMERA","multtest","batch")
+pkgs <- c("CAMERA", "multtest", "batch")
 loadAndDisplayPackages(pkgs)
 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 = F, quote = F, sep = "\t")
 
 cat("\n\n");
 
@@ -25,16 +27,16 @@
 
 #image is an .RData file necessary to use xset variable given by previous tools
 load(args$image_pos)
-xaP=xa
+xaP <- xa
 
-diffrepP=NULL
-if (exists("diffrep")) diffrepP=diffrep
+diffrepP <- NULL
+if (exists("diffrep")) diffrepP <- diffrep
 
 load(args$image_neg)
-xaN=xa
+xaN <- xa
 
-diffrepN=NULL
-if (exists("diffrep")) diffrepN=diffrep
+diffrepN <- NULL
+if (exists("diffrep")) diffrepN <- diffrep
 
 
 cat("\n\n")
@@ -44,8 +46,8 @@
 cat("\tARGUMENTS PROCESSING INFO\n")
 
 # Save arguments to generate a report
-if (!exists("listOFargs")) listOFargs=list()
-listOFargs[[format(Sys.time(), "%y%m%d-%H:%M:%S_combinexsAnnos")]] = args
+if (!exists("listOFargs")) listOFargs <- list()
+listOFargs[[format(Sys.time(), "%y%m%d-%H:%M:%S_combinexsAnnos")]] <- args
 
 cat("\n\n")
 
@@ -53,19 +55,19 @@
 # ----- PROCESSING INFO -----
 cat("\tMAIN PROCESSING INFO\n")
 
-cAnnot=combinexsAnnos_function(
-    xaP=xaP,xaN=xaN,
-    diffrepP=diffrepP, diffrepN=diffrepN,
-    pos=args$pos, tol=args$tol,ruleset=args$ruleset, keep_meta=args$keep_meta,
-    convertRTMinute=args$convertRTMinute, numDigitsMZ=args$numDigitsMZ, numDigitsRT=args$numDigitsRT,
-    variableMetadataOutput="variableMetadata.tsv"
+cAnnot <- combinexsAnnos_function(
+    xaP = xaP, xaN = xaN,
+    diffrepP = diffrepP, diffrepN = diffrepN,
+    pos = args$pos, tol = args$tol, ruleset = args$ruleset, keep_meta = args$keep_meta,
+    convertRTMinute = args$convertRTMinute, numDigitsMZ = args$numDigitsMZ, numDigitsRT = args$numDigitsRT,
+    variableMetadataOutput = "variableMetadata.tsv"
 )
 
 # ----- EXPORT -----
 
 #saving R data in .Rdata file to save the variables used in the present tool
-objects2save = c("xa","variableMetadata","diffrep","cAnnot","listOFargs","zipfile","singlefile")
-save(list=objects2save[objects2save %in% ls()], file="combinexsAnnos.RData")
+objects2save <- c("xa", "variableMetadata", "diffrep", "cAnnot", "listOFargs", "zipfile", "singlefile")
+save(list = objects2save[objects2save %in% ls()], file = "combinexsAnnos.RData")
 
 cat("\n\n")