Mercurial > repos > lecorguille > camera_annotate
diff CAMERA_annotateDiffreport.r @ 23:abf1775ac14d draft
"planemo upload commit c1e276cf53b3c54d4702ab26d4f40a525a720998"
author | workflow4metabolomics |
---|---|
date | Thu, 22 Apr 2021 10:27:38 +0000 |
parents | 01459b73daf9 |
children | 4b9ab71be05e |
line wrap: on
line diff
--- a/CAMERA_annotateDiffreport.r Mon Mar 30 09:27:57 2020 -0400 +++ b/CAMERA_annotateDiffreport.r Thu Apr 22 10:27:38 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"); @@ -24,7 +26,7 @@ cat("\tINFILE PROCESSING INFO\n") #image is an .RData file necessary to use xset variable given by previous tools -load(args$image); args$image=NULL +load(args$image); args$image <- NULL cat("\n\n") @@ -33,21 +35,21 @@ 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_annotatediff")]] = args +if (!exists("listOFargs")) listOFargs <- list() +listOFargs[[format(Sys.time(), "%y%m%d-%H:%M:%S_annotatediff")]] <- args # We unzip automatically the chromatograms from the zip files. -if (!exists("zipfile")) zipfile=NULL -if (!exists("singlefile")) singlefile=NULL -rawFilePath = getRawfilePathFromArguments(singlefile, zipfile, args) -zipfile = rawFilePath$zipfile -singlefile = rawFilePath$singlefile -args = rawFilePath$args -directory = retrieveRawfileInTheWorkingDirectory(singlefile, zipfile) +if (!exists("zipfile")) zipfile <- NULL +if (!exists("singlefile")) singlefile <- NULL +rawFilePath <- getRawfilePathFromArguments(singlefile, zipfile, args) +zipfile <- rawFilePath$zipfile +singlefile <- rawFilePath$singlefile +args <- rawFilePath$args +directory <- retrieveRawfileInTheWorkingDir(singlefile, zipfile) # Because so far CAMERA isn't compatible with the new XCMSnExp object -if (exists("xdata")){ +if (exists("xdata")) { xset <- getxcmsSetObject(xdata) } @@ -57,10 +59,10 @@ # ----- PROCESSING INFO ----- cat("\tMAIN PROCESSING INFO\n") -results_list=annotatediff(xset=xset,args=args,variableMetadataOutput="variableMetadata.tsv") -xa=results_list$xa -diffrep=results_list$diffrep -variableMetadata=results_list$variableMetadata +results_list <- annotatediff(xset = xset, args = args, variableMetadataOutput = "variableMetadata.tsv") +xa <- results_list$xa +diffrep <- results_list$diffrep +variableMetadata <- results_list$variableMetadata cat("\n\n") @@ -71,8 +73,8 @@ cat("\n\n") #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="annotatediff.RData") +objects2save <- c("xa", "variableMetadata", "diffrep", "cAnnot", "listOFargs", "zipfile", "singlefile") +save(list = objects2save[objects2save %in% ls()], file = "annotatediff.RData") cat("\n\n")