Repository 'xcms_summary'
hg clone https://toolshed.g2.bx.psu.edu/repos/lecorguille/xcms_summary

Changeset 15:97ca0321931b (2018-09-18)
Previous changeset 14:4c757d1ba7b4 (2018-02-13) Next changeset 16:a2b6488ea1b9 (2018-09-19)
Commit message:
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
modified:
README.rst
abims_xcms_summary.xml
macros.xml
static/images/xcms_summary_workflow.png
test-data/faahKO-single.xset.merged.group.retcor.group.fillpeaks.RData
test-data/faahKO-single.xset.merged.group.retcor.group.fillpeaks.summary.html
test-data/faahKO.xset.group.retcor.group.fillpeaks.summary.html
xcms_summary.r
added:
lib-xcms3.x.x.r
lib.r
macros_xcms.xml
b
diff -r 4c757d1ba7b4 -r 97ca0321931b README.rst
--- a/README.rst Tue Feb 13 04:51:37 2018 -0500
+++ b/README.rst Tue Sep 18 16:14:05 2018 -0400
b
@@ -2,18 +2,28 @@
 Changelog/News
 --------------
 
+**Version 3.0.0.0 - 14/02/2018**
+
+- UPGRADE: upgrade the xcms version from 1.46.0 to 3.0.0. So refactoring of a lot of underlying codes and methods
+
+- IMPROVEMENT: the tool now shows all the parameters and not only those which were setted.
+
+
 **Version 1.0.4 - 13/02/2018**
 
 - UPGRADE: upgrate the CAMERA version from 1.26.0 to 1.32.0
 
+
 **Version 1.0.3 - 03/02/2017**
 
 - IMPROVEMENT: xcms.summary can deal with merged individual data
 
+
 **Version 1.0.2 - 06/07/2016**
 
 - UPGRADE: upgrate the xcms version from 1.44.0 to 1.46.0
 
+
 **Version 1.0.1 - 04/04/2016**
 
 - TEST: refactoring to pass planemo test using conda dependencies
@@ -22,5 +32,3 @@
 **Version 1.0.0 - 10/02/2016**
 
 - NEW: Create a summary of XCMS analysis
-
-
b
diff -r 4c757d1ba7b4 -r 97ca0321931b abims_xcms_summary.xml
--- a/abims_xcms_summary.xml Tue Feb 13 04:51:37 2018 -0500
+++ b/abims_xcms_summary.xml Tue Sep 18 16:14:05 2018 -0400
[
@@ -1,20 +1,20 @@
-<tool id="abims_xcms_summary" name="xcms.summary" version="1.0.4">
+<tool id="abims_xcms_summary" name="xcms process history" version="@WRAPPER_VERSION@.0">
 
     <description>Create a summary of XCMS analysis</description>
 
     <macros>
         <import>macros.xml</import>
+        <import>macros_xcms.xml</import>
     </macros>
 
-    <requirements>
+    <expand macro="requirements">
         <requirement type="package" version="1.32.0">bioconductor-camera</requirement>
-        <requirement type="package" version="1.1_4">r-batch</requirement>
-    </requirements>
+    </expand>
 
     <expand macro="stdio"/>
 
     <command><![CDATA[
-        $__tool_directory__/xcms_summary.r
+        @COMMAND_RSCRIPT@/xcms_summary.r
 
         image '$image'
         htmlOutput '$htmlOutput'
@@ -24,7 +24,7 @@
 
     <inputs>
 
-        <param name="image" type="data" format="rdata.xcms.raw,rdata.xcms.group,rdata.xcms.retcor,rdata.xcms.fillpeaks,rdata.camera.quick,rdata.camera.positive,rdata.camera.negative,rdata" label="xset RData file" help="output file from another function xcms (xcmsSet, group, retcor, fillpeaks etc.)" />
+        <param name="image" type="data" format="rdata.xcms.findchrompeaks,rdata.xcms.group,rdata.xcms.retcor,rdata.xcms.fillpeaks,rdata.camera.quick,rdata.camera.positive,rdata.camera.negative,rdata" label="xset RData file" help="output file from another function xcms (xcmsSet, group, retcor, fillpeaks etc.)" />
 
     </inputs>
 
@@ -33,12 +33,12 @@
     </outputs>
 
     <tests>
-        <test>
-            <param name="image" value="faahKO.xset.group.retcor.group.fillpeaks.RData" />
+        <!--<test>
+            <param name="image" value="faahKO.xset.group.retcor.group.fillpeaks.RData" ftype="rdata"/>
             <output name="htmlOutput" file="faahKO.xset.group.retcor.group.fillpeaks.summary.html" />
-        </test>
+        </test>-->
         <test>
-            <param name="image" value="faahKO-single.xset.merged.group.retcor.group.fillpeaks.RData" />
+            <param name="image" value="faahKO-single.xset.merged.group.retcor.group.fillpeaks.RData" ftype="rdata"/>
             <output name="htmlOutput" file="faahKO-single.xset.merged.group.retcor.group.fillpeaks.summary.html" />
         </test>
     </tests>
@@ -47,9 +47,9 @@
 
 @HELP_AUTHORS@
 
-============
-Xcms.summary
-============
+====================
+xcms process history
+====================
 
 -----------
 Description
@@ -63,19 +63,19 @@
 
 **Upstream tools**
 
-========================= ================= ===================== ==========
-Name                      output file       format                parameter
-========================= ================= ===================== ==========
-xcms.xcmsSet              xset.RData        rdata.xcms.raw        RData file
-------------------------- ----------------- --------------------- ----------
-xcms.group                xset.RData        rdata.xcms.group      RData file
-------------------------- ----------------- --------------------- ----------
-xcms.retcor               xset.RData        rdata.xcms.retcor     RData file
-------------------------- ----------------- --------------------- ----------
-xcms.fillpeaks            xset.RData        rdata.xcms.fillpeaks  RData file
-------------------------- ----------------- --------------------- ----------
-CAMERA.annotate           xset.RData        rdata.camera.*        RData file
-========================= ================= ===================== ==========
+========================= =========================== ================================
+Name                      Output file                 Format
+========================= =========================== ================================
+xcms.findChromPeaks       xset.RData                  rdata.xcms.findchrompeaks
+------------------------- --------------------------- --------------------------------
+xcms.groupChromPeaks      ``*``.groupChromPeaks.RData rdata.xcms.group
+------------------------- --------------------------- --------------------------------
+xcms.adjustRtime          ``*``.adjustRtime.RData     rdata.xcms.retcor
+------------------------- --------------------------- --------------------------------
+xcms.fillChromPeaks       ``*``.fillChromPeaks.RData  rdata.xcms.fillpeaks
+------------------------- --------------------------- --------------------------------
+CAMERA.annotate           ``*``.annotate.*.RData      rdata.camera.``*``
+========================= =========================== ================================
 
 
 .. image:: xcms_summary_workflow.png
@@ -85,18 +85,28 @@
 Changelog/News
 --------------
 
+**Version 3.0.0.0 - 14/02/2018**
+
+- UPGRADE: upgrade the xcms version from 1.46.0 to 3.0.0. So refactoring of a lot of underlying codes and methods
+
+- IMPROVEMENT: the tool now shows all the parameters and not only those which were set.
+
+
 **Version 1.0.4 - 13/02/2018**
 
 - UPGRADE: upgrate the CAMERA version from 1.26.0 to 1.32.0
 
+
 **Version 1.0.3 - 03/02/2017**
 
 - IMPROVEMENT: xcms.summary can deal with merged individual data
 
+
 **Version 1.0.2 - 06/07/2016**
 
 - UPGRADE: upgrate the xcms version from 1.44.0 to 1.46.0
 
+
 **Version 1.0.1 - 04/04/2016**
 
 - TEST: refactoring to pass planemo test using conda dependencies
b
diff -r 4c757d1ba7b4 -r 97ca0321931b lib-xcms3.x.x.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib-xcms3.x.x.r Tue Sep 18 16:14:05 2018 -0400
[
@@ -0,0 +1,152 @@
+
+
+#@TODO: remove this function as soon as we can use xcms 3.x.x from Bioconductor 3.7
+# https://github.com/sneumann/xcms/issues/250
+groupnamesW4M <- function(xdata, mzdec = 0, rtdec = 0) {
+    mzfmt <- paste("%.", mzdec, "f", sep = "")
+    rtfmt <- paste("%.", rtdec, "f", sep = "")
+
+    gnames <- paste("M", sprintf(mzfmt, featureDefinitions(xdata)[,"mzmed"]), "T",
+                    sprintf(rtfmt, featureDefinitions(xdata)[,"rtmed"]), sep = "")
+
+    if (any(dup <- duplicated(gnames)))
+        for (dupname in unique(gnames[dup])) {
+            dupidx <- which(gnames == dupname)
+            gnames[dupidx] <- paste(gnames[dupidx], seq(along = dupidx), sep = "_")
+        }
+
+    return (gnames)
+}
+
+#@TODO: remove this function as soon as we can use xcms 3.x.x from Bioconductor 3.7
+# https://github.com/sneumann/xcms/issues/247
+.concatenate_XCMSnExp <- function(...) {
+    x <- list(...)
+    if (length(x) == 0)
+        return(NULL)
+    if (length(x) == 1)
+        return(x[[1]])
+    ## Check that all are XCMSnExp objects.
+    if (!all(unlist(lapply(x, function(z) is(z, "XCMSnExp")))))
+        stop("All passed objects should be 'XCMSnExp' objects")
+    new_x <- as(.concatenate_OnDiskMSnExp(...), "XCMSnExp")
+    ## If any of the XCMSnExp has alignment results or detected features drop
+    ## them!
+    x <- lapply(x, function(z) {
+        if (hasAdjustedRtime(z)) {
+            z <- dropAdjustedRtime(z)
+            warning("Adjusted retention times found, had to drop them.")
+        }
+        if (hasFeatures(z)) {
+            z <- dropFeatureDefinitions(z)
+            warning("Feature definitions found, had to drop them.")
+        }
+        z
+    })
+    ## Combine peaks
+    fls <- lapply(x, fileNames)
+    startidx <- cumsum(lengths(fls))
+    pks <- lapply(x, chromPeaks)
+    procH <- lapply(x, processHistory)
+    for (i in 2:length(fls)) {
+        pks[[i]][, "sample"] <- pks[[i]][, "sample"] + startidx[i - 1]
+        procH[[i]] <- lapply(procH[[i]], function(z) {
+            z@fileIndex <- as.integer(z@fileIndex + startidx[i - 1])
+            z
+            })
+    }
+    pks <- do.call(rbind, pks)
+    new_x@.processHistory <- unlist(procH)
+    chromPeaks(new_x) <- pks
+    if (validObject(new_x))
+        new_x
+}
+
+#@TODO: remove this function as soon as we can use xcms 3.x.x from Bioconductor 3.7
+# https://github.com/sneumann/xcms/issues/247
+.concatenate_OnDiskMSnExp <- function(...) {
+    x <- list(...)
+    if (length(x) == 0)
+        return(NULL)
+    if (length(x) == 1)
+        return(x[[1]])
+    ## Check that all are XCMSnExp objects.
+    if (!all(unlist(lapply(x, function(z) is(z, "OnDiskMSnExp")))))
+        stop("All passed objects should be 'OnDiskMSnExp' objects")
+    ## Check processingQueue
+    procQ <- lapply(x, function(z) z@spectraProcessingQueue)
+    new_procQ <- procQ[[1]]
+    is_ok <- unlist(lapply(procQ, function(z)
+        !is.character(all.equal(new_procQ, z))
+        ))
+    if (any(!is_ok)) {
+        warning("Processing queues from the submitted objects differ! ",
+                "Dropping the processing queue.")
+        new_procQ <- list()
+    }
+    ## processingData
+    fls <- lapply(x, function(z) z@processingData@files)
+    startidx <- cumsum(lengths(fls))
+    ## featureData
+    featd <- lapply(x, fData)
+    ## Have to update the file index and the spectrum names.
+    for (i in 2:length(featd)) {
+        featd[[i]]$fileIdx <- featd[[i]]$fileIdx + startidx[i - 1]
+        rownames(featd[[i]]) <- MSnbase:::formatFileSpectrumNames(
+                                              fileIds = featd[[i]]$fileIdx,
+                                              spectrumIds = featd[[i]]$spIdx,
+                                              nSpectra = nrow(featd[[i]]),
+                                              nFiles = length(unlist(fls))
+                                          )
+    }
+    featd <- do.call(rbind, featd)
+    featd$spectrum <- 1:nrow(featd)
+    ## experimentData
+    expdata <- lapply(x, function(z) {
+        ed <- z@experimentData
+        data.frame(instrumentManufacturer = ed@instrumentManufacturer,
+                   instrumentModel = ed@instrumentModel,
+                   ionSource = ed@ionSource,
+                   analyser = ed@analyser,
+                   detectorType = ed@detectorType,
+                   stringsAsFactors = FALSE)
+    })
+    expdata <- do.call(rbind, expdata)
+    expdata <- new("MIAPE",
+                   instrumentManufacturer = expdata$instrumentManufacturer,
+                   instrumentModel = expdata$instrumentModel,
+                   ionSource = expdata$ionSource,
+                   analyser = expdata$analyser,
+                   detectorType = expdata$detectorType)
+
+    ## protocolData
+    protodata <- lapply(x, function(z) z@protocolData)
+    if (any(unlist(lapply(protodata, nrow)) > 0))
+        warning("Found non-empty protocol data, but merging protocol data is",
+                " currently not supported. Skipped.")
+    ## phenoData
+    pdata <- do.call(rbind, lapply(x, pData))
+    res <- new(
+        "OnDiskMSnExp",
+        phenoData = new("NAnnotatedDataFrame", data = pdata),
+        featureData = new("AnnotatedDataFrame", featd),
+        processingData = new("MSnProcess",
+                             processing = paste0("Concatenated [", date(), "]"),
+                             files = unlist(fls), smoothed = NA),
+        experimentData = expdata,
+        spectraProcessingQueue = new_procQ)
+    if (validObject(res))
+        res
+}
+
+#@TODO: remove this function as soon as we can use xcms 3.x.x from Bioconductor 3.7
+# https://github.com/sneumann/xcms/issues/247
+c.XCMSnExp <- function(...) {
+    .concatenate_XCMSnExp(...)
+}
+
+#@TODO: remove this function as soon as we can use xcms 3.x.x from Bioconductor 3.7
+# https://github.com/sneumann/xcms/issues/247
+c.MSnbase <- function(...) {
+    .concatenate_OnDiskMSnExp(...)
+}
b
diff -r 4c757d1ba7b4 -r 97ca0321931b lib.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib.r Tue Sep 18 16:14:05 2018 -0400
[
b'@@ -0,0 +1,510 @@\n+#@authors ABiMS TEAM, Y. Guitton\n+# lib.r for Galaxy Workflow4Metabolomics xcms tools\n+\n+#@author G. Le Corguille\n+# solve an issue with batch if arguments are logical TRUE/FALSE\n+parseCommandArgs <- function(...) {\n+    args <- batch::parseCommandArgs(...)\n+    for (key in names(args)) {\n+        if (args[key] %in% c("TRUE","FALSE"))\n+            args[key] = as.logical(args[key])\n+    }\n+    return(args)\n+}\n+\n+#@author G. Le Corguille\n+# This function will\n+# - load the packages\n+# - display the sessionInfo\n+loadAndDisplayPackages <- function(pkgs) {\n+    for(pkg in pkgs) suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))\n+\n+    sessioninfo = sessionInfo()\n+    cat(sessioninfo$R.version$version.string,"\\n")\n+    cat("Main packages:\\n")\n+    for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\\t") }; cat("\\n")\n+    cat("Other loaded packages:\\n")\n+    for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\\t") }; cat("\\n")\n+}\n+\n+#@author G. Le Corguille\n+# This function merge several chromBPI or chromTIC into one.\n+mergeChrom <- function(chrom_merged, chrom) {\n+    if (is.null(chrom_merged)) return(NULL)\n+    chrom_merged@.Data <- cbind(chrom_merged@.Data, chrom@.Data)\n+    return(chrom_merged)\n+}\n+\n+#@author G. Le Corguille\n+# This function merge several xdata into one.\n+mergeXData <- function(args) {\n+    chromTIC <- NULL\n+    chromBPI <- NULL\n+    chromTIC_adjusted <- NULL\n+    chromBPI_adjusted <- NULL\n+    for(image in args$images) {\n+\n+        load(image)\n+        # Handle infiles\n+        if (!exists("singlefile")) singlefile <- NULL\n+        if (!exists("zipfile")) zipfile <- NULL\n+        rawFilePath <- getRawfilePathFromArguments(singlefile, zipfile, args)\n+        zipfile <- rawFilePath$zipfile\n+        singlefile <- rawFilePath$singlefile\n+        retrieveRawfileInTheWorkingDirectory(singlefile, zipfile)\n+\n+        if (exists("raw_data")) xdata <- raw_data\n+        if (!exists("xdata")) stop("\\n\\nERROR: The RData doesn\'t contain any object called \'xdata\'. This RData should have been created by an old version of XMCS 2.*")\n+\n+        cat(sampleNamesList$sampleNamesOrigin,"\\n")\n+\n+        if (!exists("xdata_merged")) {\n+            xdata_merged <- xdata\n+            singlefile_merged <- singlefile\n+            md5sumList_merged <- md5sumList\n+            sampleNamesList_merged <- sampleNamesList\n+            chromTIC_merged <- chromTIC\n+            chromBPI_merged <- chromBPI\n+            chromTIC_adjusted_merged <- chromTIC_adjusted\n+            chromBPI_adjusted_merged <- chromBPI_adjusted\n+        } else {\n+            if (is(xdata, "XCMSnExp")) xdata_merged <- c(xdata_merged,xdata)\n+            else if (is(xdata, "OnDiskMSnExp")) xdata_merged <- .concatenate_OnDiskMSnExp(xdata_merged,xdata)\n+            else stop("\\n\\nERROR: The RData either a OnDiskMSnExp object called raw_data or a XCMSnExp object called xdata")\n+\n+            singlefile_merged <- c(singlefile_merged,singlefile)\n+            md5sumList_merged$origin <- rbind(md5sumList_merged$origin,md5sumList$origin)\n+            sampleNamesList_merged$sampleNamesOrigin <- c(sampleNamesList_merged$sampleNamesOrigin,sampleNamesList$sampleNamesOrigin)\n+            sampleNamesList_merged$sampleNamesMakeNames <- c(sampleNamesList_merged$sampleNamesMakeNames,sampleNamesList$sampleNamesMakeNames)\n+            chromTIC_merged <- mergeChrom(chromTIC_merged, chromTIC)\n+            chromBPI_merged <- mergeChrom(chromBPI_merged, chromBPI)\n+            chromTIC_adjusted_merged <- mergeChrom(chromTIC_adjusted_merged, chromTIC_adjusted)\n+            chromBPI_adjusted_merged <- mergeChrom(chromBPI_adjusted_merged, chromBPI_adjusted)\n+        }\n+    }\n+    rm(image)\n+    xdata <- xdata_merged; rm(xdata_merged)\n+    singlefile <- singlefile_merged; rm(singlefile_merged)\n+    md5sumList <- md5sumList_merged; rm(md5sumList_merged)\n+    sampleNa'..b'(files)))\n+}\n+\n+\n+# This function get the raw file path from the arguments\n+#@author Gildas Le Corguille lecorguille@sb-roscoff.fr\n+getRawfilePathFromArguments <- function(singlefile, zipfile, args, prefix="") {\n+  if (!(prefix %in% c("","Positive","Negative","MS1","MS2"))) stop("prefix must be either \'\', \'Positive\', \'Negative\', \'MS1\' or \'MS2\'")\n+\n+  if (!is.null(args[[paste0("zipfile",prefix)]])) zipfile <- args[[paste0("zipfile",prefix)]]\n+\n+  if (!is.null(args[[paste0("singlefile_galaxyPath",prefix)]])) {\n+    singlefile_galaxyPaths <- args[[paste0("singlefile_galaxyPath",prefix)]]\n+    singlefile_sampleNames <- args[[paste0("singlefile_sampleName",prefix)]]\n+  }\n+  if (exists("singlefile_galaxyPaths")){\n+    singlefile_galaxyPaths <- unlist(strsplit(singlefile_galaxyPaths,"\\\\|"))\n+    singlefile_sampleNames <- unlist(strsplit(singlefile_sampleNames,"\\\\|"))\n+\n+    singlefile <- NULL\n+    for (singlefile_galaxyPath_i in seq(1:length(singlefile_galaxyPaths))) {\n+      singlefile_galaxyPath <- singlefile_galaxyPaths[singlefile_galaxyPath_i]\n+      singlefile_sampleName <- singlefile_sampleNames[singlefile_galaxyPath_i]\n+      # In case, an url is used to import data within Galaxy\n+      singlefile_sampleName <- tail(unlist(strsplit(singlefile_sampleName,"/")), n=1)\n+      singlefile[[singlefile_sampleName]] <- singlefile_galaxyPath\n+    }\n+  }\n+  return(list(zipfile=zipfile, singlefile=singlefile))\n+}\n+\n+# This function retrieve the raw file in the working directory\n+#   - if zipfile: unzip the file with its directory tree\n+#   - if singlefiles: set symlink with the good filename\n+#@author Gildas Le Corguille lecorguille@sb-roscoff.fr\n+retrieveRawfileInTheWorkingDirectory <- function(singlefile, zipfile) {\n+    if(!is.null(singlefile) && (length("singlefile")>0)) {\n+        for (singlefile_sampleName in names(singlefile)) {\n+            singlefile_galaxyPath <- singlefile[[singlefile_sampleName]]\n+            if(!file.exists(singlefile_galaxyPath)){\n+                error_message <- paste("Cannot access the sample:",singlefile_sampleName,"located:",singlefile_galaxyPath,". Please, contact your administrator ... if you have one!")\n+                print(error_message); stop(error_message)\n+            }\n+\n+            if (!suppressWarnings( try (file.link(singlefile_galaxyPath, singlefile_sampleName), silent=T)))\n+                file.copy(singlefile_galaxyPath, singlefile_sampleName)\n+\n+        }\n+        directory <- "."\n+\n+    }\n+    if(!is.null(zipfile) && (zipfile != "")) {\n+        if(!file.exists(zipfile)){\n+            error_message <- paste("Cannot access the Zip file:",zipfile,". Please, contact your administrator ... if you have one!")\n+            print(error_message)\n+            stop(error_message)\n+        }\n+\n+        #list all file in the zip file\n+        #zip_files <- unzip(zipfile,list=T)[,"Name"]\n+\n+        #unzip\n+        suppressWarnings(unzip(zipfile, unzip="unzip"))\n+\n+        #get the directory name\n+        suppressWarnings(filesInZip <- unzip(zipfile, list=T))\n+        directories <- unique(unlist(lapply(strsplit(filesInZip$Name,"/"), function(x) x[1])))\n+        directories <- directories[!(directories %in% c("__MACOSX")) & file.info(directories)$isdir]\n+        directory <- "."\n+        if (length(directories) == 1) directory <- directories\n+\n+        cat("files_root_directory\\t",directory,"\\n")\n+\n+    }\n+    return (directory)\n+}\n+\n+\n+# This function retrieve a xset like object\n+#@author Gildas Le Corguille lecorguille@sb-roscoff.fr\n+getxcmsSetObject <- function(xobject) {\n+    # XCMS 1.x\n+    if (class(xobject) == "xcmsSet")\n+        return (xobject)\n+    # XCMS 3.x\n+    if (class(xobject) == "XCMSnExp") {\n+        # Get the legacy xcmsSet object\n+        suppressWarnings(xset <- as(xobject, \'xcmsSet\'))\n+        if (!is.null(xset@phenoData$sample_group))\n+            sampclass(xset) <- xset@phenoData$sample_group\n+        else\n+            sampclass(xset) <- "."\n+        return (xset)\n+    }\n+}\n'
b
diff -r 4c757d1ba7b4 -r 97ca0321931b macros.xml
--- a/macros.xml Tue Feb 13 04:51:37 2018 -0500
+++ b/macros.xml Tue Sep 18 16:14:05 2018 -0400
[
@@ -1,141 +1,52 @@
 <?xml version="1.0"?>
 <macros>
-    <xml name="requirements">
-        <requirements>
-            <requirement type="package" version="0.4_1">r-snow</requirement>
-            <requirement type="package" version="1.46.0">bioconductor-xcms</requirement>
-            <requirement type="package" version="1.1_4">r-batch</requirement>
-        </requirements>
-    </xml>
-    <xml name="requirements_light">
-        <requirements>
-            <requirement type="package" version="1.46.0">bioconductor-xcms</requirement>
-        </requirements>
-    </xml>
     <xml name="stdio">
         <stdio>
             <exit_code range="1" level="fatal" />
         </stdio>
     </xml>
 
-    <token name="@COMMAND_XCMS_SCRIPT@">
-        LC_ALL=C Rscript $__tool_directory__/xcms.r
-    </token>
+    <!-- COMMAND -->
+    <token name="@COMMAND_RSCRIPT@">LC_ALL=C Rscript $__tool_directory__/</token>
 
     <token name="@COMMAND_LOG_EXIT@">
         ;
         return=\$?;
-        mv log.txt '$log';
-        cat '$log';
+        cat 'log.txt';
         sh -c "exit \$return"
     </token>
 
-    <!-- zipfile load for planemo test -->
-
-    <token name="@COMMAND_FILE_LOAD@">
-        #if $file_load_section.file_load_conditional.file_load_select == "yes":
-            #if $file_load_section.file_load_conditional.input[0].is_of_type("mzxml") or $file_load_section.file_load_conditional.input[0].is_of_type("mzml") or $file_load_section.file_load_conditional.input[0].is_of_type("mzdata") or $file_load_section.file_load_conditional.input[0].is_of_type("netcdf"):
-                #set singlefile_galaxyPath = ','.join( [ str( $single_file ) for $single_file in $file_load_section.file_load_conditional.input ] )
-                #set singlefile_sampleName = ','.join( [ str( $single_file.name ) for $single_file in $file_load_section.file_load_conditional.input ] )
-
-                singlefile_galaxyPath '$singlefile_galaxyPath' singlefile_sampleName '$singlefile_sampleName'
-            #else
-                zipfile '$file_load_section.file_load_conditional.input'
-            #end if
-        #end if
-    </token>
-
-    <xml name="input_file_load">
-        <section name="file_load_section" title="Resubmit your raw dataset or your zip file">
-            <conditional name="file_load_conditional">
-                <param name="file_load_select" type="select" label="Resubmit your dataset or your zip file" help="Use only if you get a message which say that your original dataset or zip file have been deleted on the server." >
-                    <option value="no" >no need</option>
-                    <option value="yes" >yes</option>
-                </param>
-                <when value="no">
-                </when>
-                <when value="yes">
-                    <param name="input" type="data" format="mzxml,mzml,mzdata,netcdf,no_unzip.zip,zip" multiple="true" label="File(s) from your history containing your chromatograms" help="Single file mode for the format: mzxml, mzml, mzdata and netcdf. Zip file mode for the format: no_unzip.zip, zip. See the help section below." />
-                </when>
-            </conditional>
-        </section>
+    <!-- INPUT_VALIDATORS -->
+    <xml name="input_validator_range_integer">
+        <validator type="regex" message="The format is 'min,max'" >[0-9]+ *, *[0-9]+</validator>
     </xml>
 
-    <xml name="test_file_load_zip">
-        <section name="file_load_section">
-            <conditional name="file_load_conditional">
-                <param name="file_load_select" value="yes" />
-                <param name="input" value="faahKO_reduce.zip" ftype="zip" />
-            </conditional>
-        </section>
+    <xml name="input_validator_range_float">
+        <validator type="regex" message="The format is 'min,max'" >[0-9]+\.?[0-9]* *, *[0-9]+\.?[0-9]*</validator>
     </xml>
 
-    <xml name="test_file_load_single">
-        <section name="file_load_section">
-            <conditional name="file_load_conditional">
-                <param name="file_load_select" value="yes" />
-                <param name="input" value="wt15.CDF,ko16.CDF,ko15.CDF,wt16.CDF" ftype="netcdf" />
-            </conditional>
-        </section>
+    <xml name="input_validator_list_integer">
+        <validator type="regex" message="The format is '1,2,4,6'" >[0-9, ]+</validator>
     </xml>
 
-    <token name="@COMMAND_PEAKLIST@">
-        #if $peaklist.peaklistBool
-            variableMetadataOutput '$variableMetadata'
-            dataMatrixOutput '$dataMatrix'
-            convertRTMinute $peaklist.convertRTMinute
-            numDigitsMZ $peaklist.numDigitsMZ
-            numDigitsRT $peaklist.numDigitsRT
-            intval $peaklist.intval
-        #end if
-    </token>
+
+    <token name="@INPUT_IMAGE_LABEL@">RData file</token>
+    <token name="@INPUT_IMAGE_HELP@">It contains a xcms3::XCMSnExp object (named xdata)</token>
 
-    <xml name="input_peaklist">
-        <conditional name="peaklist">
-            <param name="peaklistBool" type="boolean" label="Get a Peak List" />
-            <when value="true">
-              <param name="convertRTMinute" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Convert retention time (seconds) into minutes" help="Convert the columns rtmed, rtmin and rtmax into minutes"/>
-              <param name="numDigitsMZ" type="integer" value="4" label="Number of decimal places for mass values reported in ions' identifiers." help="A minimum of 4 decimal places is recommended. Useful to avoid duplicates within identifiers" />
-              <param name="numDigitsRT" type="integer" value="0" label="Number of decimal places for retention time values reported in ions' identifiers." help="Useful to avoid duplicates within identifiers" />
-              <param name="intval" type="select" label="Reported intensity values" help="[intval] See the help section below">
-                  <option value="into" selected="true">into</option>
-                  <option value="maxo">maxo</option>
-                  <option value="intb">intb</option>
-              </param>
-            </when>
-            <when value="false" />
-        </conditional>
-    </xml>
 
-    <xml name="output_peaklist"  token_function="">
-        <data name="variableMetadata" format="tabular" label="${image.name[:-6]}.@FUNCTION@.variableMetadata.tsv">
-            <filter>(peaklist['peaklistBool'])</filter>
-        </data>
-        <data name="dataMatrix" format="tabular" label="${image.name[:-6]}.@FUNCTION@.dataMatrix.tsv" >
-            <filter>(peaklist['peaklistBool'])</filter>
-        </data>
-    </xml>
-
-    <token name="@HELP_AUTHORS@">
-.. class:: infomark
-
-**Authors**  Colin A. Smith csmith@scripps.edu, Ralf Tautenhahn rtautenh@gmail.com, Steffen Neumann sneumann@ipb-halle.de, Paul Benton hpaul.benton08@imperial.ac.uk and Christopher Conley cjconley@ucdavis.edu
+    <!-- MISC -->
+    <token name="@HELP_AUTHORS_WRAPPERS@">
 
 .. class:: infomark
 
-**Galaxy integration** ABiMS TEAM - UPMC/CNRS - Station biologique de Roscoff and Yann Guitton yann.guitton@oniris-nantes.fr - part of Workflow4Metabolomics.org [W4M]
+**Galaxy integration** ABiMS TEAM - SU/CNRS - Station biologique de Roscoff and Yann Guitton - LABERCA
+Part of Workflow4Metabolomics.org [W4M]
 
  | Contact support@workflow4metabolomics.org for any questions or concerns about the Galaxy implementation of this tool.
 
----------------------------------------------------
-
     </token>
 
-
-    <xml name="citation">
-        <citations>
-            <citation type="doi">10.1021/ac051437y</citation>
+    <xml name="citation_w4m">
             <citation type="doi">10.1093/bioinformatics/btu813</citation>
-        </citations>
     </xml>
 </macros>
b
diff -r 4c757d1ba7b4 -r 97ca0321931b macros_xcms.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/macros_xcms.xml Tue Sep 18 16:14:05 2018 -0400
[
b'@@ -0,0 +1,244 @@\n+<?xml version="1.0"?>\n+<macros>\n+\n+    <token name="@WRAPPER_VERSION@">3.0.0</token>\n+    <xml name="requirements">\n+        <requirements>\n+            <requirement type="package" version="@WRAPPER_VERSION@">bioconductor-xcms</requirement>\n+            <requirement type="package" version="1.1_4">r-batch</requirement>\n+            <requirement type="package" version="1.1_2">r-rcolorbrewer</requirement>\n+            <requirement type="package" version="6.0">unzip</requirement>\n+            <yield />\n+        </requirements>\n+    </xml>\n+\n+    <!-- FILE_LOAD for planemo test -->\n+    <token name="@COMMAND_FILE_LOAD@">\n+        #if $file_load_section.file_load_conditional.file_load_select == "yes":\n+            #if $file_load_section.file_load_conditional.input[0].is_of_type("mzxml") or $file_load_section.file_load_conditional.input[0].is_of_type("mzml") or $file_load_section.file_load_conditional.input[0].is_of_type("mzdata") or $file_load_section.file_load_conditional.input[0].is_of_type("netcdf"):\n+                #set singlefile_galaxyPath = \'|\'.join( [ str( $single_file ) for $single_file in $file_load_section.file_load_conditional.input ] )\n+                #set singlefile_sampleName = \'|\'.join( [ str( $single_file.name ) for $single_file in $file_load_section.file_load_conditional.input ] )\n+\n+                singlefile_galaxyPath \'$singlefile_galaxyPath\' singlefile_sampleName \'$singlefile_sampleName\'\n+            #else\n+                zipfile \'$file_load_section.file_load_conditional.input\'\n+            #end if\n+        #end if\n+    </token>\n+\n+    <xml name="input_file_load">\n+        <section name="file_load_section" title="Resubmit your raw dataset or your zip file">\n+            <conditional name="file_load_conditional">\n+                <param name="file_load_select" type="select" label="Resubmit your dataset or your zip file" help="Use only if you get a message saying that your original dataset or zip file have been deleted on the server." >\n+                    <option value="no" >no need</option>\n+                    <option value="yes" >yes</option>\n+                </param>\n+                <when value="no">\n+                </when>\n+                <when value="yes">\n+                    <param name="input" type="data" format="mzxml,mzml,mzdata,netcdf,no_unzip.zip,zip" multiple="true" label="File(s) from your history containing your chromatograms" help="Single file mode for the format: mzxml, mzml, mzdata and netcdf. Zip file mode for the format: no_unzip.zip, zip. See the help section below." />\n+                </when>\n+            </conditional>\n+        </section>\n+    </xml>\n+\n+    <xml name="test_file_load_zip">\n+        <section name="file_load_section">\n+            <conditional name="file_load_conditional">\n+                <param name="file_load_select" value="yes" />\n+                <param name="input" value="faahKO_reduce.zip" ftype="zip" />\n+            </conditional>\n+        </section>\n+    </xml>\n+\n+    <xml name="test_file_load_zip_sacuri">\n+        <section name="file_load_section">\n+            <conditional name="file_load_conditional">\n+                <param name="file_load_select" value="yes" />\n+                <param name="input" value="sacuri_dir_root.zip" ftype="zip" />\n+            </conditional>\n+        </section>\n+    </xml>\n+\n+    <xml name="test_file_load_single">\n+        <section name="file_load_section">\n+            <conditional name="file_load_conditional">\n+                <param name="file_load_select" value="yes" />\n+                <param name="input" value="wt15.CDF,ko16.CDF,ko15.CDF,wt16.CDF" ftype="netcdf" />\n+            </conditional>\n+        </section>\n+    </xml>\n+\n+    <xml name="test_file_load_single_ko15">\n+        <section name="file_load_section">\n+            <conditional name="file_load_conditional">\n+                <param name="file_load_select" value="yes" />\n+                <param name="input" value="ko15.CDF" ftype="netcdf" />\n+'..b'the m/z value at the peak apex and the m/z values left and right of it</option>\n+            <option value="meanApex3">mean of the m/z value of the peak apex and the m/z values left and right of it</option>\n+        </param>\n+        <param argument="integrate" type="select" label="Integration method" >\n+            <option value="1">peak limits are found through descent on the mexican hat filtered data (more robust, but less exact)</option>\n+            <option value="2">peak limits based on real data (more accurate but prone to noise)</option>\n+        </param>\n+        <param argument="mzdiff" type="float" value="-0.001" label="Minimum difference in m/z for peaks with overlapping retention times" help="can be negative to allow overlap" />\n+        <param argument="fitgauss" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="fitgauss" help="whether or not a Gaussian should be fitted to each peak" />\n+        <param argument="noise" type="integer" value="0" label="Noise filter" help="allowing to set a minimum intensity required for centroids to be considered in the first analysis step (centroids with intensity lower than \xe2\x80\x98noise\xe2\x80\x99 are omitted from ROI detection)." />\n+        <param argument="verboseColumns" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="verbose Columns" help="whether additional peak meta data columns should be returned" />\n+    </xml>\n+\n+    <token name="@COMMAND_CENTWAVEADVROI@">\n+            #if $sectionROI.roiList:\n+                roiList \'$sectionROI.roiList\'\n+                firstBaselineCheck $sectionROI.firstBaselineCheck\n+                #if $sectionROI.roiScales != "":\n+                    roiScales "c($sectionROI.roiScales)"\n+                #end if\n+            #end if\n+    </token>\n+\n+    <xml name="input_centwaveAdvROI" token_optional="true">\n+        <param argument="roiList" type="data" format="tabular" optional="@OPTIONAL@" label="List of regions-of-interest (ROI) representing detected mass traces" help="If ROIs are submitted the first analysis step is omitted and chromatographic peak detection is performed on the submitted ROIs. Each ROI is expected to have the following elements specified: \xe2\x80\x98scmin\xe2\x80\x99 (start scan index), \xe2\x80\x98scmax\xe2\x80\x99 (end scan index), \xe2\x80\x98mzmin\xe2\x80\x99 (minimum m/z), \xe2\x80\x98mzmax\xe2\x80\x99 (maximum m/z), \xe2\x80\x98length\xe2\x80\x99 (number of scans), \xe2\x80\x98intensity\xe2\x80\x99 (summed intensity)." />\n+        <param argument="firstBaselineCheck" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="Is continuous data within regions of interest is checked to be above the first baseline." />\n+        <param argument="roiScales" type="text" value="" optional="true" label="Numeric vector defining the scale for each region of interest in \xe2\x80\x98roiList\xe2\x80\x99" help="Length equal to \xe2\x80\x98roiList\xe2\x80\x99 - Should be used for the centWave-wavelets (format 0.9,1,0.2)">\n+            <expand macro="input_validator_range_float"/>\n+        </param>\n+    </xml>\n+\n+    <!-- MISC -->\n+    <token name="@HELP_AUTHORS@">\n+.. class:: infomark\n+\n+**Authors**  Colin A. Smith csmith@scripps.edu, Ralf Tautenhahn rtautenh@gmail.com, Steffen Neumann sneumann@ipb-halle.de, Paul Benton hpaul.benton08@imperial.ac.uk and Christopher Conley cjconley@ucdavis.edu\n+\n+@HELP_AUTHORS_WRAPPERS@\n+\n+---------------------------------------------------\n+\n+    </token>\n+\n+    <token name="@HELP_XCMS_MANUAL@">\n+\n+For details and explanations concerning all the parameters and workflow of xcms_ package, see its manual_ and this example_\n+\n+.. _xcms: https://bioconductor.org/packages/release/bioc/html/xcms.html\n+.. _manual: http://www.bioconductor.org/packages/release/bioc/manuals/xcms/man/xcms.pdf\n+.. _example: https://bioconductor.org/packages/release/bioc/vignettes/xcms/inst/doc/xcms.html\n+\n+    </token>\n+\n+    <xml name="citation">\n+        <citations>\n+            <citation type="doi">10.1021/ac051437y</citation>\n+            <expand macro="citation_w4m"/>\n+        </citations>\n+    </xml>\n+</macros>\n'
b
diff -r 4c757d1ba7b4 -r 97ca0321931b static/images/xcms_summary_workflow.png
b
Binary file static/images/xcms_summary_workflow.png has changed
b
diff -r 4c757d1ba7b4 -r 97ca0321931b test-data/faahKO-single.xset.merged.group.retcor.group.fillpeaks.RData
b
Binary file test-data/faahKO-single.xset.merged.group.retcor.group.fillpeaks.RData has changed
b
diff -r 4c757d1ba7b4 -r 97ca0321931b test-data/faahKO-single.xset.merged.group.retcor.group.fillpeaks.summary.html
--- a/test-data/faahKO-single.xset.merged.group.retcor.group.fillpeaks.summary.html Tue Feb 13 04:51:37 2018 -0500
+++ b/test-data/faahKO-single.xset.merged.group.retcor.group.fillpeaks.summary.html Tue Sep 18 16:14:05 2018 -0400
[
@@ -17,79 +17,126 @@
 <h2>Samples used:</h2>
 <div><table>
 <tr><th>sample</th><th>filename</th><th>md5sum<sup>*</sup></th></tr>
-<tr> <td> ko15 </td> <td> ./ko15.CDF </td> <td> 4698c36c0b3af007faf70975c04ccf2a </td> </tr><tr> <td> ko16 </td> <td> ./ko16.CDF </td> <td> afaeed94ced3140bc042d5ab6aeb16c1 </td> </tr><tr> <td> wt15 </td> <td> ./wt15.CDF </td> <td> d58a27fad7c04ddddb0359ddc2b7ba68 </td> </tr><tr> <td> wt16 </td> <td> ./wt16.CDF </td> <td> 29654e9f8ad48c1fbe2a41b9ba578f6e </td> </tr>
+<tr><td>ko15</td><td>ko15.CDF</td><td>4698c36c0b3af007faf70975c04ccf2a</td></tr><tr><td>ko16</td><td>ko16.CDF</td><td>afaeed94ced3140bc042d5ab6aeb16c1</td></tr><tr><td>wt15</td><td>wt15.CDF</td><td>d58a27fad7c04ddddb0359ddc2b7ba68</td></tr><tr><td>wt16</td><td>wt16.CDF</td><td>29654e9f8ad48c1fbe2a41b9ba578f6e</td></tr>
 </table>
 <br/><sup>*</sup>The program md5sum is designed to verify data integrity. So you can check if the data were uploaded correctly or if the data were changed during the process.
 </div>
 <h2>Function launched:</h2>
 <div><table>
 <tr><th>timestamp<sup>***</sup></th><th>function</th><th>argument</th><th>value</th></tr>
-<tr><td rowspan='4'>170203-11:04:42</td><td rowspan='4'>xcmsSet</td>
-<td>nSlaves</td><td>1</td></tr>
-<tr><td>method</td><td>centWave</td></tr>
-<tr><td>ppm</td><td>25</td></tr>
-<tr><td>peakwidth</td><td>2050</td></tr>
-<tr><td rowspan='4'>170203-11:05:21</td><td rowspan='4'>xcmsSet</td>
-<td>nSlaves</td><td>1</td></tr>
-<tr><td>method</td><td>centWave</td></tr>
-<tr><td>ppm</td><td>25</td></tr>
-<tr><td>peakwidth</td><td>2050</td></tr>
-<tr><td rowspan='4'>170203-11:06:21</td><td rowspan='4'>xcmsSet</td>
-<td>nSlaves</td><td>1</td></tr>
-<tr><td>method</td><td>centWave</td></tr>
-<tr><td>ppm</td><td>25</td></tr>
-<tr><td>peakwidth</td><td>2050</td></tr>
-<tr><td rowspan='4'>170203-11:06:59</td><td rowspan='4'>xcmsSet</td>
-<td>nSlaves</td><td>1</td></tr>
-<tr><td>method</td><td>centWave</td></tr>
-<tr><td>ppm</td><td>25</td></tr>
-<tr><td>peakwidth</td><td>2050</td></tr>
-<tr><td rowspan='6'>170203-14:38:53</td><td rowspan='6'>group</td>
-<td>method</td><td>density</td></tr>
-<tr><td>sleep</td><td>0.001</td></tr>
-<tr><td>minfrac</td><td>0.3</td></tr>
-<tr><td>bw</td><td>5</td></tr>
-<tr><td>mzwid</td><td>0.01</td></tr>
-<tr><td>max</td><td>50</td></tr>
-<tr><td rowspan='7'>170203-14:51:16</td><td rowspan='7'>retcor</td>
-<td>method</td><td>peakgroups</td></tr>
-<tr><td>smooth</td><td>loess</td></tr>
-<tr><td>extra</td><td>1</td></tr>
-<tr><td>missing</td><td>1</td></tr>
-<tr><td>span</td><td>0.2</td></tr>
-<tr><td>family</td><td>gaussian</td></tr>
-<tr><td>plottype</td><td>deviation</td></tr>
-<tr><td rowspan='6'>170203-15:27:58</td><td rowspan='6'>group</td>
-<td>method</td><td>density</td></tr>
-<tr><td>sleep</td><td>0.001</td></tr>
-<tr><td>minfrac</td><td>0.3</td></tr>
-<tr><td>bw</td><td>5</td></tr>
-<tr><td>mzwid</td><td>0.01</td></tr>
-<tr><td>max</td><td>50</td></tr>
-<tr><td rowspan='5'>170203-15:44:50</td><td rowspan='5'>fillPeaks</td>
-<td>method</td><td>chrom</td></tr>
-<tr><td>convertRTMinute</td><td>FALSE</td></tr>
-<tr><td>numDigitsMZ</td><td>4</td></tr>
-<tr><td>numDigitsRT</td><td>1</td></tr>
-<tr><td>intval</td><td>into</td></tr>
+<tr><td>Wed Feb  7 11:15:25 2018</td><td>Peak detection</td><td colspan='2'><pre>
+Object of class:  CentWaveParam 
+Parameters:
+ ppm: 25 
+ peakwidth: 20, 50 
+ snthresh: 10 
+ prefilter: 3, 100 
+ mzCenterFun: wMean 
+ integrate: 1 
+ mzdiff: -0.001 
+ fitgauss: FALSE 
+ noise: 0 
+ verboseColumns: FALSE 
+ roiList length: 0 
+ firstBaselineCheck TRUE 
+ roiScales length: 0 
+</pre></td></tr>
+<tr><td>Mon Feb 12 15:31:11 2018</td><td>Peak grouping</td><td colspan='2'><pre>
+Object of class:  PeakDensityParam 
+Parameters:
+ sampleGroups: character of length 4 
+ bw: 30 
+ minFraction: 0.8 
+ minSamples: 1 
+ binSize: 0.25 
+ maxFeatures: 50 
+</pre></td></tr>
+<tr><td>Mon Feb 12 15:31:19 2018</td><td>Retention time correction</td><td colspan='2'><pre>
+Object of class:  PeakGroupsParam 
+Parameters:
+ minFraction: 0.85 
+ extraPeaks: 1 
+ smooth: loess 
+ span: 0.2 
+ family: gaussian 
+ number of peak groups: 125 
+</pre></td></tr>
+<tr><td>Mon Feb 12 15:31:27 2018</td><td>Peak grouping</td><td colspan='2'><pre>
+Object of class:  PeakDensityParam 
+Parameters:
+ sampleGroups: character of length 4 
+ bw: 20 
+ minFraction: 0.4 
+ minSamples: 1 
+ binSize: 0.25 
+ maxFeatures: 50 
+</pre></td></tr>
+<tr><td>Wed Feb 14 09:55:13 2018</td><td>Missing peak filling</td><td colspan='2'><pre>
+Object of class:  FillChromPeaksParam 
+Parameters:
+ expandMz: 0 
+ expandRt: 0 
+ ppm: 0 
+</pre></td></tr>
 </table>
-<br/><sup>***</sup>timestamp format: yymmdd-hh:mm:ss
+<br/><sup>***</sup>timestamp format: DD MM dd hh:mm:ss YYYY or yymmdd-hh:mm:ss
 </div>
+<h2>Informations about the XCMSnExp object:</h2>
+<div><pre>
+MSn experiment data ("XCMSnExp")
+Object size in memory: 1.36 Mb
+- - - Spectra data - - -
+ MS level(s): 1 
+ Number of spectra: 5112 
+ MSn retention times: 41:33 - 75:0 minutes
+- - - Processing information - - -
+Concatenated [Thu Feb  8 15:36:09 2018] 
+ MSnbase version: 2.4.2 
+- - - Meta data  - - -
+phenoData
+  rowNames: ./ko15.CDF ./ko16.CDF ./wt15.CDF ./wt16.CDF
+  varLabels: sample_name sample_group
+  varMetadata: labelDescription
+Loaded from:
+  [1] ko15.CDF...  [4] wt16.CDF
+  Use 'fileNames(.)' to see all files.
+protocolData: none
+featureData
+  featureNames: F1.S0001 F1.S0002 ... F4.S1278 (5112 total)
+  fvarLabels: fileIdx spIdx ... spectrum (27 total)
+  fvarMetadata: labelDescription
+experimentData: use 'experimentData(object)'
+- - - xcms preprocessing - - -
+Chromatographic peak detection:
+ method: centWave 
+ 15230 peaks identified in 4 samples.
+ On average 3808 chromatographic peaks per sample.
+Alignment/retention time adjustment:
+ method: peak groups 
+Correspondence:
+ method: chromatographic peak density 
+ 6332 features identified.
+ Median mz range of features: 0
+ Median rt range of features: 0
+ 5979 filled peaks (on average 1494.75 per sample).
+</pre></div>
 <h2>Informations about the xcmsSet object:</h2>
 <div><pre>
 An "xcmsSet" object with 4 samples
 
-Time range: 2506-4484 seconds (41.8-74.7 minutes)
+Time range: 2499.4-4473.6 seconds (41.7-74.6 minutes)
 Mass range: 200.1-600 m/z
-Peaks: 32720 (about 8180 per sample)
-Peak Groups: 8157 
+Peaks: 15230 (about 3808 per sample)
+Peak Groups: 6332 
 Sample classes: KO, WT 
 
-Peak picking was performed on MS1.
+Feature detection:
+ o Peak picking performed on MS1.
+ o Scan range limited to  1 - 1278 
 Profile settings: method = bin
                   step = 0.1
 
-Memory usage: 4.25 MB
+Memory usage: 2.98 MB
 </pre></div>
 <h2>Citations:</h2>
 <div><ul>
b
diff -r 4c757d1ba7b4 -r 97ca0321931b test-data/faahKO.xset.group.retcor.group.fillpeaks.summary.html
--- a/test-data/faahKO.xset.group.retcor.group.fillpeaks.summary.html Tue Feb 13 04:51:37 2018 -0500
+++ b/test-data/faahKO.xset.group.retcor.group.fillpeaks.summary.html Tue Sep 18 16:14:05 2018 -0400
b
@@ -17,7 +17,7 @@
 <h2>Samples used:</h2>
 <div><table>
 <tr><th>sample</th><th>filename</th><th>md5sum<sup>*</sup></th></tr>
-<tr> <td> ko15 </td> <td> faahKO_reduce/KO/ko15.CDF </td> <td> 4698c36c0b3af007faf70975c04ccf2a </td> </tr><tr> <td> ko16 </td> <td> faahKO_reduce/KO/ko16.CDF </td> <td> afaeed94ced3140bc042d5ab6aeb16c1 </td> </tr><tr> <td> wt15 </td> <td> faahKO_reduce/WT/wt15.CDF </td> <td> d58a27fad7c04ddddb0359ddc2b7ba68 </td> </tr><tr> <td> wt16 </td> <td> faahKO_reduce/WT/wt16.CDF </td> <td> 29654e9f8ad48c1fbe2a41b9ba578f6e </td> </tr>
+<tr><td>ko15</td><td>faahKO_reduce/KO/ko15.CDF</td><td>4698c36c0b3af007faf70975c04ccf2a</td></tr><tr><td>ko16</td><td>faahKO_reduce/KO/ko16.CDF</td><td>afaeed94ced3140bc042d5ab6aeb16c1</td></tr><tr><td>wt15</td><td>faahKO_reduce/WT/wt15.CDF</td><td>d58a27fad7c04ddddb0359ddc2b7ba68</td></tr><tr><td>wt16</td><td>faahKO_reduce/WT/wt16.CDF</td><td>29654e9f8ad48c1fbe2a41b9ba578f6e</td></tr>
 </table>
 <br/><sup>*</sup>The program md5sum is designed to verify data integrity. So you can check if the data were uploaded correctly or if the data were changed during the process.
 </div>
@@ -54,7 +54,7 @@
 <tr><td rowspan='1'>160421-11:50:48</td><td rowspan='1'>fillPeaks</td>
 <td>method</td><td>chrom</td></tr>
 </table>
-<br/><sup>***</sup>timestamp format: yymmdd-hh:mm:ss
+<br/><sup>***</sup>timestamp format: DD MM dd hh:mm:ss YYYY or yymmdd-hh:mm:ss
 </div>
 <h2>Informations about the xcmsSet object:</h2>
 <div><pre>
@@ -66,6 +66,7 @@
 Peak Groups: 8157 
 Sample classes: KO, WT 
 
+Feature detection:
 Profile settings: method = bin
                   step = 0.1
 
b
diff -r 4c757d1ba7b4 -r 97ca0321931b xcms_summary.r
--- a/xcms_summary.r Tue Feb 13 04:51:37 2018 -0500
+++ b/xcms_summary.r Tue Sep 18 16:14:05 2018 -0400
[
b'@@ -1,51 +1,82 @@\n #!/usr/bin/env Rscript\n-# version="1.0.0"\n-#@author Gildas Le Corguille lecorguille@sb-roscoff.fr ABIMS TEAM\n \n \n \n # ----- ARGUMENTS BLACKLIST -----\n #xcms.r\n-argBlacklist=c("zipfile","singlefile_galaxyPath","singlefile_sampleName","xfunction","xsetRdataOutput","sampleMetadataOutput","ticspdf","bicspdf","rplotspdf")\n+argBlacklist <- c("zipfile", "singlefile_galaxyPath", "singlefile_sampleName", "xfunction", "xsetRdataOutput", "sampleMetadataOutput", "ticspdf", "bicspdf", "rplotspdf")\n #CAMERA.r\n-argBlacklist=c(argBlacklist,"dataMatrixOutput","variableMetadataOutput","new_file_path")\n+argBlacklist <- c(argBlacklist, "dataMatrixOutput", "variableMetadataOutput", "new_file_path")\n+\n \n # ----- PACKAGE -----\n+cat("\\tSESSION INFO\\n")\n \n-pkgs=c("parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "igraph", "xcms","CAMERA","batch")\n-for(pkg in pkgs) {\n-    cat(pkg,"\\n")\n-    suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))\n-}\n+#Import the different functions\n+source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) }\n+source_local("lib.r")\n+source_local("lib-xcms3.x.x.r")\n+\n+pkgs <- c("CAMERA","batch")\n+loadAndDisplayPackages(pkgs)\n+cat("\\n\\n");\n \n \n # ----- FUNCTION -----\n-writehtml = function(...) { cat(...,"\\n", file=htmlOutput,append = TRUE,sep="") }\n+writehtml <- function(...) { cat(...,"\\n", file=htmlOutput,append = TRUE,sep="") }\n+writeraw <- function(htmlOutput, object, open="at") {\n+    log_file <- file(htmlOutput, open = open)\n+    sink(log_file)\n+    sink(log_file, type = "output")\n+        print(object)\n+    sink()\n+    close(log_file)\n+}\n+getSampleNames <- function(xobject) {\n+    if (class(xobject) == "xcmsSet")\n+        return (sampnames(xobject))\n+    if (class(xobject) == "XCMSnExp")\n+        return (xobject@phenoData@data$sample_name)\n+}\n+getFilePaths <- function(xobject) {\n+    if (class(xobject) == "xcmsSet")\n+        return (xobject@filepaths)\n+    if (class(xobject) == "XCMSnExp")\n+        return (fileNames(xobject))\n+}\n+equalParams <- function(param1, param2) {\n+    writeraw("param1.txt", param1, open="wt")\n+    writeraw("param2.txt", param2, open="wt")\n+    return(tools::md5sum("param1.txt") == tools::md5sum("param2.txt"))\n+}\n \n \n # ----- ARGUMENTS -----\n \n-listArguments = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects\n+args <- parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects\n \n \n # ----- ARGUMENTS PROCESSING -----\n \n #image is an .RData file necessary to use xset variable given by previous tools\n-load(listArguments[["image"]]);\n+load(args$image);\n \n-htmlOutput = "summary.html"\n-if (!is.null(listArguments[["htmlOutput"]])) htmlOutput = listArguments[["htmlOutput"]];\n+htmlOutput <- "summary.html"\n+if (!is.null(args$htmlOutput)) htmlOutput = args$htmlOutput;\n \n-user_email = NULL\n-if (!is.null(listArguments[["user_email"]])) user_email = listArguments[["user_email"]];\n+user_email <- NULL\n+if (!is.null(args$user_email)) user_email = args$user_email;\n \n-# if the RData come from CAMERA\n-if (!exists("xset") & exists("xa")) xset=xa@xcmsSet\n-\n+# if the RData come from XCMS 1.x\n+if (exists("xset")) xobject <- xset\n # retrocompatability\n-if (!exists("sampleNamesList")) sampleNamesList=list("sampleNamesMakeNames"=make.names(sampnames(xset)))\n+if (!exists("sampleNamesList")) sampleNamesList <- list("sampleNamesMakeNames"=make.names(sampnames(xobject)))\n+# if the RData come from CAMERA\n+if (exists("xa")) xobject <- xa@xcmsSet\n+# if the RData come from XCMS 3.x\n+if (exists("xdata")) xobject <- xdata\n \n-if (!exists("xset")) stop("You need at least a xset or a xa object.")\n+if (!exists("xobject")) stop("You need at least a xdata, a xset or a xa object.")\n \n \n \n@@ -71,37 +102,37 @@\n     writehtml("<div><h1>_'..b'ome bad characters (eg: accent) were removed from your original file, the checksum have changed too.<br/>"\n         }\n \n         writehtml("<tr>",sampleNameHeaderHtml,"<th>filename</th>",md5sumHeaderHtml,"</tr>")\n-        writehtml(paste("<tr>",sampleNameHtml,"<td>",xset@filepaths,"</td>",md5sumHtml,"</tr>"))\n+        writehtml(paste0("<tr>",sampleNameHtml,"<td>",getFilePaths(xobject),"</td>",md5sumHtml,"</tr>"))\n \n     writehtml("</table>")\n     writehtml(md5sumLegend)\n@@ -110,32 +141,57 @@\n     writehtml("<h2>Function launched:</h2>")\n     writehtml("<div><table>")\n         writehtml("<tr><th>timestamp<sup>***</sup></th><th>function</th><th>argument</th><th>value</th></tr>")\n-        for(tool in names(listOFlistArguments)) {\n-            listOFlistArgumentsDisplay=listOFlistArguments[[tool]][!(names(listOFlistArguments[[tool]]) %in% argBlacklist)]\n+        # XCMS 3.x\n+        if (class(xobject) == "XCMSnExp") {\n+            xcmsFunction <- NULL\n+            params <- NULL\n+            for (processHistoryItem in processHistory(xobject)) {\n+                if ((xcmsFunction == processType(processHistoryItem)) && equalParams(params, processParam(processHistoryItem)))\n+                    next\n+                timestamp <- processDate(processHistoryItem)\n+                xcmsFunction <- processType(processHistoryItem)\n+                params <- processParam(processHistoryItem)\n+                writehtml("<tr><td>",timestamp,"</td><td>",xcmsFunction,"</td><td colspan=\'2\'><pre>")\n+                writeraw(htmlOutput, params)\n+                writehtml("</pre></td></tr>")\n+            }\n+        }\n+        # CAMERA and retrocompatability XCMS 1.x\n+        if (exists("listOFlistArguments")) {\n+            for(tool in names(listOFlistArguments)) {\n+                listOFlistArgumentsDisplay <- listOFlistArguments[[tool]][!(names(listOFlistArguments[[tool]]) %in% argBlacklist)]\n \n-            timestamp = strsplit(tool,"_")[[1]][1]\n-            xcmsFunction = strsplit(tool,"_")[[1]][2]\n-            writehtml("<tr><td rowspan=\'",length(listOFlistArgumentsDisplay),"\'>",timestamp,"</td><td rowspan=\'",length(listOFlistArgumentsDisplay),"\'>",xcmsFunction,"</td>")\n-            line_begin=""\n-            for (arg in names(listOFlistArgumentsDisplay)) {\n-                writehtml(line_begin,"<td>",arg,"</td><td>",unlist(listOFlistArgumentsDisplay[arg][1]),"</td></tr>")\n-                line_begin="<tr>"\n+                timestamp <- strsplit(tool,"_")[[1]][1]\n+                xcmsFunction <- strsplit(tool,"_")[[1]][2]\n+                writehtml("<tr><td rowspan=\'",length(listOFlistArgumentsDisplay),"\'>",timestamp,"</td><td rowspan=\'",length(listOFlistArgumentsDisplay),"\'>",xcmsFunction,"</td>")\n+                line_begin <- ""\n+                for (arg in names(listOFlistArgumentsDisplay)) {\n+                    writehtml(line_begin,"<td>",arg,"</td><td>",unlist(listOFlistArgumentsDisplay[arg][1]),"</td></tr>")\n+                    line_begin <- "<tr>"\n+                }\n             }\n         }\n     writehtml("</table>")\n-    writehtml("<br/><sup>***</sup>timestamp format: yymmdd-hh:mm:ss")\n+    writehtml("<br/><sup>***</sup>timestamp format: DD MM dd hh:mm:ss YYYY or yymmdd-hh:mm:ss")\n     writehtml("</div>")\n \n+    if (class(xobject) == "XCMSnExp") {\n+        writehtml("<h2>Informations about the XCMSnExp object:</h2>")\n+\n+        writehtml("<div><pre>")\n+            writeraw(htmlOutput, xobject)\n+        writehtml("</pre></div>")\n+    }\n+\n     writehtml("<h2>Informations about the xcmsSet object:</h2>")\n \n     writehtml("<div><pre>")\n-        log_file=file(htmlOutput, open = "at")\n-        sink(log_file)\n-        sink(log_file, type = "output")\n-            xset\n-        sink()\n+        # Get the legacy xcmsSet object\n+        xset <- getxcmsSetObject(xobject)\n+        writeraw(htmlOutput, xset)\n     writehtml("</pre></div>")\n \n+    # CAMERA\n     if (exists("xa")) {\n         writehtml("<h2>Informations about the CAMERA object:</h2>")\n \n'