changeset 31:eb15a3841da4 draft

"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 42a0bcde81726702194f1b4ecd741d0545648d40"
author workflow4metabolomics
date Tue, 28 Apr 2020 09:35:10 -0400
parents 14b1c52fae62
children b02d1992a43a
files abims_xcms_xcmsSet.xml lib.r macros_xcms.xml xcms_xcmsSet.r
diffstat 4 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/abims_xcms_xcmsSet.xml	Wed Feb 12 08:30:58 2020 -0500
+++ b/abims_xcms_xcmsSet.xml	Tue Apr 28 09:35:10 2020 -0400
@@ -1,4 +1,4 @@
-<tool id="abims_xcms_xcmsSet" name="xcms findChromPeaks (xcmsSet)" version="@TOOL_VERSION@+galaxy0">
+<tool id="abims_xcms_xcmsSet" name="xcms findChromPeaks (xcmsSet)" version="@TOOL_VERSION@+galaxy1">
     <description>Chromatographic peak detection</description>
 
     <macros>
@@ -30,6 +30,7 @@
 
         #if $methods.method == "CentWave":
             @COMMAND_CENTWAVE@
+            peaklist $methods.CentWaveAdv.peaklist
             ## List of regions-of-interest (ROI)
             #set $sectionROI = $methods.CentWaveAdv.CentWaveAdvROI
             @COMMAND_CENTWAVEADVROI@
@@ -61,6 +62,7 @@
             snthresh $methods.MatchedFilterAdv.snthresh
             steps $methods.MatchedFilterAdv.steps
             mzdiff $methods.MatchedFilterAdv.mzdiff
+            peaklist $methods.MatchedFilterAdv.peaklist
         #elif $methods.method == "MSW":
             snthresh $methods.snthresh
             verboseColumns $methods.verboseColumns
@@ -103,6 +105,7 @@
                 <expand macro="input_centwave"/>
                 <section name="CentWaveAdv" title="Advanced Options" expanded="False">
                     <expand macro="input_centwaveAdv"/>
+                    <param argument="peaklist" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Get a list of found chromatographic peaks" help="Generates a tabular file with all the chromatographic peaks obtained." />
                     <section name="CentWaveAdvROI" title="List of regions-of-interest (ROI)" expanded="False">
                         <expand macro="input_centwaveAdvROI"  optional="true"/>
                     </section>
@@ -134,6 +137,7 @@
                     <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" />
                     <param argument="steps" type="integer" value="2" label="Number of bins to be merged before filtration" help="(i.e. the number of neighboring bins that will be joined to the slice in which filtration and peak detection will be performed)" />
                     <param argument="mzdiff" type="float" value="0.6" label="Minimum difference in m/z for peaks with overlapping Retention Times" help="By default: 0.8-binSize*steps " />
+                    <param argument="peaklist" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Get a list of found chromatographic peaks" help="Generates a tabular file with all the chromatographic peaks obtained." />
                     <!-- index -->
                 </section>
             </when>
@@ -183,6 +187,12 @@
     <outputs>
         <data name="xsetRData" format="rdata.xcms.findchrompeaks" label="${image.name.rsplit('.',1)[0]}.xset.RData" from_work_dir="xcmsSet.RData" />
         <data name="log" format="txt" label="${image.name.rsplit('.',1)[0]}.xset.log.txt" from_work_dir="log.txt" />
+        <data name="peaklist_out1" format="tabular" label="${image.name[:-6]}.chromPeak_table.tsv" from_work_dir="chromPeak_table.tsv" >
+            <filter>methods['method'] == 'CentWave' and (methods['CentWaveAdv']['peaklist'])</filter>
+        </data>
+        <data name="peaklist_out2" format="tabular" label="${image.name[:-6]}.chromPeak_table.tsv" from_work_dir="chromPeak_table.tsv" >
+            <filter>methods['method'] == 'MatchedFilter' and (methods['MatchedFilterAdv']['peaklist'])</filter>
+        </data>
     </outputs>
 
     <tests>
@@ -492,6 +502,11 @@
 
 .. _News: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS
 
+**Version 3.6.1+galaxy1 - 22/04/2020**
+
+- NEW: possibility to get a tabular file with all the chromatographic peaks obtained with the CentWave and MatchedFilter methods. 
+
+
 @HELP_XCMS_NEWVERSION_3610@
 
 **Version 3.4.4.1 - 30/04/2019**
--- a/lib.r	Wed Feb 12 08:30:58 2020 -0500
+++ b/lib.r	Tue Apr 28 09:35:10 2020 -0400
@@ -151,12 +151,14 @@
 
     group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")
     names(group_colors) <- unique(xdata$sample_group)
+    col_per_samp <- as.character(xdata$sample_group)
+    for(i in 1:length(group_colors)){col_per_samp[col_per_samp==(names(group_colors)[i])]<-group_colors[i]}
 
     xlim <- c(min(featureDefinitions(xdata)$rtmin), max(featureDefinitions(xdata)$rtmax))
     for (i in 1:nrow(featureDefinitions(xdata))) {
         mzmin = featureDefinitions(xdata)[i,]$mzmin
         mzmax = featureDefinitions(xdata)[i,]$mzmax
-        plotChromPeakDensity(xdata, param = param, mz=c(mzmin,mzmax), col=group_colors, pch=16, xlim=xlim, main=paste(round(mzmin,mzdigit),round(mzmax,mzdigit)))
+        plotChromPeakDensity(xdata, param = param, mz=c(mzmin,mzmax), col=col_per_samp, pch=16, xlim=xlim, main=paste(round(mzmin,mzdigit),round(mzmax,mzdigit)))
         legend("topright", legend=names(group_colors), col=group_colors, cex=0.8, lty=1)
     }
 
--- a/macros_xcms.xml	Wed Feb 12 08:30:58 2020 -0500
+++ b/macros_xcms.xml	Tue Apr 28 09:35:10 2020 -0400
@@ -98,7 +98,7 @@
                   <option value="maxo">maxo</option>
                   <option value="intb">intb</option>
               </param>
-              <param name="naTOzero" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="Replace the remain NA by 0 in the dataMatrix" help="Rather mandatory for some downstream statistical steps"/>
+              <param name="naTOzero" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="If NA values remain, replace them by 0 in the dataMatrix" help="Mandatory for some of the downstream tools (data processing, statistics) that do not accept NA values"/>
     </xml>
 
     <xml name="input_peaklist_section">
@@ -193,7 +193,7 @@
             <option value="wMean">intensity weighted mean of the peak's m/z values</option>
             <option value="mean">mean of the peak's m/z values</option>
             <option value="apex">use the m/z value at the peak apex</option>
-            <option value="wMeanApex3">ntensity weighted mean of the m/z value at the peak apex and the m/z values left and right of it</option>
+            <option value="wMeanApex3">intensity weighted mean of the m/z value at the peak apex and the m/z values left and right of it</option>
             <option value="meanApex3">mean of the m/z value of the peak apex and the m/z values left and right of it</option>
         </param>
         <param argument="integrate" type="select" label="Integration method" >
--- a/xcms_xcmsSet.r	Wed Feb 12 08:30:58 2020 -0500
+++ b/xcms_xcmsSet.r	Tue Apr 28 09:35:10 2020 -0400
@@ -40,6 +40,7 @@
 if (!is.null(args$filterAcquisitionNum)) filterAcquisitionNumParam <- args$filterAcquisitionNum
 if (!is.null(args$filterRt)) filterRtParam <- args$filterRt
 if (!is.null(args$filterMz)) filterMzParam <- args$filterMz
+if (!is.null(args$peaklist)) peaklistParam <- args$peaklist
 
 method <- args$method
 
@@ -100,6 +101,14 @@
 #chromTIC = chromatogram(xdata, aggregationFun = "sum")
 #chromBPI = chromatogram(xdata, aggregationFun = "max")
 
+# Create a chromPeaks table if required
+if (exists("peaklistParam")) {
+    if(peaklistParam){
+      cat("\nCreating the chromatographic peaks' table...\n")
+      write.table(chromPeaks(xdata), file="chromPeak_table.tsv",sep="\t",quote=F,row.names=F)
+	}
+}
+
 cat("\n\n")
 
 # ----- EXPORT -----