changeset 4:c6b47c89a2f5 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/MALDIquant commit ecdc3a64aa245d80dbc5487b2bf10a85a43adc6d
author galaxyp
date Fri, 22 Mar 2019 08:30:45 -0400
parents c42549f04fdd
children af766257766e
files maldi_quant_peakdetection.xml
diffstat 1 files changed, 43 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/maldi_quant_peakdetection.xml	Fri Feb 15 10:14:01 2019 -0500
+++ b/maldi_quant_peakdetection.xml	Fri Mar 22 08:30:45 2019 -0400
@@ -1,4 +1,4 @@
-<tool id="maldi_quant_peak_detection" name="MALDIquant peak detection" version="@VERSION@.3">
+<tool id="maldi_quant_peak_detection" name="MALDIquant peak detection" version="@VERSION@.4">
     <description>
         Peak detection, binning and filtering for mass-spectrometry imaging data
     </description>
@@ -128,10 +128,12 @@
 ## plot input file spectrum: 
 #if $centroids:
     ## Choose random spectra for QC plots
+    print(length(peaks))
     random_spectra = sample(1:length(peaks), 4, replace=FALSE)
+    random_spectra_name = pixelnames[random_spectra]
     par(mfrow = c(2, 2), oma=c(0,0,2,0))
     for (random_sample in random_spectra){
-        plot(peaks[[random_sample]],sub="", main=paste0("spectrum ", random_sample))}
+        plot(peaks[[random_sample]],sub="", main=paste0("spectrum ", pixelnames[random_sample]))}
     title("Input spectra", outer=TRUE, line=0)
 
 #else
@@ -139,7 +141,8 @@
     random_spectra = sample(1:length(maldi_data), 4, replace=FALSE)
     par(mfrow = c(2, 2), oma=c(0,0,2,0))
     for (random_sample in random_spectra){
-        plot(maldi_data[[random_sample]],sub="", main=paste0("spectrum ", random_sample))}
+        plot(maldi_data[[random_sample]],sub="", main=paste0("spectrum ", pixelnames[random_sample]))
+    }
     title("Input spectra", outer=TRUE, line=0)
 #end if
 
@@ -223,7 +226,7 @@
         par(mfrow = c(2, 2), oma=c(0,0,2,0))
         for (random_sample in random_spectra){
             noise = estimateNoise(maldi_data[[random_sample]], method= "$method.methods_conditional.peak_method")
-            plot(maldi_data[[random_sample]], sub="", main=paste0("spectrum ", random_sample))
+            plot(maldi_data[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))
             lines(noise[,1], noise[,2]*$method.methods_conditional.snr, col="blue")
             points(peaks[[random_sample]], col="green", pch=20)}
             title("S/N in blue and picked peaks in green", outer=TRUE, line=0)
@@ -231,7 +234,7 @@
         ## plot new spectrum
         par(mfrow = c(2, 2), oma=c(0,0,2,0))
         for (random_sample in random_spectra){
-            plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", random_sample))}
+            plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))}
         title("Picked peaks", outer=TRUE, line=0)
 
         pixel_number = length(peaks)
@@ -268,20 +271,20 @@
 
         peaks = monoisotopicPeaks(peaks, minCor=$method.methods_conditional.minCor, 
                 tolerance=$method.methods_conditional.tolerance,
-                distance=$method.methods_conditional.distance, 
+                distance=c($method.methods_conditional.distance),
                 size=$method.methods_conditional.size)
 
         ## plot old spectrum with picked isotopes as green dots
         par(mfrow = c(2, 2), oma=c(0,0,2,0))
         for (random_sample in random_spectra){
-            plot(picked_peaks[[random_sample]], sub="", main=paste0("spectrum ", random_sample))
+            plot(picked_peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))
             points(peaks[[random_sample]], col="green", pch=20)}
             title(paste0("Monoisotopic peaks in green"), outer=TRUE, line=0)
 
 
         par(mfrow = c(2, 2), oma=c(0,0,2,0))
         for (random_sample in random_spectra){
-            plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", random_sample))}
+            plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))}
             title("Monoisotopic peaks", outer=TRUE, line=0)
 
         minmz = round(min(unlist(lapply(peaks,mass))), digits=4)
@@ -365,7 +368,7 @@
         ## QC plot and numbers
         par(mfrow = c(2, 2), oma=c(0,0,2,0))
         for (random_sample in random_spectra){
-            plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", random_sample))}
+            plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))}
         title("Aligned spectra", outer=TRUE, line=0)
         minmz = round(min(unlist(lapply(peaks,mass))), digits=4)
         maxmz = round(max(unlist(lapply(peaks,mass))), digits=4)
@@ -400,7 +403,7 @@
         ## QC plot and numbers
         par(mfrow = c(2, 2), oma=c(0,0,2,0))
         for (random_sample in random_spectra){
-            plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", random_sample))}
+            plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))}
         title("Binned spectra", outer=TRUE, line=0)
         minmz = round(min(unlist(lapply(peaks,mass))), digits=4)
         maxmz = round(max(unlist(lapply(peaks,mass))), digits=4)
@@ -451,7 +454,7 @@
         ##QC plot and numbers
         par(mfrow = c(2, 2), oma=c(0,0,2,0))
         for (random_sample in random_spectra){
-            plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", random_sample))}
+            plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))}
         title("Filtered spectra", outer=TRUE, line=0)
         minmz = round(min(unlist(lapply(peaks,mass))), digits=4)
         maxmz = round(max(unlist(lapply(peaks,mass))), digits=4)
@@ -550,7 +553,7 @@
             <conditional name="methods_conditional">
                 <param name="method" type="select" label="Select a method">
                     <option value="Peak_detection">Peak detection</option>
-                    <option value="monoisotopic_peaks">Keep only monoisotopic peaks</option>
+                    <option value="monoisotopic_peaks">Monoisotopic peaks</option>
                     <option value="Align">Align Spectra (warping/phase correction)</option>
                     <option value="Binning">Binning</option>
                     <option value="Filtering">Filtering</option>
@@ -571,11 +574,25 @@
                 </when>
                 <when value="monoisotopic_peaks">
                     <param name="minCor" type="float" value="0.95" label="Minimal correlation"
-                        help="Minimal correlation between the peak pattern generated by the model and the experimental peaks in the MassPeaks object to be recognized as isotopic pattern"/>
-                    <param name="tolerance" type="float" label="Tolerance" value="0.00005"
-                        help="Maximal relative deviation of a peak position (m/z) to be considered as identical: abs(((mass[i]+distance)-mass[i+1])/mass[i]) smaller than 'tolerance'. For 50ppm use 0.00005 or 50e-6" />
-                    <param name="distance" type="float" label="Distance" value="1.00235" help="Distance between two consecutive peaks in an isotopic pattern. 1.00235 is average distance for polypeptides."/>
-                    <param name="size" type="integer" label="Size" value="3" help="Size (length) of isotopic pattern, longer patterns are prefered over shorter ones, min size is 2."/>
+                        help="Minimal correlation between the peak pattern generated by the model and the experimental peaks in the MassPeaks object to be recognized as isotopic pattern."/>
+                    <param name="tolerance" type="float" label="Tolerance" value="0.0001"
+                        help="Maximal relative deviation of a peak position (m/z) to be considered as identical: abs(((mass[i]+distance)-mass[i+1])/mass[i]) smaller than 'tolerance'. For 100ppm use 0.0001" />
+                    <param name="distance" type="text" label="Distance" value="1.00235" help="Distance between two consecutive peaks in an isotopic pattern. 1.00235 is average distance for polypeptides. Multiple values can be used to find multiple charged pattern e.g. 1, 0.5 ,0.33">
+                        <sanitizer invalid_char="">
+                            <valid initial="string.digits">
+                                <add value="," />
+                                <add value=":" />
+                                <add value="." />
+                            </valid>
+                        </sanitizer>
+                    </param>
+                    <param name="size" type="text" label="Size" value="3:10" help="Size (length) of isotopic pattern, longer patterns are prefered over shorter ones, min size is 2, a range can be used.">
+                        <sanitizer invalid_char="">
+                            <valid initial="string.digits">
+                                <add value=":" />
+                            </valid>
+                        </sanitizer>
+                    </param>
                 </when>
 
                 <when value="Align">
@@ -614,7 +631,7 @@
                 <when value="Binning">
                     <param name="bin_tolerance" type="float" value="0.002" label="Tolerance"
                         help="After the alignment the peak positions (mass) are very similar but not identical. The binning is needed to make similar peak mass values identical."/>
-                    <param name="bin_method" display="radio" type="select" label="Bin creation rule" help="strict - creates bins never containing two or more peaks of the sampe sample. relaxed - allows multiple peaks of the same sample in one bin.">
+                    <param name="bin_method" display="radio" type="select" label="Bin creation rule" help="strict - creates bins never containing two or more peaks of the same sample. relaxed - allows multiple peaks of the same sample in one bin.">
                     <option value="strict" selected="True" >strict</option>
                     <option value="relaxed" >relaxed</option>
                 </param>
@@ -673,6 +690,7 @@
                 <conditional name="methods_conditional">
                 <param name="method" value="monoisotopic_peaks"/>
                 <param name="tolerance" value="0.0004"/>
+                <param name="size" value="3"/>
             </conditional>
             </repeat>
             <output name="plots" file="peakdetection2_QC.pdf" compare="sim_size"/>
@@ -802,6 +820,13 @@
 
 - Monoisotopic peaks: Keeps only the monoisotopic peaks
 
+    - Based on poisson model for isotopic patterns as decribed in (`Breen et al. <https://doi.org/10.1002/1522-2683(20000601)21:11%3C2243::AID-ELPS2243%3E3.0.CO;2-K>`_)
+    - Isotopic pattern can be characterized and recognized by
+
+        - the similarity of the experimental pattern with the modelled pattern
+        - the distance between consecutive isotopic peaks. For polypeptides the average distance is 1.00235 (`Park et al. <https://pubs.acs.org/doi/abs/10.1021/ac800913b>`_). Multiply charged analytes have smaller distances between the peaks (e.g. z = 1 distance = ~1; z = 2: distance = ~0.5; z = 3: distance = ~0.3333) To search for differently charged isotopic pattern multiple distances can be applied - the order matters because the first distance that matches is reported (1, 0.5, 0.3333). 
+        - the size (length) of the pattern, multiple values can be applied, longer patterns are prefered over shorter ones.
+
 
 - Spectra alignment (warping): alignment for (re)calibration of m/z values.