changeset 4:4c4945bce185 draft

"planemo upload commit c1e276cf53b3c54d4702ab26d4f40a525a720998"
author workflow4metabolomics
date Thu, 22 Apr 2021 10:27:58 +0000
parents 3bf04fc404d9
children 617cf0705775
files CAMERA_combinexsAnnos.r README.rst abims_CAMERA_combinexsAnnos.xml lib.r macros.xml repository_dependencies.xml
diffstat 6 files changed, 202 insertions(+), 186 deletions(-) [+]
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")
 
--- a/README.rst	Mon Mar 30 10:21:30 2020 -0400
+++ b/README.rst	Thu Apr 22 10:27:58 2021 +0000
@@ -2,6 +2,10 @@
 Changelog/News
 --------------
 
+**Version 2.2.6+camera1.46.0 - 12/04/2021**
+
+- UPGRADE: upgrade the CAMERA version from 1.42.0 to 1.46.0 (see CAMERA News_)
+
 **Version 2.2.6+camera1.42.0** - 13/02/2020
 
 UPGRADE: upgrade the CAMERA version from 1.38.1 to 1.42.0 (see CAMERA News_)
--- a/abims_CAMERA_combinexsAnnos.xml	Mon Mar 30 10:21:30 2020 -0400
+++ b/abims_CAMERA_combinexsAnnos.xml	Thu Apr 22 10:27:58 2021 +0000
@@ -211,6 +211,8 @@
 
 .. _News: https://bioconductor.org/packages/release/bioc/news/CAMERA/NEWS
 
+@HELP_CAMERA_NEWVERSION_1460@
+
 @HELP_CAMERA_NEWVERSION_1420@
 
 **Version 2.2.5 - 09/04/2019**
--- a/lib.r	Mon Mar 30 10:21:30 2020 -0400
+++ b/lib.r	Thu Apr 22 10:27:58 2021 +0000
@@ -5,8 +5,8 @@
 parseCommandArgs <- function(...) {
     args <- batch::parseCommandArgs(...)
     for (key in names(args)) {
-        if (args[key] %in% c("TRUE","FALSE"))
-            args[key] = as.logical(args[key])
+        if (args[key] %in% c("TRUE", "FALSE"))
+            args[key] <- as.logical(args[key])
     }
     return(args)
 }
@@ -16,14 +16,20 @@
 # - load the packages
 # - display the sessionInfo
 loadAndDisplayPackages <- function(pkgs) {
-    for(pkg in pkgs) suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))
+    for (pkg in pkgs) suppressPackageStartupMessages(stopifnot(library(pkg, quietly = TRUE, logical.return = TRUE, character.only = TRUE)))
 
-    sessioninfo = sessionInfo()
-    cat(sessioninfo$R.version$version.string,"\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")
+    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")
+    for (pkg in names(sessioninfo$loadedOnly)) {
+      cat(paste(pkg, packageVersion(pkg)), "\t")
+    }
+    cat("\n")
 }
 
 # This function retrieve a xset like object
@@ -31,18 +37,18 @@
 getxcmsSetObject <- function(xobject) {
     # XCMS 1.x
     if (class(xobject) == "xcmsSet")
-        return (xobject)
+        return(xobject)
     # XCMS 3.x
     if (class(xobject) == "XCMSnExp") {
         # Get the legacy xcmsSet object
-        suppressWarnings(xset <- as(xobject, 'xcmsSet'))
+        suppressWarnings(xset <- as(xobject, "xcmsSet"))
         if (is.null(xset@phenoData$sample_group))
-            sampclass(xset) = "."
+            sampclass(xset) <- "."
         else
             sampclass(xset) <- xset@phenoData$sample_group
         if (!is.null(xset@phenoData$sample_name))
-            rownames(xset@phenoData) = xset@phenoData$sample_name
-        return (xset)
+            rownames(xset@phenoData) <- xset@phenoData$sample_name
+        return(xset)
     }
 }
 
@@ -51,138 +57,139 @@
 diffreport_png2pdf <- function(filebase) {
     dir.create("pdf")
 
-    pdfEicOutput = paste0("pdf/",filebase,"-eic_pdf.pdf")
-    pdfBoxOutput = paste0("pdf/",filebase,"-box_pdf.pdf")
+    pdfEicOutput <- paste0("pdf/", filebase, "-eic_pdf.pdf")
+    pdfBoxOutput <- paste0("pdf/", filebase, "-box_pdf.pdf")
 
-    system(paste0("gm convert ",filebase,"_eic/*.png ",pdfEicOutput))
-    system(paste0("gm convert ",filebase,"_box/*.png ",pdfBoxOutput))
+    system(paste0("gm convert ", filebase, "_eic/*.png ", pdfEicOutput))
+    system(paste0("gm convert ", filebase, "_box/*.png ", pdfBoxOutput))
 
 }
 
 #@author G. Le Corguille
 #The function create a zip archive from the different png generated by diffreport
 diffreport_png2zip <- function() {
-    zip("eic.zip", dir(pattern="_eic"), zip=Sys.which("zip"))
-    zip("box.zip", dir(pattern="_box"), zip=Sys.which("zip"))
+    zip("eic.zip", dir(pattern = "_eic"), zip = Sys.which("zip"))
+    zip("box.zip", dir(pattern = "_box"), zip = Sys.which("zip"))
 }
 
 #The function create a zip archive from the different tabular generated by diffreport
 diffreport_tabular2zip <- function() {
-    zip("tabular.zip", dir(pattern="tabular/*"), zip=Sys.which("zip"))
+    zip("tabular.zip", dir(pattern = "tabular/*"), zip = Sys.which("zip"))
 }
 
 #@author G. Le Corguille
 #This function convert if it is required the Retention Time in minutes
 RTSecondToMinute <- function(variableMetadata, convertRTMinute) {
-    if (convertRTMinute){
+    if (convertRTMinute) {
         #converting the retention times (seconds) into minutes
         print("converting the retention times into minutes in the variableMetadata")
-        variableMetadata[,"rt"]=variableMetadata[,"rt"]/60
-        variableMetadata[,"rtmin"]=variableMetadata[,"rtmin"]/60
-        variableMetadata[,"rtmax"]=variableMetadata[,"rtmax"]/60
+        variableMetadata[, "rt"] <- variableMetadata[, "rt"] / 60
+        variableMetadata[, "rtmin"] <- variableMetadata[, "rtmin"] / 60
+        variableMetadata[, "rtmax"] <- variableMetadata[, "rtmax"] / 60
     }
-    return (variableMetadata)
+    return(variableMetadata)
 }
 
 #@author G. Le Corguille
 #This function format ions identifiers
-formatIonIdentifiers <- function(variableMetadata, numDigitsRT=0, numDigitsMZ=0) {
-    splitDeco = strsplit(as.character(variableMetadata$name),"_")
-    idsDeco = sapply(splitDeco, function(x) { deco=unlist(x)[2]; if (is.na(deco)) return ("") else return(paste0("_",deco)) })
-    namecustom = make.unique(paste0("M",round(variableMetadata[,"mz"],numDigitsMZ),"T",round(variableMetadata[,"rt"],numDigitsRT),idsDeco))
-    variableMetadata=cbind(name=variableMetadata$name, namecustom=namecustom, variableMetadata[,!(colnames(variableMetadata) %in% c("name"))])
+formatIonIdentifiers <- function(variableMetadata, numDigitsRT = 0, numDigitsMZ = 0) {
+    splitDeco <- strsplit(as.character(variableMetadata$name), "_")
+    idsDeco <- sapply(splitDeco, function(x) {
+      deco <- unlist(x)[2]; if (is.na(deco)) return("") else return(paste0("_", deco))
+    })
+    namecustom <- make.unique(paste0("M", round(variableMetadata[, "mz"], numDigitsMZ), "T", round(variableMetadata[, "rt"], numDigitsRT), idsDeco))
+    variableMetadata <- cbind(name = variableMetadata$name, namecustom = namecustom, variableMetadata[, !(colnames(variableMetadata) %in% c("name"))])
     return(variableMetadata)
 }
 
 #The function annotateDiffreport without the corr function which bugs
-annotatediff <- function(xset=xset, args=args, variableMetadataOutput="variableMetadata.tsv") {
+annotatediff <- function(xset = xset, args = args, variableMetadataOutput = "variableMetadata.tsv") {
     # Resolve the bug with x11, with the function png
-    options(bitmapType='cairo')
+    options(bitmapType = "cairo")
 
     #Check if the fillpeaks step has been done previously, if it hasn't, there is an error message and the execution is stopped.
-    res=try(is.null(xset@filled))
+    res <- try(is.null(xset@filled))
 
     # ------ annot -------
-    args$calcCiS=as.logical(args$calcCiS)
-    args$calcIso=as.logical(args$calcIso)
-    args$calcCaS=as.logical(args$calcCaS)
+    args$calcCiS <- as.logical(args$calcCiS)
+    args$calcIso <- as.logical(args$calcIso)
+    args$calcCaS <- as.logical(args$calcCaS)
 
     # common parameters
-    args4annotate = list(object=xset,
-        nSlaves=args$nSlaves,sigma=args$sigma,perfwhm=args$perfwhm,
-        maxcharge=args$maxcharge,maxiso=args$maxiso,minfrac=args$minfrac,
-        ppm=args$ppm,mzabs=args$mzabs,quick=args$quick,
-        polarity=args$polarity,max_peaks=args$max_peaks,intval=args$intval)
+    args4annotate <- list(object = xset,
+        nSlaves = args$nSlaves, sigma = args$sigma, perfwhm = args$perfwhm,
+        maxcharge = args$maxcharge, maxiso = args$maxiso, minfrac = args$minfrac,
+        ppm = args$ppm, mzabs = args$mzabs, quick = args$quick,
+        polarity = args$polarity, max_peaks = args$max_peaks, intval = args$intval)
 
-    # quick == FALSE
-    if(args$quick==FALSE) {
-        args4annotate = append(args4annotate,
-            list(graphMethod=args$graphMethod,cor_eic_th=args$cor_eic_th,pval=args$pval,
-            calcCiS=args$calcCiS,calcIso=args$calcIso,calcCaS=args$calcCaS))
+    if (args$quick == FALSE) {
+        args4annotate <- append(args4annotate,
+            list(graphMethod = args$graphMethod, cor_eic_th = args$cor_eic_th, pval = args$pval,
+            calcCiS = args$calcCiS, calcIso = args$calcIso, calcCaS = args$calcCaS))
         # no ruleset
         if (!is.null(args$multiplier)) {
-            args4annotate = append(args4annotate,
-                list(multiplier=args$multiplier))
+            args4annotate <- append(args4annotate,
+                list(multiplier = args$multiplier))
         }
         # ruleset
         else {
-            rulset=read.table(args$rules, h=T, sep=";")
-            if (ncol(rulset) < 4) rulset=read.table(args$rules, h=T, sep="\t")
-            if (ncol(rulset) < 4) rulset=read.table(args$rules, h=T, sep=",")
+            rulset <- read.table(args$rules, h = T, sep = ";")
+            if (ncol(rulset) < 4) rulset <- read.table(args$rules, h = T, sep = "\t")
+            if (ncol(rulset) < 4) rulset <- read.table(args$rules, h = T, sep = ",")
             if (ncol(rulset) < 4) {
-                error_message="Your ruleset file seems not well formatted. The column separators accepted are ; , and tabulation"
+                error_message <- "Your ruleset file seems not well formatted. The column separators accepted are ; , and tabulation"
                 print(error_message)
                 stop(error_message)
             }
 
-            args4annotate = append(args4annotate,
-                list(rules=rulset))
+            args4annotate <- append(args4annotate,
+                list(rules = rulset))
         }
     }
 
 
     # launch annotate
-    xa = do.call("annotate", args4annotate)
-    peakList=getPeaklist(xa,intval=args$intval)
-    peakList=cbind(groupnames(xa@xcmsSet),peakList); colnames(peakList)[1] = c("name");
+    xa <- do.call("annotate", args4annotate)
+    peakList <- getPeaklist(xa, intval = args$intval)
+    peakList <- cbind(groupnames(xa@xcmsSet), peakList); colnames(peakList)[1] <- c("name");
 
     # --- Multi condition : diffreport ---
-    diffrepOri=NULL
-    if (!is.null(args$runDiffreport) & nlevels(sampclass(xset))>=2) {
+    diffrepOri <- NULL
+    if (!is.null(args$runDiffreport) & nlevels(sampclass(xset)) >= 2) {
         #Check if the fillpeaks step has been done previously, if it hasn't, there is an error message and the execution is stopped.
-        res=try(is.null(xset@filled))
-        classes=levels(sampclass(xset))
-        x=1:(length(classes)-1)
-        for (i in seq(along=x) ) {
-            y=1:(length(classes))
-            for (n in seq(along=y)){
-                if(i+n <= length(classes)){
-                    filebase=paste(classes[i],class2=classes[i+n],sep="-vs-")
+        res <- try(is.null(xset@filled))
+        classes <- levels(sampclass(xset))
+        x <- 1:(length(classes) - 1)
+        for (i in seq(along = x)) {
+            y <- 1:(length(classes))
+            for (n in seq(along = y)) {
+                if (i + n <= length(classes)) {
+                    filebase <- paste(classes[i], class2 = classes[i + n], sep = "-vs-")
 
-                    diffrep=diffreport(
-                        object=xset,class1=classes[i],class2=classes[i+n],
-                        filebase=filebase,eicmax=args$eicmax,eicwidth=args$eicwidth,
-                        sortpval=TRUE,value=args$value,h=args$h,w=args$w,mzdec=args$mzdec,missing=0)
+                    diffrep <- diffreport(
+                        object = xset, class1 = classes[i], class2 = classes[i + n],
+                        filebase = filebase, eicmax = args$eicmax, eicwidth = args$eicwidth,
+                        sortpval = TRUE, value = args$value, h = args$h, w = args$w, mzdec = args$mzdec, missing = 0)
 
-                    diffrepOri = diffrep
+                    diffrepOri <- diffrep
 
                     # renamming of the column rtmed to rt to fit with camera peaklist function output
-                    colnames(diffrep)[colnames(diffrep)=="rtmed"] <- "rt"
-                    colnames(diffrep)[colnames(diffrep)=="mzmed"] <- "mz"
+                    colnames(diffrep)[colnames(diffrep) == "rtmed"] <- "rt"
+                    colnames(diffrep)[colnames(diffrep) == "mzmed"] <- "mz"
 
                     # combines results and reorder columns
-                    diffrep = merge(peakList, diffrep[,c("name","fold","tstat","pvalue")], by.x="name", by.y="name", sort=F)
-                    diffrep = cbind(diffrep[,!(colnames(diffrep) %in% c(sampnames(xa@xcmsSet)))],diffrep[,(colnames(diffrep) %in% c(sampnames(xa@xcmsSet)))])
+                    diffrep <- merge(peakList, diffrep[, c("name", "fold", "tstat", "pvalue")], by.x = "name", by.y = "name", sort = F)
+                    diffrep <- cbind(diffrep[, !(colnames(diffrep) %in% c(sampnames(xa@xcmsSet)))], diffrep[, (colnames(diffrep) %in% c(sampnames(xa@xcmsSet)))])
 
-                    diffrep = RTSecondToMinute(diffrep, args$convertRTMinute)
-                    diffrep = formatIonIdentifiers(diffrep, numDigitsRT=args$numDigitsRT, numDigitsMZ=args$numDigitsMZ)
+                    diffrep <- RTSecondToMinute(diffrep, args$convertRTMinute)
+                    diffrep <- formatIonIdentifiers(diffrep, numDigitsRT = args$numDigitsRT, numDigitsMZ = args$numDigitsMZ)
 
-                    if(args$sortpval){
-                        diffrep=diffrep[order(diffrep$pvalue), ]
+                    if (args$sortpval) {
+                        diffrep <- diffrep[order(diffrep$pvalue), ]
                     }
 
                     dir.create("tabular", showWarnings = FALSE)
-                    write.table(diffrep, sep="\t", quote=FALSE, row.names=FALSE, file=paste("tabular/",filebase,"_tsv.tabular",sep=""))
+                    write.table(diffrep, sep = "\t", quote = FALSE, row.names = FALSE, file = paste("tabular/", filebase, "_tsv.tabular", sep = ""))
 
                     if (args$eicmax != 0) {
                         if (args$png2 == "pdf")
@@ -198,28 +205,28 @@
     }
 
     # --- variableMetadata ---
-    variableMetadata=peakList[,!(make.names(colnames(peakList)) %in% c(make.names(sampnames(xa@xcmsSet))))]
-    variableMetadata = RTSecondToMinute(variableMetadata, args$convertRTMinute)
-    variableMetadata = formatIonIdentifiers(variableMetadata, numDigitsRT=args$numDigitsRT, numDigitsMZ=args$numDigitsMZ)
+    variableMetadata <- peakList[, !(make.names(colnames(peakList)) %in% c(make.names(sampnames(xa@xcmsSet))))]
+    variableMetadata <- RTSecondToMinute(variableMetadata, args$convertRTMinute)
+    variableMetadata <- formatIonIdentifiers(variableMetadata, numDigitsRT = args$numDigitsRT, numDigitsMZ = args$numDigitsMZ)
     # if we have 2 conditions, we keep stat of diffrep
-    if (!is.null(args$runDiffreport) & nlevels(sampclass(xset))==2) {
-        variableMetadata = merge(variableMetadata, diffrep[,c("name","fold","tstat","pvalue")],by.x="name", by.y="name", sort=F)
-        if(exists("args[[\"sortpval\"]]")){
-            variableMetadata=variableMetadata[order(variableMetadata$pvalue), ]
+    if (!is.null(args$runDiffreport) & nlevels(sampclass(xset)) == 2) {
+        variableMetadata <- merge(variableMetadata, diffrep[, c("name", "fold", "tstat", "pvalue")], by.x = "name", by.y = "name", sort = F)
+        if (exists("args[[\"sortpval\"]]")) {
+            variableMetadata <- variableMetadata[order(variableMetadata$pvalue), ]
         }
     }
 
-    variableMetadataOri=variableMetadata
-    write.table(variableMetadata, sep="\t", quote=FALSE, row.names=FALSE, file=variableMetadataOutput)
+    variableMetadataOri <- variableMetadata
+    write.table(variableMetadata, sep = "\t", quote = FALSE, row.names = FALSE, file = variableMetadataOutput)
 
-    return(list("xa"=xa,"diffrep"=diffrepOri,"variableMetadata"=variableMetadataOri));
+    return(list("xa" = xa, "diffrep" = diffrepOri, "variableMetadata" = variableMetadataOri));
 
 }
 
 
-combinexsAnnos_function <- function(xaP, xaN, diffrepP=NULL,diffrepN=NULL,
-    pos=TRUE,tol=2,ruleset=NULL,keep_meta=TRUE, convertRTMinute=F, numDigitsMZ=0,
-    numDigitsRT=0, variableMetadataOutput="variableMetadata.tsv"){
+combinexsAnnos_function <- function(xaP, xaN, diffrepP = NULL, diffrepN = NULL,
+    pos = TRUE, tol = 2, ruleset = NULL, keep_meta = TRUE, convertRTMinute = F, numDigitsMZ = 0,
+    numDigitsRT = 0, variableMetadataOutput = "variableMetadata.tsv") {
 
     #Load the two Rdata to extract the xset objects from positive and negative mode
     cat("\tObject xset from positive mode\n")
@@ -233,136 +240,131 @@
     cat("\n")
     cat("\tCombining...\n")
     #Convert the string to numeric for creating matrix
-    row=as.numeric(strsplit(ruleset,",")[[1]][1])
-    column=as.numeric(strsplit(ruleset,",")[[1]][2])
-    ruleset=cbind(row,column)
+    row <- as.numeric(strsplit(ruleset, ",")[[1]][1])
+    column <- as.numeric(strsplit(ruleset, ",")[[1]][2])
+    ruleset <- cbind(row, column)
     #Test if the file comes from an older version tool
     if ((!is.null(xaP)) & (!is.null(xaN))) {
         #Launch the combinexsannos function from CAMERA
-        cAnnot=combinexsAnnos(xaP, xaN,pos=pos,tol=tol,ruleset=ruleset)
+        cAnnot <- combinexsAnnos(xaP, xaN, pos = pos, tol = tol, ruleset = ruleset)
     } else {
         stop("You must relauch the CAMERA.annotate step with the lastest version.")
     }
 
-    if(pos){
-        xa=xaP
-        mode="neg. Mode"
+    if (pos) {
+        xa <- xaP
+        mode <- "neg. Mode"
     } else {
-        xa=xaN
-        mode="pos. Mode"
+        xa <- xaN
+        mode <- "pos. Mode"
     }
 
-    peakList=getPeaklist(xa)
-    peakList=cbind(groupnames(xa@xcmsSet),peakList); colnames(peakList)[1] = c("name");
-    variableMetadata=cbind(peakList, cAnnot[, c("isotopes", "adduct", "pcgroup",mode)]);
-    variableMetadata=variableMetadata[,!(colnames(variableMetadata) %in% c(sampnames(xa@xcmsSet)))]
+    peakList <- getPeaklist(xa)
+    peakList <- cbind(groupnames(xa@xcmsSet), peakList); colnames(peakList)[1] <- c("name");
+    variableMetadata <- cbind(peakList, cAnnot[, c("isotopes", "adduct", "pcgroup", mode)]);
+    variableMetadata <- variableMetadata[, !(colnames(variableMetadata) %in% c(sampnames(xa@xcmsSet)))]
 
     #Test if there are more than two classes (conditions)
-    if ( nlevels(sampclass(xaP@xcmsSet))==2 & (!is.null(diffrepN)) & (!is.null(diffrepP))) {
-        diffrepP = diffrepP[,c("name","fold","tstat","pvalue")]; colnames(diffrepP) = paste("P.",colnames(diffrepP),sep="")
-        diffrepN = diffrepN[,c("name","fold","tstat","pvalue")]; colnames(diffrepN) = paste("N.",colnames(diffrepN),sep="")
+    if (nlevels(sampclass(xaP@xcmsSet)) == 2 & (!is.null(diffrepN)) & (!is.null(diffrepP))) {
+        diffrepP <- diffrepP[, c("name", "fold", "tstat", "pvalue")]; colnames(diffrepP) <- paste("P.", colnames(diffrepP), sep = "")
+        diffrepN <- diffrepN[, c("name", "fold", "tstat", "pvalue")]; colnames(diffrepN) <- paste("N.", colnames(diffrepN), sep = "")
 
-        variableMetadata = merge(variableMetadata, diffrepP, by.x="name", by.y="P.name")
-        variableMetadata = merge(variableMetadata, diffrepN, by.x="name", by.y="N.name")
+        variableMetadata <- merge(variableMetadata, diffrepP, by.x = "name", by.y = "P.name")
+        variableMetadata <- merge(variableMetadata, diffrepN, by.x = "name", by.y = "N.name")
     }
 
-    rownames(variableMetadata) = NULL
-    #TODO: checker
-    #colnames(variableMetadata)[1:2] = c("name","mz/rt");
+    rownames(variableMetadata) <- NULL
+    #TODO: checker colnames(variableMetadata)[1:2] = c("name", "mz/rt");
 
-    variableMetadata = RTSecondToMinute(variableMetadata, convertRTMinute)
-    variableMetadata = formatIonIdentifiers(variableMetadata, numDigitsRT=numDigitsRT, numDigitsMZ=numDigitsMZ)
+    variableMetadata <- RTSecondToMinute(variableMetadata, convertRTMinute)
+    variableMetadata <- formatIonIdentifiers(variableMetadata, numDigitsRT = numDigitsRT, numDigitsMZ = numDigitsMZ)
 
     #If the user want to keep only the metabolites which match a difference
-    if(keep_meta){
-        variableMetadata=variableMetadata[variableMetadata[,c(mode)]!="",]
+    if (keep_meta) {
+        variableMetadata <- variableMetadata[variableMetadata[, c(mode)] != "", ]
     }
 
     #Write the output into a tsv file
-    write.table(variableMetadata, sep="\t", quote=FALSE, row.names=FALSE, file=variableMetadataOutput)
+    write.table(variableMetadata, sep = "\t", quote = FALSE, row.names = FALSE, file = variableMetadataOutput)
     return(variableMetadata);
 
 }
 
 # This function get the raw file path from the arguments
 getRawfilePathFromArguments <- function(singlefile, zipfile, args) {
-    if (!is.null(args$zipfile))           zipfile = args$zipfile
-    if (!is.null(args$zipfilePositive))   zipfile = args$zipfilePositive
-    if (!is.null(args$zipfileNegative))   zipfile = args$zipfileNegative
+    if (!is.null(args$zipfile))           zipfile <- args$zipfile
+    if (!is.null(args$zipfilePositive))   zipfile <- args$zipfilePositive
+    if (!is.null(args$zipfileNegative))   zipfile <- args$zipfileNegative
 
     if (!is.null(args$singlefile_galaxyPath)) {
-        singlefile_galaxyPaths = args$singlefile_galaxyPath;
-        singlefile_sampleNames = args$singlefile_sampleName
+        singlefile_galaxyPaths <- args$singlefile_galaxyPath;
+        singlefile_sampleNames <- args$singlefile_sampleName
     }
     if (!is.null(args$singlefile_galaxyPathPositive)) {
-        singlefile_galaxyPaths = args$singlefile_galaxyPathPositive;
-        singlefile_sampleNames = args$singlefile_sampleNamePositive
+        singlefile_galaxyPaths <- args$singlefile_galaxyPathPositive;
+        singlefile_sampleNames <- args$singlefile_sampleNamePositive
     }
     if (!is.null(args$singlefile_galaxyPathNegative)) {
-        singlefile_galaxyPaths = args$singlefile_galaxyPathNegative;
-        singlefile_sampleNames = args$singlefile_sampleNameNegative
+        singlefile_galaxyPaths <- args$singlefile_galaxyPathNegative;
+        singlefile_sampleNames <- args$singlefile_sampleNameNegative
     }
-    if (exists("singlefile_galaxyPaths")){
-        singlefile_galaxyPaths = unlist(strsplit(singlefile_galaxyPaths,","))
-        singlefile_sampleNames = unlist(strsplit(singlefile_sampleNames,","))
+    if (exists("singlefile_galaxyPaths")) {
+        singlefile_galaxyPaths <- unlist(strsplit(singlefile_galaxyPaths, ","))
+        singlefile_sampleNames <- unlist(strsplit(singlefile_sampleNames, ","))
 
-        singlefile=NULL
-        for (singlefile_galaxyPath_i in seq(1:length(singlefile_galaxyPaths))) {
-            singlefile_galaxyPath=singlefile_galaxyPaths[singlefile_galaxyPath_i]
-            singlefile_sampleName=singlefile_sampleNames[singlefile_galaxyPath_i]
-            singlefile[[singlefile_sampleName]] = singlefile_galaxyPath
+        singlefile <- NULL
+        for (singlefile_galaxyPath_i in seq_len(length(singlefile_galaxyPaths))) {
+            singlefile_galaxyPath <- singlefile_galaxyPaths[singlefile_galaxyPath_i]
+            singlefile_sampleName <- singlefile_sampleNames[singlefile_galaxyPath_i]
+            singlefile[[singlefile_sampleName]] <- singlefile_galaxyPath
         }
     }
     for (argument in c("zipfile", "zipfilePositive", "zipfileNegative",
                         "singlefile_galaxyPath", "singlefile_sampleName",
                         "singlefile_galaxyPathPositive", "singlefile_sampleNamePositive",
-                        "singlefile_galaxyPathNegative","singlefile_sampleNameNegative")) {
-        args[[argument]]=NULL
+                        "singlefile_galaxyPathNegative", "singlefile_sampleNameNegative")) {
+        args[[argument]] <- NULL
     }
-    return(list(zipfile=zipfile, singlefile=singlefile, args=args))
+    return(list(zipfile = zipfile, singlefile = singlefile, args = args))
 }
 
 
 # This function retrieve the raw file in the working directory
 #   - if zipfile: unzip the file with its directory tree
 #   - if singlefiles: set symlink with the good filename
-retrieveRawfileInTheWorkingDirectory <- function(singlefile, zipfile) {
-    if(!is.null(singlefile) && (length("singlefile")>0)) {
+retrieveRawfileInTheWorkingDir <- function(singlefile, zipfile) {
+    if (!is.null(singlefile) && (length("singlefile") > 0)) {
         for (singlefile_sampleName in names(singlefile)) {
-            singlefile_galaxyPath = singlefile[[singlefile_sampleName]]
-            if(!file.exists(singlefile_galaxyPath)){
-                error_message=paste("Cannot access the sample:",singlefile_sampleName,"located:",singlefile_galaxyPath,". Please, contact your administrator ... if you have one!")
+            singlefile_galaxyPath <- singlefile[[singlefile_sampleName]]
+            if (!file.exists(singlefile_galaxyPath)) {
+                error_message <- paste("Cannot access the sample:", singlefile_sampleName, "located:", singlefile_galaxyPath, ". Please, contact your administrator ... if you have one!")
                 print(error_message); stop(error_message)
             }
 
-            file.symlink(singlefile_galaxyPath,singlefile_sampleName)
+            file.symlink(singlefile_galaxyPath, singlefile_sampleName)
         }
-        directory = "."
+        directory <- "."
 
     }
-    if(!is.null(zipfile) && (zipfile!="")) {
-        if(!file.exists(zipfile)){
-            error_message=paste("Cannot access the Zip file:",zipfile,". Please, contact your administrator ... if you have one!")
+    if (!is.null(zipfile) && (zipfile != "")) {
+        if (!file.exists(zipfile)) {
+            error_message <- paste("Cannot access the Zip file:", zipfile, ". Please, contact your administrator ... if you have one!")
             print(error_message)
             stop(error_message)
         }
 
-        #list all file in the zip file
-        #zip_files=unzip(zipfile,list=T)[,"Name"]
-
         #unzip
-        suppressWarnings(unzip(zipfile, unzip="unzip"))
+        suppressWarnings(unzip(zipfile, unzip = "unzip"))
 
         #get the directory name
-        filesInZip=unzip(zipfile, list=T);
-        directories=unique(unlist(lapply(strsplit(filesInZip$Name,"/"), function(x) x[1])));
-        directories=directories[!(directories %in% c("__MACOSX")) & file.info(directories)$isdir]
-        directory = "."
-        if (length(directories) == 1) directory = directories
+        filesInZip <- unzip(zipfile, list = T);
+        directories <- unique(unlist(lapply(strsplit(filesInZip$Name, "/"), function(x) x[1])));
+        directories <- directories[!(directories %in% c("__MACOSX")) & file.info(directories)$isdir]
+        directory <- "."
+        if (length(directories) == 1) directory <- directories
 
-        cat("files_root_directory\t",directory,"\n")
+        cat("files_root_directory\t", directory, "\n")
 
     }
-    return (directory)
+    return(directory)
 }
-
--- a/macros.xml	Mon Mar 30 10:21:30 2020 -0400
+++ b/macros.xml	Thu Apr 22 10:27:58 2021 +0000
@@ -1,14 +1,14 @@
 <?xml version="1.0"?>
 <macros>
 
-    <token name="@TOOL_VERSION@">1.42.0</token>
+    <token name="@TOOL_VERSION@">1.46.0</token>
     <xml name="requirements">
         <requirements>
             <requirement type="package" version="0.4_3">r-snow</requirement>
             <requirement type="package" version="@TOOL_VERSION@">bioconductor-camera</requirement>
-            <requirement type="package" version="2.42.0">bioconductor-multtest</requirement>
+            <requirement type="package" version="2.46.0">bioconductor-multtest</requirement>
             <requirement type="package" version="1.1_5">r-batch</requirement>
-            <requirement type="package" version="1.3.31">graphicsmagick</requirement>
+            <requirement type="package" version="1.3.35">graphicsmagick</requirement>
         </requirements>
     </xml>
     <xml name="stdio">
@@ -160,6 +160,12 @@
 
     </token>
 
+    <token name="@HELP_CAMERA_NEWVERSION_1460@">
+**Version 2.2.6+camera1.46.0 - 12/04/2021**
+
+- UPGRADE: upgrade the CAMERA version from 1.42.0 to 1.46.0 (see CAMERA News_)
+    </token>
+
     <token name="@HELP_CAMERA_NEWVERSION_1420@">
 **Version 2.2.6+camera1.42.0 - 13/02/2020**
 
--- a/repository_dependencies.xml	Mon Mar 30 10:21:30 2020 -0400
+++ b/repository_dependencies.xml	Thu Apr 22 10:27:58 2021 +0000
@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
 <repositories>
-    <repository changeset_revision="4a51ab3d8ecf" name="rdata_camera_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu"/>
-    <repository changeset_revision="544f6d2329ac" name="rdata_xcms_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu"/>
+    <repository name="rdata_camera_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" changeset_revision="4a51ab3d8ecf"/>
+    <repository name="rdata_xcms_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" changeset_revision="544f6d2329ac"/>
 </repositories>
\ No newline at end of file