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

Changeset 0:47f9b1fd5ce6 (2017-04-20)
Next changeset 1:090cf284d9ff (2017-11-29)
Commit message:
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
added:
macros.xml
repository_dependencies.xml
static/images/xcms_merge_workflow.png
test-data/MM14-xset.RData
test-data/MM8-xset.RData
test-data/ko15-xset.RData
test-data/ko16-xset.RData
test-data/sampleMetadata.tab
test-data/wt15-xset.RData
test-data/wt16-xset.RData
xcms_merge.xml
b
diff -r 000000000000 -r 47f9b1fd5ce6 macros.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml Thu Apr 20 05:41:32 2017 -0400
[
@@ -0,0 +1,141 @@
+<?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@">
+        LANG=C Rscript $__tool_directory__/xcms.r
+    </token>
+
+    <token name="@COMMAND_LOG_EXIT@">
+        ;
+        return=\$?;
+        mv log.txt '$log';
+        cat '$log';
+        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>
+    </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>
+
+    <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>
+
+    <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>
+
+    <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
+
+.. 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]
+
+ | 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>
+            <citation type="doi">10.1093/bioinformatics/btu813</citation>
+        </citations>
+    </xml>
+</macros>
b
diff -r 000000000000 -r 47f9b1fd5ce6 repository_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/repository_dependencies.xml Thu Apr 20 05:41:32 2017 -0400
b
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<repositories>
+    <repository changeset_revision="7800ba9a4c1e" name="no_unzip_datatype" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" />
+ <repository changeset_revision="d64562a4ebb3" name="rdata_xcms_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" />
+</repositories>
b
diff -r 000000000000 -r 47f9b1fd5ce6 static/images/xcms_merge_workflow.png
b
Binary file static/images/xcms_merge_workflow.png has changed
b
diff -r 000000000000 -r 47f9b1fd5ce6 test-data/MM14-xset.RData
b
Binary file test-data/MM14-xset.RData has changed
b
diff -r 000000000000 -r 47f9b1fd5ce6 test-data/MM8-xset.RData
b
Binary file test-data/MM8-xset.RData has changed
b
diff -r 000000000000 -r 47f9b1fd5ce6 test-data/ko15-xset.RData
b
Binary file test-data/ko15-xset.RData has changed
b
diff -r 000000000000 -r 47f9b1fd5ce6 test-data/ko16-xset.RData
b
Binary file test-data/ko16-xset.RData has changed
b
diff -r 000000000000 -r 47f9b1fd5ce6 test-data/sampleMetadata.tab
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/sampleMetadata.tab Thu Apr 20 05:41:32 2017 -0400
b
@@ -0,0 +1,6 @@
+wt16 WT
+ko16 KO
+wt15 WT
+ko15 KO
+ko10 KO
+foobar01 FOOBAR
b
diff -r 000000000000 -r 47f9b1fd5ce6 test-data/wt15-xset.RData
b
Binary file test-data/wt15-xset.RData has changed
b
diff -r 000000000000 -r 47f9b1fd5ce6 test-data/wt16-xset.RData
b
Binary file test-data/wt16-xset.RData has changed
b
diff -r 000000000000 -r 47f9b1fd5ce6 xcms_merge.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xcms_merge.xml Thu Apr 20 05:41:32 2017 -0400
[
b'@@ -0,0 +1,225 @@\n+<tool id="xcms_merge" name="xcms.xcmsSet Merger" version="1.0.0">\n+    <description>Merge xcms.xcmsSet xset in one to be used by group</description>\n+\n+    <macros>\n+        <import>macros.xml</import>\n+    </macros>\n+\n+    <expand macro="requirements_light"/>\n+    <expand macro="stdio"/>\n+\n+    <command><![CDATA[\n+        Rscript $script_file\n+    ]]></command>\n+\n+    <configfiles>\n+        <configfile name="script_file"><![CDATA[\n+suppressPackageStartupMessages(library(xcms, quietly=TRUE))\n+\n+images=c(\n+"${"\\",\\"".join(map(str, $images))}"\n+)\n+\n+\n+cat("\\tXSET MERGING...\\n")\n+\n+for(image in images) {\n+    load(image)\n+    cat(sampleNamesList\\$sampleNamesOrigin,"\\n")\n+    if (!exists("xset_merged")) {\n+        xset_merged=xset\n+        singlefile_merged=singlefile\n+        listOFlistArguments_merged=listOFlistArguments\n+        md5sumList_merged=md5sumList\n+        sampleNamesList_merged=sampleNamesList\n+    } else {\n+        xset_merged=c(xset_merged,xset)\n+        singlefile_merged=c(singlefile_merged,singlefile)\n+        listOFlistArguments_merged=c(listOFlistArguments_merged,listOFlistArguments)\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+    }\n+}\n+rm(image)\n+xset=xset_merged; rm(xset_merged)\n+singlefile=singlefile_merged; rm(singlefile_merged)\n+listOFlistArguments=listOFlistArguments_merged; rm(listOFlistArguments_merged)\n+md5sumList=md5sumList_merged; rm(md5sumList_merged)\n+sampleNamesList=sampleNamesList_merged; rm(sampleNamesList_merged)\n+\n+#if str($sampleMetadata) != \'None\':\n+    cat("\\tXSET PHENODATA SETTING...\\n")\n+    sampleMetadata=read.table("$sampleMetadata", h=F, sep=";", stringsAsFactors=F)\n+    if (ncol(sampleMetadata) < 2) sampleMetadata=read.table("$sampleMetadata", h=F, sep="\\t", stringsAsFactors=F)\n+    if (ncol(sampleMetadata) < 2) sampleMetadata=read.table("$sampleMetadata", h=F, sep=",", stringsAsFactors=F)\n+    if (ncol(sampleMetadata) < 2) {\n+        error_message="Your sampleMetadata file seems not well formatted. The column separators accepted are ; , and tabulation"\n+        print(error_message)\n+        stop(error_message)\n+    }\n+\n+    sampclass(xset)=sampleMetadata\\$V2[match(rownames(xset@phenoData),sampleMetadata\\$V1)]\n+#end if\n+\n+\n+\n+cat("\\tXSET OBJECT INFO\\n")\n+\n+print(xset@phenoData)\n+print(xset)\n+\n+cat("\\tSAVE RData\\n")\n+save.image("$xsetRData")\n+\n+        ]]></configfile>\n+    </configfiles>\n+\n+    <inputs>\n+        <param name="images" type="data" format="rdata.xcms.raw,rdata" label="xset RData / xcms.xcmsSet file" help="output file from another xcms.xcmsSet" multiple="true" />\n+        <param name="sampleMetadata" label="Sample metadata file " format="tabular" type="data" optional="true" help="must contain at least one column with the sample id and one column with the sample class"/>\n+    </inputs>\n+\n+    <outputs>\n+        <data name="xsetRData" format="rdata.xcms.raw" label="xset.merged.RData" />\n+    </outputs>\n+\n+    <tests>\n+        <test>\n+            <param name="images" value="ko15-xset.RData,ko16-xset.RData,wt15-xset.RData,wt16-xset.RData" />\n+            <assert_stdout>\n+                <has_text text="object with 4 samples" />\n+                <has_text text="Time range: 2506.1-4477.9 seconds (41.8-74.6 minutes)" />\n+                <has_text text="Mass range: 200.1-600 m/z" />\n+                <has_text text="Peaks: 9251 (about 2313 per sample)" />\n+                <has_text text="Peak Groups: 0" />\n+                <has_text text="Sample classes: ." />\n+            </assert_stdout>\n+        </test>\n+        <test>\n+            <param name="images" value="ko15-xset.RData,ko16-xset.RData,wt15-xset.RData,wt16-xset.RData" />\n+            <param name'..b' text="Sample classes: KO, WT" />\n+            </assert_stdout>\n+        </test>\n+        <test>\n+            <param name="images" value="MM8-xset.RData,MM14-xset.RData" />\n+            <assert_stdout>\n+                <has_text text="object with 2 samples" />\n+                <has_text text="Time range: 19.7-307.3 seconds (0.3-5.1 minutes)" />\n+                <has_text text="Mass range: 117.0357-936.7059 m/z" />\n+                <has_text text="Peaks: 236 (about 118 per sample)" />\n+                <has_text text="Peak Groups: 0" />\n+                <has_text text="Sample classes: ." />\n+            </assert_stdout>\n+        </test>\n+    </tests>\n+\n+    <help><![CDATA[\n+\n+@HELP_AUTHORS@\n+\n+===================\n+Xcms.xcmsSet Merger\n+===================\n+\n+-----------\n+Description\n+-----------\n+\n+This tool will allow you to run one xcms.xcmsSet process per sample in parallel and then to merge all RData images in one.\n+The result is then suitable for xcms.group.\n+\n+You can provide a sampleMetadata table to attribute phenotypic value to your samples.\n+\n+\n+-----------------\n+Workflow position\n+-----------------\n+\n+**Upstream tools**\n+\n+========================= ================= =================== ==========\n+Name                      output file       format              parameter\n+========================= ================= =================== ==========\n+xcms.xcmsSet              xset.RData        rdata.xcms.raw      RData file\n+------------------------- ----------------- ------------------- ----------\n+xcms.xcmsSet              xset.RData        rdata.xcms.raw      RData file\n+------------------------- ----------------- ------------------- ----------\n+xcms.xcmsSet              xset.RData        rdata.xcms.raw      RData file\n+------------------------- ----------------- ------------------- ----------\n+...                       ...               ...                 ...\n+========================= ================= =================== ==========\n+\n+\n+**Downstream tools**\n+\n++---------------------------+--------------------+-----------------+\n+| Name                      | Output file        | Format          |\n++===========================+====================+=================+\n+|xcms.group                 | xset.RData         | rdata.xcms.raw  |\n++---------------------------+--------------------+-----------------+\n+\n+.. image:: xcms_merge_workflow.png\n+\n+-----------\n+Input files\n+-----------\n+\n++---------------------------+-----------------------+\n+| Parameter : num + label   |   Format              |\n++===========================+=======================+\n+| 1 : RData file            |   rdata.xcms.raw      |\n++---------------------------+-----------------------+\n+| 2 : RData file            |   rdata.xcms.raw      |\n++---------------------------+-----------------------+\n+| N : RData file            |   rdata.xcms.raw      |\n++---------------------------+-----------------------+\n+| Optional : sampleMetadata |   tsv or csv          |\n++---------------------------+-----------------------+\n+\n+Example of a sampleMetadata:\n+\n++---------------------------+------------+\n+|HU_neg_028                 |   bio      |\n++---------------------------+------------+\n+|HU_neg_034                 |   bio      |\n++---------------------------+------------+\n+|Blanc04                    |   blank    |\n++---------------------------+------------+\n+|Blanc06                    |   blank    |\n++---------------------------+------------+\n+|Blanc09                    |   blank    |\n++---------------------------+------------+\n+\n+------------\n+Output files\n+------------\n+\n+xset.merged.RData: rdata.xcms.raw format\n+\n+    | Rdata file that is necessary in the next step of the workflow "xcms.group".\n+\n+---------------------------------------------------\n+\n+Changelog/News\n+--------------\n+\n+**Version 1.0.0 - 03/02/2017**\n+\n+- NEW: a new tool to merge individual xcmsSet outputs to be used by xcms.group\n+\n+    ]]></help>\n+\n+    <expand macro="citation" />\n+</tool>\n'