changeset 5:e66f552a3c47 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/MALDIquant commit 218c44b9ba1b5f0f47edb743ed70075fb661386e"
author galaxyp
date Thu, 19 Mar 2020 18:09:47 -0400
parents e9300ef37403
children d286ff4600dd
files maldi_quant_peakdetection.xml
diffstat 1 files changed, 33 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/maldi_quant_peakdetection.xml	Fri Mar 22 08:26:23 2019 -0400
+++ b/maldi_quant_peakdetection.xml	Thu Mar 19 18:09:47 2020 -0400
@@ -1,4 +1,4 @@
-<tool id="maldi_quant_peak_detection" name="MALDIquant peak detection" version="@VERSION@.4">
+<tool id="maldi_quant_peak_detection" name="MALDIquant peak detection" version="@VERSION@.5">
     <description>
         Peak detection, binning and filtering for mass-spectrometry imaging data
     </description>
@@ -16,9 +16,10 @@
             cp '${infile.extra_files_path}/img' infile.img &&
             cp '${infile.extra_files_path}/t2m' infile.t2m &&
         #else
-            ln -s $infile infile.RData &&
+            ln -s '$infile' infile.RData &&
         #end if
-        Rscript '${maldi_quant_peak_detection}'&&
+        cat '${maldi_quant_peak_detection}' &&
+        Rscript '${maldi_quant_peak_detection}' &&
         mkdir $outfile_imzml.files_path &&
         mv ./out.imzMl "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true &&
         mv ./out.ibd "${os.path.join($outfile_imzml.files_path, 'ibd')}" | true &&
@@ -359,16 +360,43 @@
                     ## 2) warp spectra:
                         peaks_new_list = warpMassPeaks(list(peaks[[pixelnb]]), warping_function, emptyNoMatches=$method.methods_conditional.empty_nomatch)
                 }
-                peaks_new = peaks_new_list
+                peaks = peaks_new_list
 
             #end if
 
         #end if
 
+        #if $method.methods_conditional.remove_empty:
+            print(paste(length(findEmptyMassObjects(peaks)), " empty spectra were removed", sep=" "))
+
+            ## only if there are empty spectra to remove
+
+            if (length(findEmptyMassObjects(peaks))>0)
+
+                {
+                    #if $infile.ext == 'rdata'
+                        cardinal_coordinates = cardinal_coordinates[-findEmptyMassObjects(peaks),,drop=FALSE] ## remove coordinates of empty spectra for Cardinal RData input
+                    #end if
+
+                    peaks = removeEmptyMassObjects(peaks)
+            }
+        #end if
+
         ## 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 ", pixelnames[random_sample]))}
+
+
+        tryCatch(
+                {
+                    plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))},
+                error=function(cond) {
+                    plot(NULL, xlim=c(0,0), ylim=c(0,0), ylab="intensity", xlab="m/z")
+                }
+            )
+}
+
         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)