changeset 7:dd0a593dded1 draft

planemo upload commit c3ffcc9ea76a0e143e11613e6841ee59a28578fd
author lecorguille
date Wed, 12 Apr 2017 08:53:04 -0400
parents 03fdfbd914ab
children 80de755766a8
files ipo4retgroup.xml ipo4xcmsSet.xml macros.xml test-data/MM14_IPO_parameters4xcmsSet.tsv test-data/MM14_IPO_parameters4xcmsSet_peakwidth.tsv test-data/MM14_IPO_parameters4xcmsSet_ppm.tsv test-data/faahKO_IPO_parameters4retgroup_bw.tsv
diffstat 7 files changed, 316 insertions(+), 249 deletions(-) [+]
line wrap: on
line diff
--- a/ipo4retgroup.xml	Thu Mar 30 11:27:09 2017 -0400
+++ b/ipo4retgroup.xml	Wed Apr 12 08:53:04 2017 -0400
@@ -4,6 +4,14 @@
 
     <macros>
         <import>macros.xml</import>
+
+        <macro name="group_density_bw_fixed">
+            <param name="bw" type="integer" value="30" label="Bandwidth" help="[bw] bandwidth (standard deviation or half width at half maximum) of gaussian smoothing kernel to apply to the peak density chromatogram" />
+        </macro>
+
+        <macro name="group_density_mzwid_fixed">
+            <param name="mzwid" type="float" value="0.25" label="Width of overlapping m/z slices" help="[mzwid] to use for creating peak density chromatograms and grouping peaks across samples " />
+        </macro>
     </macros>
 
     <expand macro="requirements"/>
@@ -24,43 +32,27 @@
 
         sleep 0.001
         #if $group.methods.method == "density":
-            bw "c($group.methods.bw)"
-            minfrac "c($group.methods.minfrac)"
-            mzwid "c($group.methods.mzwid)"
-            ## minsamp "c($group.methods.minsamp)"
-            #if $group.methods.density_options.option == "show":
-                max "c($group.methods.density_options.max)"
-            #end if
+            bw "c($group.methods.section_group_density_optiomizable.conditional_parameter.bw)"
+            mzwid "c($group.methods.section_group_density_optiomizable.conditional_parameter.mzwid)"
+
+            minfrac $group.methods.section_group_density_non_optimizable.minfrac
+            max $group.methods.section_group_density_non_optimizable.max
         #end if
 
-
-
         ## retcor methods
 
         #if $retcor.methods.method == "obiwarp":
             retcorMethod obiwarp
-            profStep "c($methods.profStep)"
-
-            ## $distFunc [1] "cor_opt"
-            ## $gapInit [1] 0.0 0.4
-            ## $gapExtend [1] 2.1 2.7
-            ## $$plottype [1] "none"
-            ## $response [1] 1
-            ## $factorDiag [1] 2
-            ## $factorGap [1] 1
-            ## $localAlignment [1] 0
+            profStep $methods.section_retcor_obiwarp_non_optimizable.profStep
 
         #elif $retcor.methods.method == "peakgroups":
-            ## smooth loess
             retcorMethod loess
-            smooth loess
-            extra "c($retcor.methods.extra)"
-            missing "c($retcor.methods.missing)"
-            #if $retcor.methods.options.option == "show":
-                span "c($retcor.methods.options.span)"
-                family "$retcor.methods.options.family"
-                plottype "$retcor.methods.options.plottype"
-            #end if
+            smooth $retcor.methods.section_retcor_peakgroups_non_optimizable.smooth
+            extra $retcor.methods.section_retcor_peakgroups_non_optimizable.extra
+            missing $retcor.methods.section_retcor_peakgroups_non_optimizable.missing
+            span $retcor.methods.section_retcor_peakgroups_non_optimizable.span
+            family $retcor.methods.section_retcor_peakgroups_non_optimizable.family
+            plottype $retcor.methods.section_retcor_peakgroups_non_optimizable.plottype
         #elif $retcor.methods.method == "none":
             retcorMethod none
         #end if
@@ -76,92 +68,75 @@
 
         <param name="samplebyclass" type="integer" value="2" label="Number of samples used per class to estimate the best parameters" help="Set to 0 to use the whole dataset. To save time, reduce this number" />
 
-        <section name="group" title="Group Options" expanded="False">
-
+        <section name="group" title="Group Options" expanded="True">
             <conditional name="methods">
-                <param name="method" type="select" label="Method to use for grouping" help="[method] See the help section below">
+                <param name="method" type="select" label="Method to use for grouping" help="[method] See the help section below. Only the density method is available so far">
                     <option value="density" selected="true">density</option>
                 </param>
                 <when value="density">
-                    <param name="bw" type="text" value="22,38" label="Range for Bandwidth" help="[bw] bandwidth (standard deviation or half width at half maximum) of gaussian smoothing kernel to apply to the peak density chromatogram (ex: 30 or 22,38)" />
-                    <param name="minfrac" type="text" value="0.3,0.7" label="Range for Minimum fraction of samples necessary" help="[minfrac] in at least one of the sample groups for it to be a valid group (ex: 0.5 or 0.3,0.7)" />
-                    <param name="mzwid" type="text" value="0.015,0.035" label="Range for Width of overlapping m/z slices" help="[mzwid] to use for creating peak density chromatograms and grouping peaks across samples (ex: 0.25 or 0.015,0.035)" />
-                    <!--
-                    <param name="minsamp" type="hidden" value="1" label="Range for Minimum number of samples necessary in at least one of the sample groups for it to be a valid group" help="[minsamp] (ex: 1 or 0,5" />
-                    -->
-                    <conditional name="density_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="max" type="text" value="50" label="Range for Maximum number of groups to identify in a single m/z slice" help="[max] (ex: 50 or 25,75)" />
-                        </when>
-                        <when value="hide">
-                        </when>
-                    </conditional>
-
+                    <section name="section_group_density_optiomizable"  title="Optimizable parameters" expanded="True">
+                        <conditional name="conditional_parameter">
+                            <param name="select_parameter" type="select" label="Which parameter do you want to optimize?" help="Only one paramter can be optimized at once. The other will require fixed values">
+                                <option value="bw">Bandwidth [bw]</option>
+                                <option value="mzwid">Width of overlapping m/z slices [mzwid]</option>
+                            </param>
+                            <when value="bw">
+                                <param name="bw" type="text" value="22,38" label="Range for Bandwidth" help="[bw] bandwidth (standard deviation or half width at half maximum) of gaussian smoothing kernel to apply to the peak density chromatogram (ex: 22,38)">
+                                    <validator type="regex" message="Should be this format XX,YY">[0-9]+,[0-9]+</validator>
+                                </param>
+                                <expand macro="group_density_mzwid_fixed" />
+                            </when>
+                            <when value="mzwid">
+                                <param name="mzwid" type="text" value="0.015,0.035" label="Range for Width of overlapping m/z slices" help="[mzwid] to use for creating peak density chromatograms and grouping peaks across samples (ex: 0.015,0.035)" >
+                                    <validator type="regex" message="Should be one combinaison of those format: XX,YY or -XX,YY or XX.XX,YY.YY">[\-]?[0-9]+[\.]?[0-9]*,[\-]?[0-9]+[\.]?[0-9]*</validator>
+                                </param>
+                                <expand macro="group_density_bw_fixed" />
+                            </when>
+                        </conditional>
+                    </section>
+                    <section name="section_group_density_non_optimizable" title="Non optimizable parameters"  expanded="True">
+                        <param name="minfrac" type="float" value="0.5" label="Minimum fraction of samples necessary" help="[minfrac] in at least one of the sample groups for it to be a valid group" />
+                        <param name="max" type="integer" value="50" label="Maximum number of groups to identify in a single m/z slice" help="[max]" />
+                    </section>
                 </when>
             </conditional>
-
-
         </section>
 
-        <section name="retcor" title="Retcor Options" expanded="False">
+        <section name="retcor" title="Retcor Options" expanded="True">
             <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">peakgroups</option>
                 </param>
                 <when value="obiwarp">
-                    <param name="profStep" type="text" value="0.7,1.0" label="Range for Step size (in m/z)" help="[profStep] to use for profile generation from the raw data files (ex: 1 or 0.7 1.0)" />
-                    <!--
-                    ## $distFunc [1] "cor_opt"
-                    ## $gapInit [1] 0.0 0.4
-                    ## $gapExtend [1] 2.1 2.7
-                    ## $$plottype [1] "none"
-                    ## $response [1] 1
-                    ## $factorDiag [1] 2
-                    ## $factorGap [1] 1
-                    ## $localAlignment [1] 0
-                    -->
+                    <section name="section_retcor_obiwarp_non_optimizable" title="Non optimizable parameters"  expanded="True">
+                        <param name="profStep" type="text" value="0.7,1.0" label="Range for Step size (in m/z)" help="[profStep] to use for profile generation from the raw data files (ex: 1 or 0.7 1.0)" />
+                    </section>
                 </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>
-                    </param>
-                    <param name="extra" type="text" value="1" label="Range for Number of extra peaks to allow in retention time correction correction groups" help="[extra] (ex: 1 or 1,3)" />
-                    <param name="missing" type="text" value="1" label="Range for Number of missing samples to allow in retention time correction groups" help="[missing] (ex: 1or 1,3)" />
-
-                    <conditional name="options">
-                        <param name="option" type="select" label="Advanced options">
-                            <option value="show">show</option>
-                            <option value="hide" selected="true">hide</option>
+                    <section name="section_retcor_peakgroups_non_optimizable" title="Non optimizable parameters"  expanded="True">
+                        <param name="smooth" type="select" label="Smooth method" help="[smooth] only the 'loess’ for non-linear alignment is available so far" >
+                            <option value="loess">loess</option>
                         </param>
-                        <when value="show">
-                            <param name="span" type="text" value="0.1,0.3" label="Range for Degree of smoothing for local polynomial regression fitting" help="[span] (ex: 0.2 or 0.1,0.3)"/>
-                            <!-- @TODO multiple="true" -->
-                            <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>
-                            </param>
-                            <!-- @TODO multiple="true" -->
-                            <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>
-                            </param>
-
-                        </when>
-                        <when value="hide">
-                        </when>
-                    </conditional>
+                        <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]" />
+                        <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>
+                        </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>
+                        </param>
+                    </section>
                 </when>
             </conditional>
 
         </section>
 
-        <expand macro="file_load"/>
+        <expand macro="input_file_load"/>
 
     </inputs>
 
@@ -182,27 +157,41 @@
             <param name="retcor|methods|smooth" value="loess"/>
             <param name="retcor|methods|extra" value="1"/>
             <param name="retcor|methods|missing" value="1"/>
-            <param name="file_load_conditional|file_load_select" value="yes" />
-            <param name="file_load_conditional|inputs|zip_file" value="faahKO_reduce.zip"  ftype="zip" />
+            <expand macro="test_file_load_zip"/>
             <output name="parametersOutput" file="faahKO_IPO_parameters4retgroup.tsv" />
         </test>-->
 
         <test>
             <param name="image" value="faahKO.xset.RData"/>
-            <param name="group|methods|method" value="density"/>
-            <param name="group|methods|bw" value="28,32"/>
-            <param name="group|methods|minfrac" value="1"/>
-            <param name="group|methods|mzwid" value="0.25"/>
-            <param name="retcor|methods|method" value="peakgroups"/>
-            <param name="retcor|methods|smooth" value="loess"/>
-            <param name="retcor|methods|extra" value="1"/>
-            <param name="retcor|methods|missing" value="1"/>
-            <param name="file_load_conditional|file_load_select" value="yes" />
-            <param name="file_load_conditional|inputs|zip_file" value="faahKO_reduce.zip"  ftype="zip" />
+            <section name="group">
+                <conditional name="methods">
+                    <param name="method" value="density"/>
+                    <section name="section_group_density_optiomizable">
+                        <conditional name="conditional_parameter">
+                            <param name="bw" value="28,32"/>
+                            <param name="mzwid" value="0.25"/>
+                        </conditional>
+                    </section>
+                    <section name="section_group_density_non_optimizable">
+                        <param name="minfrac" value="1"/>
+                    </section>
+                </conditional>
+            </section>
+            <section name="retcor">
+                <conditional name="methods">
+                    <param name="method" value="peakgroups"/>
+                    <section name="section_retcor_peakgroups_non_optimizable">
+                        <param name="smooth" value="loess"/>
+                        <param name="rextra" value="1"/>
+                        <param name="missing" value="1"/>
+                    </section>
+                </conditional>
+            </section>
+            <expand macro="test_file_load_zip"/>
             <output name="parametersOutput" file="faahKO_IPO_parameters4retgroup_bw.tsv" />
         </test>
 
-        <test>
+        <!--<test>
             <param name="image" value="faahKO.xset.RData"/>
             <param name="group|methods|method" value="density"/>
             <param name="group|methods|bw" value="30"/>
@@ -212,10 +201,9 @@
             <param name="retcor|methods|smooth" value="loess"/>
             <param name="retcor|methods|extra" value="1"/>
             <param name="retcor|methods|missing" value="1"/>
-            <param name="file_load_conditional|file_load_select" value="yes" />
-            <param name="file_load_conditional|inputs|zip_file" value="faahKO_reduce.zip"  ftype="zip" />
+            <expand macro="test_file_load_zip"/>
             <output name="parametersOutput" file="faahKO_IPO_parameters4retgroup_mzmid.tsv" />
-        </test>
+        </test>-->
 
         <!--<test>
             <param name="image" value="MM-xset-merge.RData"/>
@@ -228,8 +216,7 @@
             <param name="retcor|methods|extra" value="1"/>
             <param name="retcor|methods|missing" value="1"/>
             <param name="file_load_conditional|file_load_select" value="yes" />
-            <param name="file_load_conditional|inputs|input" value="single_file" />
-            <param name="file_load_conditional|inputs|single_file" value="MM8.mzML,MM14.mzML"  ftype="mzxml" />
+            <expand macro="test_file_load_single"/>
             <output name="parametersOutput" file="MM_IPO_parameters4retgroup.tsv" />
         </test>-->
     </tests>
--- a/ipo4xcmsSet.xml	Thu Mar 30 11:27:09 2017 -0400
+++ b/ipo4xcmsSet.xml	Wed Apr 12 08:53:04 2017 -0400
@@ -1,21 +1,39 @@
 <tool id="ipo4xcmsSet" name="IPO for xcmsSet" version="0.0.3">
-    
+
     <description>IPO optimization process for xcms.xcmsSet</description>
-    
+
     <macros>
         <import>macros.xml</import>
+
+        <macro name="centwave_ppm_fixed">
+            <param name="ppm" type="integer" value="25" label="Max tolerated ppm m/z deviation in consecutive scans in ppm" help="[ppm]" />
+        </macro>
+        <macro name="centwave_peakwidth_fixed">
+            <param name="min_peakwidth" type="float" value="20" label="Min peak width range in seconds" optional="true" help="[min_peakwidth]" />
+            <param name="max_peakwidth" type="float" value="50" label="Max peak width range in seconds" optional="true" help="[max_peakwidth]" />
+        </macro>
+        <macro name="centwave_mzdiff_fixed">
+            <param name="mzdiff" type="float" value="-0.001" label="Minimum difference in m/z for peaks with overlapping Retention Times" help="[mzdiff] Can be negative to allow overlap" />
+        </macro>
+
+        <macro name="matchedfilter_fwhm_fixed">
+            <param name="fwhm" type="integer" value="30" label="Full width at half maximum of matched filtration gaussian model peak" help="[fwhm] Only used to calculate the actual sigma" />
+        </macro>
+        <macro name="matchedfilter_mzdiff_fixed">
+            <param name="mzdiff" type="float" value="0.6" label="Minimum difference in m/z for peaks with overlapping Retention Times" help="[mzdiff] By default: 0.8-step*steps " />
+        </macro>
     </macros>
 
     <expand macro="requirements"/>
     <expand macro="stdio"/>
-    
+
     <command><![CDATA[
         LANG=C Rscript $__tool_directory__/ipo4xcmsSet.r
 
-        #if $inputs.input == "zip_file":
-            zipfile $inputs.zip_file
-        #elif $inputs.input == "single_file":
-            singlefile_galaxyPath $inputs.single_file singlefile_sampleName $inputs.single_file.name
+        #if $input.is_of_type("mzxml") or $input.is_of_type("mzml") or $input.is_of_type("mzdata") or $input.is_of_type("netcdf"):
+            singlefile_galaxyPath '$input' singlefile_sampleName '$input.name'
+        #else
+            zipfile '$input'
         #end if
 
         parametersOutput $parametersOutput
@@ -23,51 +41,37 @@
 
         samplebyclass $samplebyclass
 
-        ## profmethod $profmethod 
+        ## profmethod $profmethod
         @COMMAND_NSLAVES@
-        method $methods.method 
+        method $methods.method
         #if $methods.method == "centWave":
-            ppm "c($methods.ppm)"
-            min_peakwidth "c($methods.min_peakwidth)"
-            max_peakwidth "c($methods.max_peakwidth)"
-            #if $methods.options_c.option == "show":
-                mzdiff "c($methods.options_c.mzdiff)"
-                snthresh "c($methods.options_c.snthresh)"
-                integrate "$methods.options_c.integrate"
-                noise "c($methods.options_c.noise)"
-                prefilter "c($methods.options_c.prefilter)"
-                prefilter_value "c($methods.options_c.prefilter_value)"
-            #end if
+            ppm "c($methods.section_centwave_optiomizable.conditional_parameter.ppm)"
+            min_peakwidth "c($methods.section_centwave_optiomizable.conditional_parameter.min_peakwidth)"
+            max_peakwidth "c($methods.section_centwave_optiomizable.conditional_parameter.max_peakwidth)"
+            mzdiff "c($methods.section_centwave_optiomizable.conditional_parameter.mzdiff)"
+
+            snthresh $methods.section_centwave_non_optiomizable.snthresh
+            integrate $methods.section_centwave_non_optiomizable.integrate
+            noise $methods.section_centwave_non_optiomizable.noise
+            prefilter "c($methods.section_centwave_non_optiomizable.prefilter)"
+
         #elif $methods.method == "matchedFilter":
-            step "c($methods.step)"
-            fwhm "c($methods.fwhm)"
-            #if $methods.options_m.option == "show":
-                sigma "c($methods.options_m.sigma)"
-                max "c($methods.options_m.max)"
-                snthresh "c($methods.options_m.snthresh)"
-                mzdiff "c($methods.options_m.mzdiff)"
-                steps "c($methods.options_m.steps)"
-            #end if
+            fwhm "c($methods.section_matchedfilter_optiomizable.conditional_parameter.fwhm)"
+            mzdiff "c($methods.section_matchedfilter_optiomizable.conditional_parameter.mzdiff)"
+
+            step $methods.section_matchedfilter_non_optimizable.step
+            steps $methods.section_matchedfilter_non_optimizable.steps
+            max $methods.section_matchedfilter_non_optimizable.max
+            snthresh $methods.section_matchedfilter_non_optimizable.snthresh
         #end if
 
-        @COMMAND_LOG_EXIT@ 
+        @COMMAND_LOG_EXIT@
     ]]></command>
-    
+
     <inputs>
 
-        <conditional name="inputs">
-            <param name="input" type="select" label="Choose your inputs method" >
-                <option value="zip_file" selected="true">Zip file from your history containing your chromatograms</option>
-                <option value="single_file">mzXML file from your history</option>
-            </param>
-            <when value="zip_file">
-                <param name="zip_file" type="data" format="no_unzip.zip,zip" label="Zip file" />
-            </when>
-            <when value="single_file">
-                <param name="single_file" type="data" format="mzxml" label="Single file" />
-            </when>
-        </conditional>
-        
+        <param name="input" type="data" format="mzxml,mzml,mzdata,netcdf,no_unzip.zip,zip" 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." />
+
         <param name="samplebyclass" type="integer" value="2" label="Number of samples used per class to estimate the best parameters" help="Set to 0 to use the whole dataset. To save time, reduce this number" />
 
         <conditional name="methods">
@@ -78,70 +82,126 @@
 
             <!-- centWave Filter options -->
             <when value="centWave">
-                <param name="ppm" type="text" value="17,32" label="Range for Max tolerated ppm m/z deviation in consecutive scans in ppm" optional="false" help="[ppm] (ex: 25 or 17,32)" />
-                <param name="min_peakwidth" type="text" value="12,18" label="Range for Min peak width range in seconds" optional="true" help="[min_peakwidth] (ex: 20 or 12,18)" />
-                <param name="max_peakwidth" type="text" value="35,65" label="Range for Max peak width range in seconds" optional="true" help="[max_peakwidth] (ex: 50 or 35,65)" />
-                <conditional name="options_c">
-                    <param name="option" type="select" label="Advanced options" >
-                        <option value="show">show</option>
-                        <option value="hide" selected="true">hide</option>
+                <section name="section_centwave_optiomizable"  title="Optimizable parameters" expanded="True">
+                    <conditional name="conditional_parameter">
+                        <param name="select_parameter" type="select" label="Which parameter do you want to optimize?" help="Only one paramter can be optimized at once. The other will require fixed values">
+                            <option value="ppm">Max tolerated ppm m/z deviation in consecutive scans in ppm [ppm]</option>
+                            <option value="peakwidth">Min,Max peak width in seconds [peakwidth]</option>
+                            <option value="mzdiff">Minimum difference in m/z for peaks with overlapping Retention Times [mzdiff]</option>
+                        </param>
+                        <when value="ppm">
+                            <param name="ppm" type="text" value="17,32" label="Range for Max tolerated ppm m/z deviation in consecutive scans in ppm" optional="false" help="[ppm] (ex: 25 or 17,32)">
+                                <validator type="regex" message="Should be this format XX,YY">[0-9]+,[0-9]+</validator>
+                            </param>
+                            <expand macro="centwave_peakwidth_fixed" />
+                            <expand macro="centwave_mzdiff_fixed" />
+                        </when>
+                        <when value="peakwidth">
+                            <param name="min_peakwidth" type="text" value="12,18" label="Range for Min peak width range in seconds" optional="true" help="[min_peakwidth] (ex: 12,18)">
+                                <validator type="regex" message="Should be one combinaison of those format: XX,YY or XX.XX,YY.YY">[0-9]+[\.]?[0-9]*,[0-9]+[\.]?[0-9]*</validator>
+                            </param>
+                            <param name="max_peakwidth" type="text" value="35,65" label="Range for Max peak width range in seconds" optional="true" help="[max_peakwidth] (ex: 35,65)">
+                                <validator type="regex" message="Should be one combinaison of those format: XX,YY or XX.XX,YY.YY">[0-9]+[\.]?[0-9]*,[0-9]+[\.]?[0-9]*</validator>
+                            </param>
+                            <expand macro="centwave_ppm_fixed" />
+                            <expand macro="centwave_mzdiff_fixed" />
+                        </when>
+                        <when value="mzdiff">
+                            <param name="mzdiff" type="text" value="-0.001,0.010" label="Range for Minimum difference in m/z for peaks with overlapping retention times" help="[mzdiff] Can be negative to allow overlap (ex: -0.001,0.010)">
+                                <validator type="regex" message="Should be one combinaison of those format: XX,YY or -XX,YY or XX.XX,YY.YY">[\-]?[0-9]+[\.]?[0-9]*,[\-]?[0-9]+[\.]?[0-9]*</validator>
+                            </param>
+                            <expand macro="centwave_ppm_fixed" />
+                            <expand macro="centwave_peakwidth_fixed" />
+                        </when>
+                    </conditional>
+                </section>
+
+                <section name="section_centwave_non_optiomizable"  title="Non optimizable parameters" expanded="True">
+                    <param name="snthresh" type="integer" value="10" label="Signal/Noise threshold" help="[snthresh] Signal to noise ratio cutoff" />
+                    <param name="integrate" type="select" label="Peak limits method" help="[integrate]" >
+                        <option value="1">peak limits based on smoothed 2nd derivative (less precise)</option>
+                        <option value="2">peak limits based on real data (more sensitive to noise)</option>
                     </param>
-                    <when value="show">
-                        <param name="snthresh" type="text" value="10" label="Range for Signal/Noise threshold" help="[snthresh] Signal to noise ratio cutoff (ex: 10 or 5,15)" />
-                        <param name="mzdiff" type="text" value="-0.001,0.010" label="Range for Min m/z difference" help="[mzdiff] Min m/z difference for peaks with overlapping RT (ex: -0.001 or -0.001,0.010)" />
-                        <!-- @TODO multiple="true" -->
-                        <param name="integrate" type="select" label="Peak limits method" help="[integrate]" >
-                            <option value="1">1 - peak limits based on smoothed 2nd derivative (less precise)</option>
-                            <option value="2">2 - peak limits based on real data (more sensitive to noise)</option>
-                        </param>
-                        <param name="prefilter" type="text" value="3" label="Range for the k value for the Prefilter step for the first phase" help="[prefilter] Mass traces are only retained if they contain at least ‘k’ peaks with intensity >= ‘I’ (ex: 3 or 2,3)"/>
-                        <param name="prefilter_value" type="text" value="100" label="Range for the I value for the Prefilter step for the first phase" help="[prefilter_value] Mass traces are only retained if they contain at least ‘k’ peaks with intensity >= ‘I’ (ex: 100 or 95,105)"/>
-                        <param name="noise" type="text" value="0" label="Range for the Noise filter" help="[noise] optional argument which is useful for data that was centroided without any intensity threshold, centroids with intensity smaller than ‘noise’ are omitted from ROI detection (ex: 0 or 0,0.1)"/>
-                    </when>
-                    <when value="hide" />
-                </conditional>
+                    <param name="prefilter" type="text" value="3,100" label="Prefilter step for the first phase" help="[prefilter] Separate by coma k,I. Mass traces are only retained if they contain at least ‘k’ peaks with intensity >= ‘I’"/>
+                    <param name="noise" type="integer" value="0" label="Noise filter" help="[noise] optional argument which is useful for data that was centroided without any intensity threshold, centroids with intensity smaller than ‘noise’ are omitted from ROI detection"/>
+                </section>
             </when>
 
             <!-- matched Filter options -->
             <when value="matchedFilter">
-                <param name="step" type="text" value="0.05,0.15" label="Range for Step size to use for profile generation" optional="true" help="[step] The peak detection algorithm creates extracted ion base peak chromatograms (EIBPC) on a fixed step size (ex: 0.1 or 0.05,0.15)" />
-                <param name="fwhm" type="text" value="25,35" label="Range for Full width at half maximum of matched filtration gaussian model peak" optional="true" help="[fwhm] Only used to calculate the actual sigma (ex: 30 or 25,35)" />
-                <conditional name="options_m">
-                    <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="sigma" type="text" value="0" label="sigma" help="Range for standard deviation (fwhm/2.3548) (ex: 0 or 0,1)" />
-                        <param name="max" type="text" value="5" label="Range for Maximum number of peaks per extracted ion chromatogram" help="[max] (ex: 5 or 4,6)" />
-                        <param name="snthresh" type="text" value="3,17" label="Range for Signal to noise ratio cutoff" help="[snthresh] (ex: 10 or 3,17)" />
-                        <param name="steps" type="text" value="1,3" label="Range for Number of steps to merge prior to filtration" help="[steps] The peak identification algorithm combines a given number of EIBPCs prior to filtration and peak detection, as defined by the steps argument (ex: 2 or 1,3)" />
-                        <param name="mzdiff" type="text" value="0" label="m/z difference" help="Range for min m/z difference for peaks with overlapping RT (0.8-step*steps) (ex: 2 or 1,3)" />
-                    </when>
-                    <when value="hide" />
-                </conditional>
+                <section name="section_matchedfilter_optiomizable"  title="Optimizable parameters" expanded="True">
+                    <conditional name="conditional_parameter">
+                        <param name="select_parameter" type="select" label="Which parameter do you want to optimize?" help="Only one paramter can be optimized at once. The other will require fixed values">
+                            <option value="fwhm">Full width at half maximum of matched filtration gaussian model peak [fwhm]</option>
+                            <option value="mzdiff">Minimum difference in m/z for peaks with overlapping Retention Times [mzdiff]</option>
+                        </param>
+                        <when value="fwhm">
+                            <param name="fwhm" type="text" value="25,35" label="Range for Full width at half maximum of matched filtration gaussian model peak" optional="true" help="[fwhm] Only used to calculate the actual sigma (ex: 25,35)">
+                                <validator type="regex" message="Should be this format: XX,YY">[0-9]+,[0-9]+</validator>
+                            </param>
+                            <expand macro="matchedfilter_mzdiff_fixed" />
+                        </when>
+                        <when value="mzdiff">
+                            <param name="mzdiff" type="text" value="0.4,0.7" label="Range for Minimum difference in m/z for peaks with overlapping Retention Times" help="[mzdiff] By default: 0.8-step*steps (ex: 0.4,0.7)">
+                                <validator type="regex" message="Should be one combinaison of those format: XX,YY or -XX,YY or XX.XX,YY.YY">[\-]?[0-9]+[\.]?[0-9]*,[\-]?[0-9]+[\.]?[0-9]*</validator>
+                            </param>
+                            <expand macro="matchedfilter_fwhm_fixed" />
+                        </when>
+                    </conditional>
+                </section>
+
+                <section name="section_matchedfilter_non_optimizable" title="Non optimizable parameters"  expanded="True">
+                    <param name="step" type="float" value="0.1" label="Step size to use for profile generation" help="[step] The peak detection algorithm creates extracted ion base peak chromatograms (EIBPC) on a fixed step size" />
+                    <param name="steps" type="integer" value="2" label="Number of steps to merge prior to filtration" help="[steps] The peak identification algorithm combines a given number of EIBPCs prior to filtration and peak detection, as defined by the steps argument" />
+                    <param name="max" type="integer" value="5" label="Maximum number of peaks per extracted ion chromatogram" help="[max]" />
+                    <param name="snthresh" type="integer" value="10" label="Signal to noise ratio cutoff" help="[snthresh]" />
+                </section>
             </when>
-        </conditional>       
+        </conditional>
 
 
     </inputs>
-    
+
     <outputs>
         <data name="xsetRData" format="rdata.xcms.raw" label="xset.RData" />
         <data name="parametersOutput" format="tabular" label="IPO_parameters4xcmsSet.tsv" />
         <data name="log" format="txt" label="ipo4xcmsSet.log.txt" />
     </outputs>
-    
+
     <tests>
         <test>
-            <param name="inputs|input" value="single_file" />
-            <param name="inputs|single_file" value="MM14.mzML"  ftype="mzxml" />
+            <param name="input" value="MM14.mzML"  ftype="mzxml" />
             <param name="samplebyclass" value="0" />
-            <param name="methods|method" value="centWave" />
-            <param name="methods|ppm" value="56" />
-            <param name="methods|min_peakwidth" value="3,9.5" />
-            <param name="methods|max_peakwidth" value="10,20" />
-            <output name="parametersOutput" file="MM14_IPO_parameters4xcmsSet.tsv" />
+            <conditional name="methods">
+                <param name="method" value="centWave" />
+                <section name="section_centwave_optiomizable" >
+                    <conditional name="conditional_parameter">
+                        <param name="select_parameter" value="peakwidth" />
+                        <param name="min_peakwidth" value="3,9.5" />
+                        <param name="max_peakwidth" value="10,20" />
+                        <param name="ppm" value="56" />
+                        <param name="mzdiff" value="-0.001" />
+                    </conditional>
+                </section>
+            </conditional>
+            <output name="parametersOutput" file="MM14_IPO_parameters4xcmsSet_peakwidth.tsv" />
+        </test>
+        <test>
+            <param name="input" value="MM14.mzML"  ftype="mzxml" />
+            <param name="samplebyclass" value="0" />
+            <conditional name="methods">
+                <param name="method" value="centWave" />
+                <section name="section_centwave_optiomizable" >
+                    <conditional name="conditional_parameter">
+                        <param name="select_parameter" value="ppm" />
+                        <param name="ppm" value="50,60" />
+                        <param name="min_peakwidth" value="3.325" />
+                        <param name="max_peakwidth" value="11" />
+                        <param name="mzdiff" value="-0.001" />
+                    </conditional>
+                </section>
+            </conditional>
+            <output name="parametersOutput" file="MM14_IPO_parameters4xcmsSet_ppm.tsv" />
         </test>
         <!-- Too long for Travis CI -->
         <!--<test>
@@ -165,7 +225,7 @@
             <output name="parametersOutput" file="sacuri_2files_matchedFilter_IPO_parameters4xcmsSet.tsv" />
         </test>-->
         <!--Failed:
-                Error in resultIncreased(history) : 
+                Error in resultIncreased(history) :
                         No isotopes have been detected, peak picking not optimizable by IPO!-->
         <!--<test>
             <param name="inputs|input" value="zip_file" />
@@ -178,7 +238,7 @@
             <output name="parametersOutput" file="faahKO_IPO_parameters4xcmsSet.tsv" />
         </test>-->
     </tests>
-    
+
     <help><![CDATA[
 
 @HELP_AUTHORS@
@@ -203,7 +263,7 @@
 ========================= ================= ======= =========
 Name                      output file       format  parameter
 ========================= ================= ======= =========
-NA                        NA                zip     NA       
+NA                        NA                zip     NA
 ========================= ================= ======= =========
 
 
@@ -289,7 +349,7 @@
 
 **Matched Filter**
 
-    | One parameter to consider is the Gaussian model peak width used for matched filtration,an integral part of the peak detection algorithm. 
+    | One parameter to consider is the Gaussian model peak width used for matched filtration,an integral part of the peak detection algorithm.
     | For a discussion of how model peak width affects the signal to noise ratio, see Danielsson et al. (2002).
 
 
--- a/macros.xml	Thu Mar 30 11:27:09 2017 -0400
+++ b/macros.xml	Wed Apr 12 08:53:04 2017 -0400
@@ -33,41 +33,50 @@
     <!-- zipfile load for planemo test -->
 
     <token name="@COMMAND_FILE_LOAD@">
-        #if $file_load_conditional.file_load_select == "yes":
-            #if $file_load_conditional.inputs.input == "zip_file":
-                zipfile $file_load_conditional.inputs.zip_file
+        #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
-                #set singlefile_galaxyPath = ','.join( [ str( $single_file ) for $single_file in $file_load_conditional.inputs.single_file ] )
-                #set singlefile_sampleName = ','.join( [ str( $single_file.name ) for $single_file in $file_load_conditional.inputs.single_file ] )
-
-                singlefile_galaxyPath $singlefile_galaxyPath singlefile_sampleName $singlefile_sampleName
+                zipfile '$file_load_section.file_load_conditional.input'
             #end if
         #end if
     </token>
 
-    <xml name="file_load">
-        <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">
-                <conditional name="inputs">
-                    <param name="input" type="select" label="Choose your inputs method" >
-                        <option value="zip_file" selected="true">Zip file from your history containing your chromatograms</option>
-                        <option value="single_file">A mzXML or netCDF file from your history</option>
-                    </param>
-                    <when value="zip_file">
-                        <param name="zip_file" type="data" format="no_unzip.zip,zip" label="Zip file" />
-                    </when>
-                    <when value="single_file">
-                        <param name="single_file" type="data" format="mzxml,netcdf" label="Single file"  multiple="true"/>
-                    </when>
-                </conditional>
-            </when>
-        </conditional>
+    <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="@HELP_AUTHORS@">
--- a/test-data/MM14_IPO_parameters4xcmsSet.tsv	Thu Mar 30 11:27:09 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-min_peakwidth	5.275
-max_peakwidth	13.5
-mzdiff	0.01
-ppm	56
-snthresh	10
-noise	0
-prefilter	3
-value_of_prefilter	100
-mzCenterFun	wMean
-integrate	1
-fitgauss	FALSE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/MM14_IPO_parameters4xcmsSet_peakwidth.tsv	Wed Apr 12 08:53:04 2017 -0400
@@ -0,0 +1,11 @@
+min_peakwidth	3.325
+max_peakwidth	11
+prefilter	3
+ppm	56
+mzdiff	-0.001
+snthresh	10
+integrate	1
+noise	0
+value_of_prefilter	100
+mzCenterFun	wMean
+fitgauss	FALSE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/MM14_IPO_parameters4xcmsSet_ppm.tsv	Wed Apr 12 08:53:04 2017 -0400
@@ -0,0 +1,11 @@
+ppm	60
+prefilter	3
+min_peakwidth	3.325
+max_peakwidth	11
+mzdiff	-0.001
+snthresh	10
+integrate	1
+noise	0
+value_of_prefilter	100
+mzCenterFun	wMean
+fitgauss	FALSE
--- a/test-data/faahKO_IPO_parameters4retgroup_bw.tsv	Thu Mar 30 11:27:09 2017 -0400
+++ b/test-data/faahKO_IPO_parameters4retgroup_bw.tsv	Wed Apr 12 08:53:04 2017 -0400
@@ -1,13 +1,13 @@
 bw	4.168192
-span	0.22
+mzwid	0.25
 minfrac	1
-mzwid	0.25
+max	50
 retcorMethod	loess
 smooth	loess
 extra	1
 missing	1
+span	0.2
 family	gaussian
 plottype	none
 minsamp	1
-max	50
 center	2