changeset 37:9ada611dd63f draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 3922356e5edae763800a4311146e2fdeb52c296e
author lecorguille
date Fri, 31 Aug 2018 08:59:03 -0400
parents d39b9aff9cf7
children e66eeca443e4
files abims_xcms_xcmsSet.xml lib.r test-data/faahKO.raw.RData test-data/faahKO.raw.Rdata test-data/ko15-raw.RData test-data/ko15-raw.Rdata test-data/ko16-raw.Rdata test-data/ko16.CDF test-data/wt15-raw.Rdata test-data/wt15.CDF test-data/wt16-raw.Rdata test-data/wt16.CDF xcms_xcmsSet.r
diffstat 13 files changed, 67 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/abims_xcms_xcmsSet.xml	Thu Apr 05 18:05:45 2018 -0400
+++ b/abims_xcms_xcmsSet.xml	Fri Aug 31 08:59:03 2018 -0400
@@ -46,14 +46,14 @@
         #elif $methods.method == "MatchedFilter":
             fwhm $methods.fwhm
             binSize $methods.binSize
-            impute $methods.impute_cond.impute
-            #if $methods.impute_cond.impute == "linbase":
-                #if $methods.impute_cond.baseValue != "":
-                    baseValue $methods.impute_cond.baseValue
+            ## Advanced
+            impute $methods.MatchedFilterAdv.impute_cond.impute
+            #if $methods.MatchedFilterAdv.impute_cond.impute == "linbase":
+                #if $methods.MatchedFilterAdv.impute_cond.baseValue != "":
+                    baseValue $methods.MatchedFilterAdv.impute_cond.baseValue
                 #end if
-                distance $methods.impute_cond.distance
+                distance $methods.MatchedFilterAdv.impute_cond.distance
             #end if
-            ## Advanced
             #if $methods.MatchedFilterAdv.sigma != "":
                 sigma $methods.MatchedFilterAdv.sigma
             #end if
@@ -113,22 +113,22 @@
             <when value="MatchedFilter">
                 <param argument="fwhm" type="integer" value="30" label="Full width at half maximum of matched filtration gaussian model peak" help="Only used to calculate the actual sigma" />
                 <param argument="binSize" type="float" value="0.1" label="Step size to use for profile generation" help="The peak detection algorithm creates extracted ion base peak chromatograms (EIBPC) on a fixed step size. (Previously step)" />
-                <conditional name="impute_cond">
-                    <param argument="impute" type="select" label="Method to be used for missing value imputation" help="(previously profmethod)">
-                        <option value="none">none - no linear interpolation</option>
-                        <option value="lin">lin - linear interpolation</option>
-                        <option value="linbase">linbase - linear interpolation within a certain bin-neighborhood</option>
-                        <option value="intlin">intlin - integral of the linearly interpolated data from plus to minus half the step size</option>
-                    </param>
-                    <when value="none" />
-                    <when value="lin" />
-                    <when value="linbase">
-                        <param argument="baseValue" type="float" value="" optional="true" label="The base value to which empty elements should be set" help="The default for the ‘baseValue’ is half of the smallest value in ‘x’ (‘NA’s being removed)." />
-                        <param argument="distance" type="integer" value="0" label="Number of non-empty neighboring element of an empty element that should be considered for linear interpolation." />
-                    </when>
-                    <when value="intlin" />
-                </conditional>
                 <section name="MatchedFilterAdv" title="Advanced Options" expanded="False">
+                    <conditional name="impute_cond">
+                        <param argument="impute" type="select" label="Method to be used for missing value imputation" help="(previously profmethod)">
+                            <option value="none">none - no linear interpolation</option>
+                            <option value="lin">lin - linear interpolation</option>
+                            <option value="linbase">linbase - linear interpolation within a certain bin-neighborhood</option>
+                            <option value="intlin">intlin - integral of the linearly interpolated data from plus to minus half the step size</option>
+                        </param>
+                        <when value="none" />
+                        <when value="lin" />
+                        <when value="linbase">
+                            <param argument="baseValue" type="float" value="" optional="true" label="The base value to which empty elements should be set" help="The default for the ‘baseValue’ is half of the smallest value in ‘x’ (‘NA’s being removed)." />
+                            <param argument="distance" type="integer" value="0" label="Number of non-empty neighboring element of an empty element that should be considered for linear interpolation." />
+                        </when>
+                        <when value="intlin" />
+                    </conditional>
                     <param argument="sigma" type="float" value="" optional="true" label="Standard deviation (width) of matched filtration model peak" help="Leave it to empty to calculate it using fwhm by default at fwhm/2.3548" />
                     <param argument="max" type="integer" value="5" label="Maximum number of peaks that are expected/will be identified per slice" />
                     <param argument="snthresh" type="integer" value="10" label="Signal to Noise ratio cutoff" help="defining the signal to noise cutoff to be used in the chromatographic peak detection step" />
@@ -218,7 +218,7 @@
             </assert_stdout>
         </test>-->
         <test>
-            <param name="image" value="ko15-raw.Rdata" ftype="rdata" />
+            <param name="image" value="ko15-raw.RData" ftype="rdata" />
             <conditional name="methods">
                 <param name="method" value="CentWave" />
                 <param name="ppm" value="25" />
@@ -237,9 +237,9 @@
             </assert_stdout>
         </test>
         <!-- DISABLE FOR TRAVIS
-        Useful to generate test-data for the further steps -->
+        Useful to generate test-data for the further steps
         <test>
-            <param name="image" value="ko16-raw.Rdata" ftype="rdata" />
+            <param name="image" value="ko16-raw.RData" ftype="rdata" />
             <conditional name="methods">
                 <param name="method" value="CentWave" />
                 <param name="ppm" value="25" />
@@ -255,7 +255,7 @@
             </assert_stdout>
         </test>
         <test>
-            <param name="image" value="wt15-raw.Rdata" ftype="rdata" />
+            <param name="image" value="wt15-raw.RData" ftype="rdata" />
             <conditional name="methods">
                 <param name="method" value="CentWave" />
                 <param name="ppm" value="25" />
@@ -271,7 +271,7 @@
             </assert_stdout>
         </test>
         <test>
-            <param name="image" value="wt16-raw.Rdata" ftype="rdata" />
+            <param name="image" value="wt16-raw.RData" ftype="rdata" />
             <conditional name="methods">
                 <param name="method" value="CentWave" />
                 <param name="ppm" value="25" />
@@ -286,19 +286,21 @@
                 <has_text text="Sample classes: ." />
             </assert_stdout>
         </test>
-        
+        -->
         <!-- DISABLE FOR TRAVIS
         Test to test the different methods parameters
         <test>
-            <param name="image" value="ko15-raw.Rdata" ftype="rdata" />
+            <param name="image" value="ko15-raw.RData" ftype="rdata" />
             <conditional name="methods">
                 <param name="method" value="MatchedFilter" />
                 <param name="fwhm" value="35" />
-                <conditional name="impute_cond">
-                    <param name="impute" value="linbase" />
-                    <param name="baseValue" value="0.1" />
-                    <param name="distance" value="1" />
-                </conditional>
+                <section name="MatchedFilterAdv"
+                    <conditional name="impute_cond">
+                        <param name="impute" value="linbase" />
+                        <param name="baseValue" value="0.1" />
+                        <param name="distance" value="1" />
+                    </conditional>
+                </section>
             </conditional>
             <assert_stdout>
                 <has_text text="fwhm: 35" />
@@ -308,7 +310,7 @@
             </assert_stdout>
         </test>
         <test>
-            <param name="image" value="ko15-raw.Rdata" ftype="rdata" />
+            <param name="image" value="ko15-raw.RData" ftype="rdata" />
             <conditional name="methods">
                 <param name="method" value="CentWavePredIso" />
                 <param name="ppm" value="56" />
@@ -323,7 +325,7 @@
             </assert_stdout>
         </test>
         <test>
-            <param name="image" value="ko15-raw.Rdata" ftype="rdata" />
+            <param name="image" value="ko15-raw.RData" ftype="rdata" />
             <conditional name="methods">
                 <param name="method" value="MSW" />
                 <param name="snthresh" value="4" />
@@ -479,7 +481,7 @@
 
 xset.RData: rdata.xcms.findchrompeaks format
 
-    | Rdata file that is necessary in the second step of the workflow "xcms.group".
+    | RData file that is necessary in the second step of the workflow "xcms.group".
 
 ---------------------------------------------------
 
--- a/lib.r	Thu Apr 05 18:05:45 2018 -0400
+++ b/lib.r	Fri Aug 31 08:59:03 2018 -0400
@@ -391,38 +391,31 @@
 
 # This function get the raw file path from the arguments
 #@author Gildas Le Corguille lecorguille@sb-roscoff.fr
-getRawfilePathFromArguments <- function(singlefile, zipfile, args) {
-    if (!is.null(args$zipfile))           zipfile <- args$zipfile
-    if (!is.null(args$zipfilePositive))   zipfile <- args$zipfilePositive
-    if (!is.null(args$zipfileNegative))   zipfile <- args$zipfileNegative
+getRawfilePathFromArguments <- function(singlefile, zipfile, args, prefix="") {
+  if (!(prefix %in% c("","Positive","Negative","MS1","MS2"))) stop("prefix must be either '', 'Positive', 'Negative', 'MS1' or 'MS2'")
+
+  if (!is.null(args[[paste0("zipfile",prefix)]])) zipfile <- args[[paste0("zipfile",prefix)]]
 
-    if (!is.null(args$singlefile_galaxyPath)) {
-        singlefile_galaxyPaths <- args$singlefile_galaxyPath;
-        singlefile_sampleNames <- args$singlefile_sampleName
-    }
-    if (!is.null(args$singlefile_galaxyPathPositive)) {
-        singlefile_galaxyPaths <- args$singlefile_galaxyPathPositive;
-        singlefile_sampleNames <- args$singlefile_sampleNamePositive
+  if (!is.null(args[[paste0("singlefile_galaxyPath",prefix)]])) {
+    singlefile_galaxyPaths <- args[[paste0("singlefile_galaxyPath",prefix)]]
+    singlefile_sampleNames <- args[[paste0("singlefile_sampleName",prefix)]]
+  }
+  if (exists("singlefile_galaxyPaths")){
+    singlefile_galaxyPaths <- unlist(strsplit(singlefile_galaxyPaths,"\\|"))
+    singlefile_sampleNames <- unlist(strsplit(singlefile_sampleNames,"\\|"))
+
+    singlefile <- NULL
+    for (singlefile_galaxyPath_i in seq(1:length(singlefile_galaxyPaths))) {
+      singlefile_galaxyPath <- singlefile_galaxyPaths[singlefile_galaxyPath_i]
+      singlefile_sampleName <- singlefile_sampleNames[singlefile_galaxyPath_i]
+      # In case, an url is used to import data within Galaxy 
+      singlefile_sampleName <- tail(unlist(strsplit(singlefile_sampleName,"/")), n=1)
+      singlefile[[singlefile_sampleName]] <- singlefile_galaxyPath
     }
-    if (!is.null(args$singlefile_galaxyPathNegative)) {
-        singlefile_galaxyPaths <- args$singlefile_galaxyPathNegative;
-        singlefile_sampleNames <- args$singlefile_sampleNameNegative
-    }
-    if (exists("singlefile_galaxyPaths")){
-        singlefile_galaxyPaths <- unlist(strsplit(singlefile_galaxyPaths,"\\|"))
-        singlefile_sampleNames <- unlist(strsplit(singlefile_sampleNames,"\\|"))
-
-        singlefile <- NULL
-        for (singlefile_galaxyPath_i in seq(1:length(singlefile_galaxyPaths))) {
-            singlefile_galaxyPath <- singlefile_galaxyPaths[singlefile_galaxyPath_i]
-            singlefile_sampleName <- singlefile_sampleNames[singlefile_galaxyPath_i]
-            singlefile[[singlefile_sampleName]] <- singlefile_galaxyPath
-        }
-    }
-    return(list(zipfile=zipfile, singlefile=singlefile))
+  }
+  return(list(zipfile=zipfile, singlefile=singlefile))
 }
 
-
 # This function retrieve the raw file in the working directory
 #   - if zipfile: unzip the file with its directory tree
 #   - if singlefiles: set symlink with the good filename
@@ -480,7 +473,10 @@
     if (class(xobject) == "XCMSnExp") {
         # Get the legacy xcmsSet object
         suppressWarnings(xset <- as(xobject, 'xcmsSet'))
-        sampclass(xset) <- xset@phenoData$sample_group
+        if (!is.null(xset@phenoData$sample_group))
+            sampclass(xset) <- xset@phenoData$sample_group
+        else
+            sampclass(xset) <- "."
         return (xset)
     }
 }
Binary file test-data/faahKO.raw.RData has changed
Binary file test-data/faahKO.raw.Rdata has changed
Binary file test-data/ko15-raw.RData has changed
Binary file test-data/ko15-raw.Rdata has changed
Binary file test-data/ko16-raw.Rdata has changed
Binary file test-data/ko16.CDF has changed
Binary file test-data/wt15-raw.Rdata has changed
Binary file test-data/wt15.CDF has changed
Binary file test-data/wt16-raw.Rdata has changed
Binary file test-data/wt16.CDF has changed
--- a/xcms_xcmsSet.r	Thu Apr 05 18:05:45 2018 -0400
+++ b/xcms_xcmsSet.r	Fri Aug 31 08:59:03 2018 -0400
@@ -83,6 +83,10 @@
 if (exists("filterAcquisitionNumParam"))  raw_data <- filterAcquisitionNum(raw_data, filterAcquisitionNumParam[1]:filterAcquisitionNumParam[2])
 if (exists("filterRtParam")) raw_data <- filterRt(raw_data, filterRtParam)
 if (exists("filterMzParam")) raw_data <- filterMz(raw_data, filterMzParam)
+#Apply this filter only if file contain MS and MSn
+if(length(unique(msLevel(raw_data)))!= 1){
+	raw_data <- filterMsLevel(raw_data,msLevel=1)
+}
 
 cat("\t\t\tChromatographic peak detection\n")
 # clear the arguement list to remove unexpected key/value as singlefile_galaxyPath or method ...