diff abims_xcms_retcor.xml @ 30:4d6f4cd7c3ef draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
author lecorguille
date Thu, 01 Mar 2018 04:16:45 -0500
parents c013ed353a2f
children 281786a7b9a2
line wrap: on
line diff
--- a/abims_xcms_retcor.xml	Tue Feb 13 04:44:03 2018 -0500
+++ b/abims_xcms_retcor.xml	Thu Mar 01 04:16:45 2018 -0500
@@ -1,6 +1,6 @@
-<tool id="abims_xcms_retcor" name="xcms.retcor" version="2.1.1">
+<tool id="abims_xcms_retcor" name="xcms adjustRtime (retcor)" version="@WRAPPER_VERSION@.0">
 
-    <description>Retention Time Correction using retcor function from xcms R package </description>
+    <description>Retention Time Correction</description>
 
     <macros>
         <import>macros.xml</import>
@@ -10,27 +10,31 @@
     <expand macro="stdio"/>
 
     <command><![CDATA[
-        @COMMAND_XCMS_SCRIPT@
+        @COMMAND_XCMS_SCRIPT@/xcms_retcor.r
         image '$image'
-        xfunction retcor
-
-        xsetRdataOutput '$xsetRData'
-        ticspdf '$ticsCorPdf'
-        bicspdf '$bpcsCorPdf'
-        rplotspdf '$rplotsPdf'
 
         method $methods.method
-        #if $methods.method == "obiwarp":
-            profStep $methods.profStep
+        #if $methods.method == "PeakGroups":
+            minFraction $methods.minFraction
+            extraPeaks $methods.extraPeaks
+            smooth $methods.smooth_cond.smooth
+            ## PeakGroupsSmoothLoess Advanced
+            span $methods.smooth_cond.PeakGroupsSmoothLoessAdv.span
+            family $methods.smooth_cond.PeakGroupsSmoothLoessAdv.family
         #else
-            smooth $methods.smooth
-            extra $methods.extra
-            missing $methods.missing
-            #if $methods.options.option == "show":
-                span $methods.options.span
-                family $methods.options.family
-                plottype $methods.options.plottype
+            binSize $methods.binSize
+            ## Advanced
+            #if $methods.ObiwarpAdv.centerSample != "":
+                centerSample $methods.ObiwarpAdv.centerSample
             #end if
+            response $methods.ObiwarpAdv.response
+            distFun $methods.ObiwarpAdv.distFunCond.distFun
+            gapInit $methods.ObiwarpAdv.distFunCond.gapInit
+            gapExtend $methods.ObiwarpAdv.distFunCond.gapExtend
+            factorDiag $methods.ObiwarpAdv.factorDiag
+            factorGap $methods.ObiwarpAdv.factorGap
+            localAlignment $methods.ObiwarpAdv.localAlignmentCond.localAlignment
+            initPenalty $methods.ObiwarpAdv.localAlignmentCond.initPenalty
         #end if
 
         @COMMAND_FILE_LOAD@
@@ -41,44 +45,79 @@
     <inputs>
         <param name="image" type="data" format="rdata.xcms.raw,rdata.xcms.group,rdata" label="xset RData file" help="output file from another function xcms (xcmsSet, retcor etc.)" />
         <conditional name="methods">
-            <param name="method" type="select" label="Method to use for retention time correction" help="[method] See the help section below" >
-                <option value="obiwarp" >obiwarp</option>
-                <option value="peakgroups" selected="true">peakgroups</option>
+            <param name="method" type="select" label="Method to use for retention time correction" help="See the help section below" >
+                <option value="PeakGroups" selected="true">PeakGroups - retention time correction based on aligment of features (peak groups) present in most/all samples.</option>
+                <option value="Obiwarp">Obiwarp - alignment based on the complete mz-rt data.</option>
             </param>
-            <when value="obiwarp">
-                <param name="profStep" type="float" value="1" label="Step size (in m/z)" help="[profStep] to use for profile generation from the raw data files" />
+            <when value="PeakGroups">
+                <param argument="minFraction" type="float" value="0.9" min="0" max="1" label="Minimum required fraction of samples in which peaks for the peak group were identified" help="(previously missing)"/>
+                <param argument="extraPeaks" type="integer" value="1" label="Maximal number of additional peaks for all samples to be assigned to a peak group for retention time correction"  help="For a data set with 6 samples, ‘extraPeaks = 1’ uses all peak groups with a total peak count lower or equal to ‘6 + 1’. The total peak count is the total number of peaks being assigned to a peak group and considers also multiple peaks within a sample being assigned to the group. (previously extra)" />
+                <conditional name="smooth_cond">
+                    <param argument="smooth" type="select" label="Smooth method" >
+                        <option value="loess" selected="true">loess - non-linear alignment</option>
+                        <option value="linear">linear - linear alignment</option>
+                    </param>
+                    <when value="loess">
+                        <section name="PeakGroupsSmoothLoessAdv" title="Advanced Options" expanded="False">
+                            <param argument="span" type="float" value="0.2" label="Degree of smoothing for the loess fitting" />
+                            <param argument="family" type="select" label="Family" help="if gaussian fitting is by least-squares with no outlier removal, and if symmetric a re descending M estimator is used with Tukey's biweight function, allowing outlier removal">
+                                <option value="gaussian" selected="true">gaussian</option>
+                                <option value="symmetric">symmetric</option>
+                            </param>
+                        </section>
+                    </when>
+                    <when value="linear" />
+                </conditional>
             </when>
-            <when value="peakgroups">
-                <param name="smooth" type="select" label="Smooth method" help="[smooth] either 'loess’ for non-linear alignment or ‘linear’ for linear alignment" >
-                    <option value="loess">loess</option>
-                    <option value="linear">linear</option>
-                </param>
-                <param name="extra" type="integer" value="1" label="Number of extra peaks to allow in retention time correction correction groups" help="[extra]" />
-                <param name="missing" type="integer" value="1" label="Number of missing samples to allow in retention time correction groups" help="[missing]" />
-
-                <conditional name="options">
-                    <param name="option" type="select" label="Advanced options">
-                        <option value="show">show</option>
-                        <option value="hide" selected="true">hide</option>
-                    </param>
-                    <when value="show">
-                        <param name="span" type="float" value="0.2" label="Degree of smoothing for local polynomial regression fitting" help="[span]"/>
-
-                        <param name="family" type="select" label="Family" help="[family] if gaussian fitting is by least-squares with no outlier removal, and if symmetric a re descending M estimator is used with Tukey's biweight function, allowing outlier removal">
-                            <option value="gaussian" selected="true">gaussian</option>
-                            <option value="symmetric">symmetric</option>
+            <when value="Obiwarp">
+                <param argument="binSize" type="float" value="1" label="Bin size (in mz dimension) to be used for the profile matrix generation" help="See ‘step’ parameter in ‘profile-matrix’ documentation for more details. (previously profStep)" />
+                <section name="ObiwarpAdv" title="Advanced Options" expanded="False">
+                    <param argument="centerSample" type="integer" value="" optional="true" label="Index of the center sample in the experiment" help="It defaults to ‘floor(median(1:length(fileNames(object))))’" />
+                    <param argument="response" type="integer" value="1" label="Defining the responsiveness of warping" help="with ‘response = 0’ giving linear warping on start and end points and ‘response = 100’ warping using all bijective anchors." />
+                    <conditional name="distFunCond">
+                        <param argument="distFun" type="select" label="Distance function to be used">
+                            <option value="cor_opt" selected="true">cor_opt - calculate only 10% diagonal band of distance matrix; better runtime</option>
+                            <option value="cor">cor - Pearson's correlation</option>
+                            <option value="cov">cov - covariance</option>
+                            <option value="prd">prd - product</option>
+                            <option value="euc">euc - Euclidian distance</option>
                         </param>
-
-                        <param name="plottype" type="select" help="[plottype] if deviation plot retention time deviation points and regression fit, and if mdevden also plot peak overall peak density and retention time correction peak density">
-                            <option value="none" selected="true">none</option>
-                            <option value="deviation">deviation</option>
-                            <option value="mdevden">mdevden</option>
+                        <when value="cor_opt">
+                            <param argument="gapInit" type="float" value="0.3" label="Penalty for gap opening" />
+                            <param argument="gapExtend" type="float" value="2.4" label="Penalty for gap enlargement" />
+                        </when>
+                        <when value="cor">
+                            <param argument="gapInit" type="float" value="0.3" label="Penalty for gap opening" />
+                            <param argument="gapExtend" type="float" value="2.4" label="Penalty for gap enlargement" />
+                        </when>
+                        <when value="cov">
+                            <param argument="gapInit" type="float" value="0.0" label="Penalty for gap opening" />
+                            <param argument="gapExtend" type="float" value="11.7" label="Penalty for gap enlargement" />
+                        </when>
+                        <when value="prd">
+                            <param argument="gapInit" type="float" value="0.0" label="Penalty for gap opening" />
+                            <param argument="gapExtend" type="float" value="7.8" label="Penalty for gap enlargement" />
+                        </when>
+                        <when value="euc">
+                            <param argument="gapInit" type="float" value="0.9" label="Penalty for gap opening" />
+                            <param argument="gapExtend" type="float" value="1.8" label="Penalty for gap enlargement" />
+                        </when>
+                    </conditional>
+                    <param argument="factorDiag" type="float" value="2" label="Local weight applied to diagonal moves in the alignment" />
+                    <param argument="factorGap" type="float" value="1" label="local weight for gap moves in the alignment" />
+                    <conditional name="localAlignmentCond">
+                        <param argument="localAlignment" type="select" label="Whether a local alignment should be performed instead of the default global alignment">
+                            <option value="FALSE" selected="true">FALSE</option>
+                            <option value="TRUE">TRUE</option>
                         </param>
-
-                    </when>
-                    <when value="hide">
-                    </when>
-                </conditional>
+                        <when value="FALSE">
+                            <param argument="initPenalty" type="hidden" value="0" label="Penalty for initiating an alignment" />
+                        </when>
+                        <when value="TRUE">
+                            <param argument="initPenalty" type="float" value="0"  label="Penalty for initiating an alignment" />
+                        </when>
+                    </conditional>
+                </section>
             </when>
         </conditional>
 
@@ -87,95 +126,100 @@
     </inputs>
 
     <outputs>
-        <data name="xsetRData" format="rdata.xcms.retcor" label="${image.name[:-6]}.retcor.RData" />
-        <data name="rplotsPdf" format="pdf"  label="${image.name[:-6]}.retcor.Rplots.pdf">
-            <filter>(methods['method'] == 'peakgroups')</filter>
-            <filter>(options['option'] == 'show')</filter>
-            <filter>(family == 'symmetric')</filter>
-            <filter>(plottype != 'none')</filter>
-        </data>
-        <data name="ticsCorPdf"   format="pdf"  label="${image.name[:-6]}.retcor.TICs_corrected.pdf" />
-        <data name="bpcsCorPdf"   format="pdf" label="${image.name[:-6]}.retcor.BPCs_corrected.pdf" />
-        <data name="log" format="txt" label="xset.log.txt"  hidden="true" />
+        <data name="xsetRData" format="rdata.xcms.retcor" label="${image.name[:-6]}.retcor.RData" from_work_dir="retcor.RData" />
+        <data name="rawVSadjustedPdf" format="pdf"  label="${image.name[:-6]}_rawVSadjusted.retcor.Rplots.pdf" from_work_dir="raw_vs_adjusted_rt.pdf" />
+        <data name="ticsCorPdf"   format="pdf"  label="${image.name[:-6]}.retcor.TICs_corrected.pdf" from_work_dir="TICs.pdf"/>
+        <data name="bpcsCorPdf"   format="pdf" label="${image.name[:-6]}.retcor.BPCs_corrected.pdf" from_work_dir="BICs.pdf" />
     </outputs>
 
     <tests>
-        <!--<test>
-            <param name="image" value="xset.group.RData"/>
-            <param name="methods|method" value="peakgroups"/>
-            <param name="methods|smooth" value="loess"/>
-            <param name="methods|extra" value="1"/>
-            <param name="methods|missing" value="1"/>
-            <param name="methods|options|option" value="show"/>
-            <param name="methods|options|span" value="0.2"/>
-            <param name="methods|options|family" value="gaussian"/>
-            <param name="methods|options|plottype" value="deviation"/>
-            <param name="zipfile_load_conditional|zipfile_load_select" value="yes" />
-            <param name="zipfile_load_conditional|zip_file" value="sacuri_dir_root.zip"  ftype="zip" />
-            <output name="log">
-                <assert_contents>
-                    <has_text text="object with 4 samples" />
-                    <has_text text="Time range: 0.2-1140.1 seconds (0-19 minutes)" />
-                    <has_text text="Mass range: 50.0021-999.9863 m/z" />
-                    <has_text text="Peaks: 59359 (about 14840 per sample)" />
-                    <has_text text="Peak Groups: 0" />
-                    <has_text text="Sample classes: bio, blank" />
-                </assert_contents>
-            </output>
-        </test>-->
+        <test>
+            <param name="image" value="faahKO-single-class.xset.group.RData"/>
+            <conditional name="methods">
+                <param name="method" value="PeakGroups"/>
+                <param name="extraPeaks" value="1"/>
+                <param name="minFraction" value="1"/>
+                <conditional name="smooth_cond">
+                    <param name="smooth" value="loess"/>
+                    <section name="PeakGroupsSmoothLoessAdv">
+                        <param name="span" value="0.2"/>
+                        <param name="family" value="gaussian"/>
+                    </section>
+                </conditional>
+            </conditional>
+            <expand macro="test_file_load_single"/>
+            <assert_stdout>
+                <has_text text="extraPeaks: 1" />
+                <has_text text="minFraction: 1" />
+                <has_text text="span: 0.2" />
+                <has_text text="object with 4 samples" />
+                <has_text text="Time range: 2509.2-4480.3 seconds (41.8-74.7 minutes)" />
+                <has_text text="Mass range: 200.1-600 m/z" />
+                <has_text text="Peaks: 9251 (about 2313 per sample)" />
+                <has_text text="Peak Groups: 0" />
+                <has_text text="Sample classes: KO, WT" />
+            </assert_stdout>
+        </test>
+        <!-- DISABLE FOR TRAVIS : Zip
         <test>
             <param name="image" value="faahKO.xset.group.RData"/>
-            <param name="methods|method" value="peakgroups"/>
-            <param name="methods|smooth" value="loess"/>
-            <param name="methods|extra" value="1"/>
-            <param name="methods|missing" value="1"/>
-            <param name="methods|options|option" value="show"/>
-            <param name="methods|options|span" value="0.2"/>
-            <param name="methods|options|family" value="gaussian"/>
-            <param name="methods|options|plottype" value="deviation"/>
+            <conditional name="methods">
+                <param name="method" value="PeakGroups"/>
+                <param name="extraPeaks" value="1"/>
+                <param name="minFraction" value="1"/>
+                <conditional name="smooth_cond">
+                    <param name="smooth" value="loess"/>
+                    <section name="PeakGroupsSmoothLoessAdv">
+                        <param name="span" value="0.2"/>
+                        <param name="family" value="gaussian"/>
+                    </section>
+                </conditional>
+            </conditional>
             <expand macro="test_file_load_zip"/>
-            <output name="log">
-                <assert_contents>
-                    <has_text text="object with 4 samples" />
-                    <has_text text="Time range: 2507.7-4481.7 seconds (41.8-74.7 minutes)" />
-                    <has_text text="Mass range: 200.1-600 m/z" />
-                    <has_text text="Peaks: 9251 (about 2313 per sample)" />
-                    <has_text text="Peak Groups: 0" />
-                    <has_text text="Sample classes: KO, WT" />
-                </assert_contents>
-            </output>
+            <assert_stdout>
+                <has_text text="object with 4 samples" />
+                <has_text text="Time range: 2509.2-4480.3 seconds (41.8-74.7 minutes)" />
+                <has_text text="Mass range: 200.1-600 m/z" />
+                <has_text text="Peaks: 9251 (about 2313 per sample)" />
+                <has_text text="Peak Groups: 0" />
+                <has_text text="Sample classes: KO, WT" />
+            </assert_stdout>
         </test>
+        -->
+        <!-- DISABLE FOR TRAVIS
+        Test to test the different methods parameters
         <test>
             <param name="image" value="faahKO-single-class.xset.group.RData"/>
-            <param name="methods|method" value="peakgroups"/>
-            <param name="methods|smooth" value="loess"/>
-            <param name="methods|extra" value="1"/>
-            <param name="methods|missing" value="1"/>
-            <param name="methods|options|option" value="show"/>
-            <param name="methods|options|span" value="0.2"/>
-            <param name="methods|options|family" value="gaussian"/>
-            <param name="methods|options|plottype" value="deviation"/>
+            <conditional name="methods">
+                <param name="method" value="Obiwarp"/>
+                <section name="ObiwarpAdv">
+                    <param name="centerSample" value="1"/>
+                    <param name="response" value="0"/>
+                    <conditional name="distFunCond">
+                        <param name="distFun" value="cov"/>
+                        <param name="gapInit" value="0.1" />
+                    </conditional>
+                </section>
+            </conditional>
             <expand macro="test_file_load_single"/>
-            <output name="log">
-                <assert_contents>
-                    <has_text text="object with 4 samples" />
-                    <has_text text="Time range: 2507.7-4481.7 seconds (41.8-74.7 minutes)" />
-                    <has_text text="Mass range: 200.1-600 m/z" />
-                    <has_text text="Peaks: 9251 (about 2313 per sample)" />
-                    <has_text text="Peak Groups: 0" />
-                    <has_text text="Sample classes: KO, WT" />
-                </assert_contents>
-            </output>
+            <assert_stdout>
+                <has_text text="centerSample: 1" />
+                <has_text text="response: 0" />
+                <has_text text="distFun: cov" />
+                <has_text text="gapInit: 0.1" />
+                <has_text text="gapExtend: 11.7" />
+            </assert_stdout>
         </test>
+        -->
     </tests>
 
     <help><![CDATA[
 
 @HELP_AUTHORS@
 
-===========
-Xcms.retcor
-===========
+================
+xcms adjustRtime
+================
 
 -----------
 Description
@@ -191,7 +235,7 @@
 
 .. class:: warningmark
 
-**After an retcor step, it is mandatory to do a group step, otherwise the rest of the workflow will not work with the RData file. (the initial peak grouping becomes invalid and is
+**After an adjustRtime step, it is mandatory to do a groupChromPeaks step, otherwise the rest of the workflow will not work with the RData file. (the initial peak grouping becomes invalid and is
 discarded)**
 
 
@@ -244,17 +288,20 @@
 Method
 ------
 
-**peakgroups**
+**PeakGroups**
 
-    | xcms ignores those groups by only considering well-behaved peak groups which are missing at most one sample and have at most one extra peak. (Those values can be changed with the **missing** and **extra** arguments.)
-    | For each of those well-behaved groups, the algorithm calculates a median retention time and, for every sample, a deviation from that median. Within a sample, the observed deviation generally changes over time in a nonlinear fashion. Those changes are approximated using a local polynomial regression technique implemented in the **loess** function. By default, the curve fitting is done using least-squares on all data points.
-    | However, it is possible to enable outlier detection and removal by setting the **family** argument to **symmetric**.
+    | This method performs retention time adjustment based on the alignment of chromatographic peak groups present in all/most samples (hence corresponding to house keeping compounds). First the retention time deviation of these peak groups is described by fitting either a polynomial (‘smooth = "loess"’) or a linear ( ‘smooth = "linear"’) model to the data points. These models are subsequently used to adjust the retention time of each spectrum in each sample.
+    | See the PeakGroups_manual_
+
+**Obiwarp**
 
-**obiwarp**
+    | This method performs retention time adjustment using the Obiwarp method [Prince 2006]. It is based on the code at http://obi-warp.sourceforge.net but supports alignment of multiple samples by aligning each against a _center_ sample. The alignment is performed directly on the ‘profile-matrix’ and can hence be performed independently of the peak detection or peak grouping.
+    | See the Obiwarp_manual_
 
-    | Calculate retention time deviations for each sample using the obiwarp code at "http://obi-warp.sourceforge.net/". This function is able to align multiple samples by a center-star strategy. Ordered Bijective Interpolated Warping (OBI-Warp) aligns matrices along a single axis using Dynamic Time Warping (DTW) and a one-to-one (bijective) interpolated warp function. OBI-Warp harnesses the non-linear, comprehensive alignment power of DTW and builds on the discrete, non-bijective output of DTW to give natural interpolants that can be used across multiple datasets.
-    | For the original publication see :**Chromatographic Alignment of ESI-LC-MS Proteomics Data Sets by Ordered Bijective Interpo-lated Warping John T. Prince and, Edward M. Marcotte Analytical Chemistry 2006 78 (17), 6140-6152.**
+.. _PeakGroups_manual: https://rdrr.io/bioc/xcms/man/adjustRtime-peakGroups.html#heading-2
+.. _Obiwarp_manual: https://rdrr.io/bioc/xcms/man/adjustRtime-obiwarp.html
 
+@HELP_XCMS_MANUAL@
 
 ------------
 Output files
@@ -294,10 +341,10 @@
 Parameters
 ----------
 
-    | Method: -> **peakgroups**
+    | Method: -> **PeakGroups**
     | smooth: -> **loess**
-    | extra: -> **1**
-    | missing -> **1**
+    | extraPeaks: -> **1**
+    | minFraction -> **1**
     | Advanced options: -> **show**
     | span -> **0.2**
     | family -> **gaussian**
@@ -319,6 +366,10 @@
 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 underlining codes and methods
+
 **Version 2.1.1 - 29/11/2017**
 
 - BUGFIX: To avoid issues with accented letter in the parentFile tag of the mzXML files, we changed a hidden mechanim to LC_ALL=C