Repository 'xcms_refine'
hg clone https://toolshed.g2.bx.psu.edu/repos/workflow4metabolomics/xcms_refine

Changeset 0:eb115eb8f25c (2021-06-17)
Next changeset 1:20f8ebc3a391 (2023-09-11)
Commit message:
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit d4bb3c31e2beca6b4059758c9e76d42c26f8aa55"
added:
README.rst
abims_xcms_refine.xml
lib.r
macros.xml
macros_xcms.xml
repository_dependencies.xml
test-data/faahKO-single.xset.merged.RData
test-data/faahKO_reduce.zip
test-data/ko15.CDF
test-data/ko16.CDF
test-data/wt15.CDF
test-data/wt16.CDF
xcms_refine.r
b
diff -r 000000000000 -r eb115eb8f25c README.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README.rst Thu Jun 17 07:42:55 2021 +0000
b
@@ -0,0 +1,10 @@
+
+Changelog/News
+--------------
+
+.. _News: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS
+
+**Version 3.12.0.0 - 08/02/2021**
+
+- NEW: first version of tool wrapper
+
b
diff -r 000000000000 -r eb115eb8f25c abims_xcms_refine.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/abims_xcms_refine.xml Thu Jun 17 07:42:55 2021 +0000
[
b'@@ -0,0 +1,264 @@\n+<tool id="abims_xcms_refine" name="xcms refineChromPeaks (refine)" version="3.12.0+galaxy0">\n+\n+    <description>Remove or merge chromatographic peaks based on specific criteria.</description>\n+\n+    <macros>\n+        <import>macros.xml</import>\n+        <import>macros_xcms.xml</import>\n+    </macros>\n+\n+    <expand macro="requirements"/>\n+\n+    <expand macro="stdio"/>\n+\n+    <command><![CDATA[\n+        @COMMAND_RSCRIPT@/xcms_refine.r\n+        image \'$image\'\n+\n+        method $methods.method\n+        #if $methods.method == "CleanPeaks":\n+            maxPeakwidth $methods.maxPeakwidth\n+        #elif $methods.method == "FilterIntensity":\n+            threshold $methods.threshold\n+            nValues $methods.nValues\n+            value $methods.value\n+        #else:\n+            expandRt $methods.expandRt\n+            expandMz $methods.expandMz\n+            ppm $methods.ppm\n+            minProp $methods.minProp\n+        #end if\n+\n+        msLevel $msLevel\n+\n+        @COMMAND_FILE_LOAD@\n+\n+        @COMMAND_LOG_EXIT@\n+   ]]></command>\n+\n+    <inputs>\n+        <param name="image" type="data" format="rdata.xcms.findchrompeaks" label="@INPUT_IMAGE_LABEL@" help="@INPUT_IMAGE_HELP@ from: findChromPeaks" />\n+        <conditional name="methods">\n+            <param name="method" type="select" label="Method for peak refinement" help="See the help section below">\n+                <option value="CleanPeaks" selected="true">CleanPeaks - remove peaks that are too wide</option>\n+                <option value="FilterIntensity">FilterIntensity - remove peaks with too low intensity</option>\n+                <option value="MergeNeighboringPeaks">MergeNeighboringPeaks - combine peaks that are too close together</option>\n+            </param>\n+            <when value="CleanPeaks">\n+                <param argument="maxPeakwidth" type="float" value="10" label="MaxPeakWidth" help="maximum peak width in seconds.  See CleanPeaks manual (linked in help below)." />\n+            </when>\n+            <when value="FilterIntensity">\n+                <param argument="threshold" type="float" value="0" label="minimal required intensity" help="minimal required intensity for a peak to be retained.  Defaults to 0.0." />\n+                <param argument="nValues" type="integer" value="1" label="minimum number of data points per peak" help="number of data points (per chromatographic peak) that have to be >= threshold. Defaults to 1." />\n+                <param name="value" type="select" label="Definition of peak intensity" help="See the FilterIntensity manual (linked in help below). \'intb\' requires centWave processed data">\n+                    <option value="maxo" selected="true">maxo - use maximum peak intensities</option>\n+                    <option value="into">into - use integrated peak intensities</option>\n+                    <option value="intb">intb - use baseline-corrected integrated peak intensities</option>\n+                </param>\n+            </when>\n+            <when value="MergeNeighboringPeaks">\n+                <param argument="expandRt" type="float" value="2" label="rt expansion (seconds)" help="seconds of expansion of retention time window (on both sides) to check for overlapping peaks. Defaults to 2." />\n+                <param argument="expandMz" type="float" value="0" label="m/z expansion (m/z units)" help="\'m/z units\' of expansion of m/z window (on both sides) to check for overlapping peaks. Defaults to 0." />\n+                <param argument="ppm" type="float" value="10" label="ppm expansion (ppm units)" help="\'relative \'m/z units\' (in parts per million) of expansion of m/z window (on both sides) to check for overlapping peaks. Defaults to 10." />\n+                <param argument="minProp" type="float" value="0.75" label="minimum proportion at midpoint" help="See MergeNeighboringPeaks manual (linked in help below).  Minimum proportion midway between peaks relative to the smaller peak\'s \'maxo\' (maximal intensity at peak ap'..b': infomark\n+\n+**Authors**  Johannes Rainer Johannes.Rainer@eurac.edu and Mar Garcia-Aloy mar.garcia@fmach.it\n+\n+@HELP_AUTHORS_WRAPPERS@\n+\n+---------------------------------------------------\n+\n+\n+=====================\n+xcms refineChromPeaks\n+=====================\n+\n+-----------\n+Description\n+-----------\n+\n+After peak identification with xcms findChromPeaks (xcmsSet), this tool refines those peaks.\n+It either removes peaks that are too wide or removes peaks with too low intensity or combines peaks that are too close together.\n+\n+Note well that refineChromPeaks methods will always remove feature definitions,\n+because a call to this method can change or remove identified chromatographic peaks, which may be part of features.\n+Therefore it must only be run immediately after findChromPeaks (xcmsSet).\n+\n+-----------------\n+Workflow position\n+-----------------\n+\n+**Upstream tools**\n+\n+==================================== ======================== ==============================\n+Name                                 Output file              Format\n+==================================== ======================== ==============================\n+xcms.findChromPeaks Merger (single)  xset.merged.RData        rdata.xcms.findchrompeaks\n+------------------------------------ ------------------------ ------------------------------\n+xcms.findChromPeaks (zip)            ``*``.raw.xset.RData     rdata.xcms.findchrompeaks\n+==================================== ======================== ==============================\n+\n+\n+**Downstream tools**\n+\n+==================================== ======================== =========================\n+Name                                 Output file              Format\n+==================================== ======================== =========================\n+xcms.findChromPeaks Merger (single)  ``*``.raw.xset.RData     rdata.xcms.findchrompeaks\n+------------------------------------ ------------------------ -------------------------\n+xcms.groupChromPeaks (zip)           ``*``.raw.xset.RData     rdata.xcms.findchrompeaks\n+==================================== ======================== =========================\n+\n+**General schema of the metabolomic workflow**\n+\n+This tool would appear between findChromPeaks and group, but only when the choice of peaks needs to be refined, e.g., to accommodate HILIC data.\n+\n+---------------------------------------------------\n+\n+----------\n+Parameters\n+----------\n+\n+Method to use for refinement\n+----------------------------\n+\n+**CleanPeaks**\n+\n+    | Remove chromatographic peaks with too large rt width.\n+    | See the CleanPeaks_manual_\n+\n+**FilterIntensity**\n+\n+    | Remove chromatographic peaks based on intensity.\n+    | See the FilterIntensity_manual_\n+\n+**MergeNeighboringPeaks**\n+\n+    | Merge neighboring and overlapping chromatographic peaks.\n+    | See the MergeNeighboringPeaks_manual_\n+\n+.. _CleanPeaks_manual: https://rdrr.io/bioc/xcms/man/refineChromPeaks-clean.html\n+.. _FilterIntensity_manual: https://rdrr.io/bioc/xcms/man/refineChromPeaks-filter-intensity.html\n+.. _MergeNeighboringPeaks_manual: https://rdrr.io/bioc/xcms/man/refineChromPeaks-merge.html\n+\n+@HELP_XCMS_MANUAL@\n+\n+------------\n+Output files\n+------------\n+\n+xset.RData: rdata.xcms.findchrompeaks format\n+\n+    | (single) RData files that are necessary in the second step of the workflow "xcms.groupChromPeaks" - must be merged first using "xcms.findChromPeaks Merger"\n+    | (zip) RData file that is necessary in the second step of the workflow "xcms.groupChromPeaks".\n+\n+\n+---------------------------------------------------\n+\n+Changelog/News\n+--------------\n+\n+.. _News: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS\n+\n+\n+**Version 3.6.1.0 - 08/02/2021**\n+\n+- NEW: first version of tool wrapper\n+\n+\n+    ]]></help>\n+\n+    <citations>\n+      <citation type="doi">10.5281/zenodo.3909299</citation>\n+      <expand macro="citation_w4m"/>\n+      <citation type="doi">10.1021/ac051437y</citation>\n+    </citations>\n+\n+\n+</tool>\n'
b
diff -r 000000000000 -r eb115eb8f25c lib.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib.r Thu Jun 17 07:42:55 2021 +0000
[
b'@@ -0,0 +1,451 @@\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)) {\n+      cat(paste(pkg, packageVersion(pkg)), "\\t")\n+    }\n+    cat("\\n")\n+    cat("Other loaded packages:\\n")\n+    for (pkg in names(sessioninfo$loadedOnly)) {\n+      cat(paste(pkg, packageVersion(pkg)), "\\t")\n+    }\n+    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+    md5sumList <- 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 <- retrieveRawfileInTheWorkingDir(singlefile, zipfile, args)\n+        zipfile <- rawFilePath$zipfile\n+        singlefile <- rawFilePath$singlefile\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 <- xcms:::.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_m'..b'x %in% c("", "Positive", "Negative", "MS1", "MS2"))) stop("prefix must be either \'\', \'Positive\', \'Negative\', \'MS1\' or \'MS2\'")\n+\n+    # single - if the file are passed in the command arguments -> refresh singlefile\n+    if (!is.null(args[[paste0("singlefile_galaxyPath", prefix)]])) {\n+      singlefile_galaxyPaths <- unlist(strsplit(args[[paste0("singlefile_galaxyPath", prefix)]], "\\\\|"))\n+      singlefile_sampleNames <- unlist(strsplit(args[[paste0("singlefile_sampleName", prefix)]], "\\\\|"))\n+\n+      singlefile <- NULL\n+      for (singlefile_galaxyPath_i in seq_len(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+    # zipfile - if the file are passed in the command arguments -> refresh zipfile\n+    if (!is.null(args[[paste0("zipfile", prefix)]]))\n+      zipfile <- args[[paste0("zipfile", prefix)]]\n+\n+    # single\n+    if (!is.null(singlefile) && (length("singlefile") > 0)) {\n+        files <- vector()\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+            files <- c(files, singlefile_sampleName)\n+        }\n+    }\n+    # zipfile\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+        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+        filepattern <- c("[Cc][Dd][Ff]", "[Nn][Cc]", "([Mm][Zz])?[Xx][Mm][Ll]", "[Mm][Zz][Dd][Aa][Tt][Aa]", "[Mm][Zz][Mm][Ll]")\n+        filepattern <- paste(paste("\\\\.", filepattern, "$", sep = ""), collapse = "|")\n+        info <- file.info(directory)\n+        listed <- list.files(directory[info$isdir], pattern = filepattern, recursive = TRUE, full.names = TRUE)\n+        files <- c(directory[!info$isdir], listed)\n+        exists <- file.exists(files)\n+        files <- files[exists]\n+\n+    }\n+    return(list(zipfile = zipfile, singlefile = singlefile, files = files))\n+\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 000000000000 -r eb115eb8f25c macros.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml Thu Jun 17 07:42:55 2021 +0000
[
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<macros>
+    <xml name="stdio">
+        <stdio>
+            <exit_code range="1" level="fatal" />
+        </stdio>
+    </xml>
+
+    <!-- COMMAND -->
+    <token name="@COMMAND_RSCRIPT@">LC_ALL=C Rscript $__tool_directory__/</token>
+
+    <token name="@COMMAND_LOG_EXIT@">
+        ;
+        return=\$?;
+        cat 'log.txt';
+        sh -c "exit \$return"
+    </token>
+
+    <!-- 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="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="input_validator_list_integer">
+        <validator type="regex" message="The format is '1,2,4,6'" >[0-9, ]+</validator>
+    </xml>
+
+
+    <token name="@INPUT_IMAGE_LABEL@">RData file</token>
+    <token name="@INPUT_IMAGE_HELP@">It contains a xcms3::XCMSnExp object (named xdata)</token>
+
+
+    <!-- MISC -->
+    <token name="@HELP_AUTHORS_WRAPPERS@">
+
+.. class:: infomark
+
+**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_w4m">
+            <citation type="doi">10.1093/bioinformatics/btu813</citation>
+    </xml>
+</macros>
b
diff -r 000000000000 -r eb115eb8f25c macros_xcms.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/macros_xcms.xml Thu Jun 17 07:42:55 2021 +0000
[
b'@@ -0,0 +1,272 @@\n+<?xml version="1.0"?>\n+<macros>\n+\n+    <token name="@TOOL_VERSION@">3.12.0</token>\n+    <xml name="requirements">\n+        <requirements>\n+            <requirement type="package" version="@TOOL_VERSION@">bioconductor-xcms</requirement>\n+            <requirement type="package" version="1.1_5">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_file" token_filename="">\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="@FILENAME@.CDF" '..b'pe="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+.. _News: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS\n+\n+    </token>\n+\n+    <token name="@HELP_XCMS_NEWVERSION_3440@">\n+**Version 3.4.4.0 - 08/02/2019**\n+\n+- UPGRADE: upgrade the xcms version from 3.0.0 to 3.4.4 (see XCMS News_)\n+    </token>\n+    <token name="@HELP_XCMS_NEWVERSION_3610@">\n+**Version 3.6.1+galaxy* - 03/09/2019**\n+\n+- UPGRADE: upgrade the xcms version from 3.4.4 to 3.6.1 (see XCMS News_)\n+    </token>\n+    <token name="@HELP_XCMS_NEWVERSION_31200@">\n+**Version 3.12.0+galaxy* - 03/03/2020**\n+\n+- UPGRADE: upgrade the xcms version from 3.6.1 to 3.12.0 (see XCMS News_)\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 000000000000 -r eb115eb8f25c repository_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/repository_dependencies.xml Thu Jun 17 07:42:55 2021 +0000
b
@@ -0,0 +1,5 @@
+<?xml version="1.0" ?>
+<repositories>
+    <repository name="no_unzip_datatype" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" changeset_revision="7800ba9a4c1e"/>
+    <repository name="rdata_xcms_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" changeset_revision="544f6d2329ac"/>
+</repositories>
\ No newline at end of file
b
diff -r 000000000000 -r eb115eb8f25c test-data/faahKO-single.xset.merged.RData
b
Binary file test-data/faahKO-single.xset.merged.RData has changed
b
diff -r 000000000000 -r eb115eb8f25c test-data/faahKO_reduce.zip
b
Binary file test-data/faahKO_reduce.zip has changed
b
diff -r 000000000000 -r eb115eb8f25c test-data/ko15.CDF
b
Binary file test-data/ko15.CDF has changed
b
diff -r 000000000000 -r eb115eb8f25c test-data/ko16.CDF
b
Binary file test-data/ko16.CDF has changed
b
diff -r 000000000000 -r eb115eb8f25c test-data/wt15.CDF
b
Binary file test-data/wt15.CDF has changed
b
diff -r 000000000000 -r eb115eb8f25c test-data/wt16.CDF
b
Binary file test-data/wt16.CDF has changed
b
diff -r 000000000000 -r eb115eb8f25c xcms_refine.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xcms_refine.r Thu Jun 17 07:42:55 2021 +0000
[
@@ -0,0 +1,126 @@
+#!/usr/bin/env Rscript
+
+# ----- LOG FILE -----
+log_file <- file("log.txt", open  =  "wt")
+sink(log_file)
+sink(log_file, type = "output")
+
+
+# ----- PACKAGE -----
+cat("\tSESSION INFO\n")
+
+#Import the different functions
+source_local <- function(fname) {
+  argv <- commandArgs(trailingOnly = FALSE)
+  base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
+  source(paste(base_dir, fname, sep = "/"))
+}
+source_local("lib.r")
+
+pkgs <- c("xcms", "batch", "RColorBrewer")
+loadAndDisplayPackages(pkgs)
+cat("\n\n");
+
+# ----- ARGUMENTS -----
+cat("\tARGUMENTS INFO\n")
+# interpretation of arguments given in command line as an R list of objects
+args <- parseCommandArgs(evaluate = FALSE)
+write.table(as.matrix(args), col.names = F, quote = F, sep = "\t")
+
+cat("\n\n")
+
+# ----- PROCESSING INFILE -----
+cat("\tARGUMENTS PROCESSING INFO\n")
+
+#saving the specific parameters
+args_method  <- args$method
+args_image   <- args$image
+args_msLevel <- args$msLevel
+param_args <- list()
+
+if (args_method == "CleanPeaks") {
+  param_args$maxPeakwidth <- args$maxPeakwidth
+} else if (args_method == "FilterIntensity") {
+  param_args$threshold <- args$threshold
+  param_args$value <- args$value
+  param_args$nValues <- args$nValues
+} else if (args_method == "MergeNeighboringPeaks") {
+  param_args$expandRt <- args$expandRt
+  param_args$expandMz <- args$expandMz
+  param_args$ppm      <- args$ppm
+  param_args$minProp  <- args$minProp
+}
+
+cat("\n\n")
+
+
+# ----- ARGUMENTS PROCESSING -----
+cat("\tINFILE PROCESSING INFO\n")
+
+#image is an .RData file necessary to use xset variable given by previous tools
+load(args_image)
+if (!exists("xdata")) stop("\n\nERROR: The RData doesn't contain any object called 'xdata'. Such RData as this might have been created by an old version of XMCS 2.*")
+
+# Handle infiles
+if (!exists("singlefile")) singlefile <- NULL
+if (!exists("zipfile")) zipfile <- NULL
+rawFilePath <- retrieveRawfileInTheWorkingDir(singlefile, zipfile, args)
+zipfile <- rawFilePath$zipfile
+singlefile <- rawFilePath$singlefile
+
+cat("\n\n")
+
+
+# ----- MAIN PROCESSING INFO -----
+cat("\tMAIN PROCESSING INFO\n")
+
+
+cat("\t\tPREPARE PARAMETERS\n\n")
+
+if (args_method == "CleanPeaks") {
+  refineChromPeaksParam <- CleanPeaksParam(maxPeakwidth = param_args$maxPeakwidth)
+} else if (args_method == "FilterIntensity") {
+  refineChromPeaksParam <- FilterIntensityParam(
+    threshold = param_args$threshold,
+    nValues = param_args$nValues,
+    value = param_args$value
+  )
+} else if (args_method == "MergeNeighboringPeaks") {
+  refineChromPeaksParam <- MergeNeighboringPeaksParam(
+    expandRt = param_args$expandRt,
+    expandMz = param_args$expandMz,
+    ppm = param_args$ppm,
+    minProp = param_args$minProp
+  )
+}
+
+cat(str(refineChromPeaksParam))
+
+cat("\n\n\t\tCOMPUTE\n")
+
+xdata <- updateObject(xdata)
+
+xdata <- refineChromPeaks(xdata, param = refineChromPeaksParam)
+
+cat("\n\n")
+
+# ----- EXPORT -----
+
+cat("\tXCMSnExp OBJECT INFO\n")
+print(xdata)
+cat("\n\n")
+
+cat("\txcmsSet OBJECT INFO\n")
+# Get the legacy xcmsSet object
+xset <- getxcmsSetObject(xdata)
+print(xset)
+cat("\n\n")
+
+#saving R data in .Rdata file to save the variables used in the present tool
+objects2save <- c("xdata", "zipfile", "singlefile", "md5sumList", "sampleNamesList")
+save(list = objects2save[objects2save %in% ls()], file = "xcmsSet.RData")
+
+cat("\n\n")
+
+
+cat("\tDONE\n")