diff msi_ion_images.xml @ 8:6cd561bbb7ee draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_ion_images commit 620a469e20836b921b6c0147421c8a4268b66ebd
author galaxyp
date Wed, 15 Aug 2018 05:40:16 -0400
parents db0cf8eb4395
children 3aac627bd3ee
line wrap: on
line diff
--- a/msi_ion_images.xml	Fri Jul 06 14:13:35 2018 -0400
+++ b/msi_ion_images.xml	Wed Aug 15 05:40:16 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="mass_spectrometry_imaging_ion_images" name="MSI ion images" version="1.10.0.3">
+<tool id="mass_spectrometry_imaging_ion_images" name="MSI ion images" version="1.10.0.4">
     <description>
         mass spectrometry imaging m/z heatmaps
     </description>
@@ -178,40 +178,50 @@
 
 if (npeaks > 0){
     if (length(inputmz) != 0){
-      for (mass in 1:length(inputmz)){
+        for (mass in 1:length(inputmz)){
 
-###standard image
+            ###standard image
 
-#if str($image_cond.image_type) == "standard_image":
-    print("standard image")
+            #if str($image_cond.image_type) == "standard_image":
+                print("standard image")
 
-    print(image(msidata, mz=inputmz[mass],plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast", 
-    smooth.image = "$image_smoothing", strip=$strip, colorkey=$colorkey,ylim= c(maximumy+0.1*maximumy,minimumy-0.1*minimumy),
-    main= paste0(inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)")))}
+                print(image(msidata, mz=inputmz[mass],plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast", 
+                smooth.image = "$image_smoothing", strip=$strip, colorkey=$colorkey,ylim= c(maximumy+0.1*maximumy,minimumy-0.1*minimumy),
+                main= paste0(inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)")))}
 
 
-###lattice image
+            ###lattice image
+
+            #elif str($image_cond.image_type) == "lattice_image":
+                print("lattice image")
+
+                #if str($strip) =="TRUE": 
 
-#elif str($image_cond.image_type) == "lattice_image":
-    print("lattice image")
+                print(image(msidata, mz=inputmz[mass], strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)),
+                lattice=TRUE, plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing", 
+                colorkey=$colorkey,ylim= c(maximumy+0.1*maximumy,minimumy-0.1*minimumy),
+                main= paste0(inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)")))}
 
-    #if str($strip) =="TRUE": 
+                #elif str($strip) =="FALSE": 
 
-    print(image(msidata, mz=inputmz[mass], strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)),
-    lattice=TRUE, plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing", 
-    colorkey=$colorkey,ylim= c(maximumy+0.1*maximumy,minimumy-0.1*minimumy),
-    main= paste0(inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)")))}
+                print(image(msidata, mz=inputmz[mass], strip = $strip,
+                lattice=TRUE, plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing", 
+                colorkey=$colorkey,
+                main= paste0(inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)")))}
 
-    #elif str($strip) =="FALSE": 
+                #end if
+
+            #end if 
 
-    print(image(msidata, mz=inputmz[mass], strip = $strip,
-    lattice=TRUE, plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing", 
-    colorkey=$colorkey,
-    main= paste0(inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)")))}
+        ## optional svg output with original coordinates
+        #if str($svg_cond.svg_pixelimage) == "yes_svg":
+            print("svg pixel image")
 
-    #end if
-
-#end if 
+            svg(file="svg_pixel_output.svg")
+            par(mar=c(0,0,0,0))
+            image(msidata, mz = inputmz[1],strip=FALSE, ylim=c(maximumy, minimumy), plusminus = $plusminus_dalton,colorkey = FALSE,axes=FALSE, xlab=NA, ylab=NA,contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing")
+            dev.off()
+        #end if
 
     } else {print("The input m/z were invalid")}
     dev.off()
@@ -219,6 +229,8 @@
     print("inputfile has no intensities > 0")
 dev.off()
 }
+
+
     ]]></configfile>
     </configfiles>
     <inputs>
@@ -262,9 +274,20 @@
         <when value="standard_image"/>
         <when value="lattice_image"/>
         </conditional>
+        <conditional name="svg_cond">
+            <param name="svg_pixelimage" type="select" label="Do you want to export a heatmap with the original coordinates as svg image, the first valid m/z from tabular file is used">
+                <option value="no_svg" selected="True">No svg image export</option>
+                <option value="yes_svg">Export svg image</option>
+            </param>
+        <when value="no_svg"/>
+        <when value="yes_svg"/>
+        </conditional>
     </inputs>
     <outputs>
         <data format="pdf" name="plots" from_work_dir="heatmaps.pdf" label = "$infile.display_name heatmaps"/>
+        <data format="svg" name="svg_output" from_work_dir="svg_pixel_output.svg" label="$infile.display_name svg">
+            <filter>svg_cond['svg_pixelimage'] == 'yes_svg'</filter>
+        </data>
     </outputs>
     <tests>
         <test>
@@ -293,7 +316,11 @@
             <param name="image_smoothing" value="gaussian"/>
             <param name="strip" value="False"/>
             <param name="colorkey" value="True"/>
+            <conditional name="svg_cond">
+                <param name="svg_pixelimage" value="yes_svg"/>
+            </conditional>
             <output name="plots" file="Heatmaps_analyze75.pdf" compare="sim_size" delta="20000"/>
+            <output name="svg_output" file="analyze75.svg" compare="sim_size" delta="20000"/>
         </test>
         <test>
             <param name="infile" value="preprocessed.rdata" ftype="rdata"/>
@@ -339,6 +366,7 @@
 Output:
 
 - Pdf with the heatmap images
+- optional svg file of a mass-spectrometry imaging m/z heatmap
 
 Troubleshooting: