changeset 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
files msi_ion_images.xml test-data/Heatmaps_LM8_file16.pdf test-data/Heatmaps_analyze75.pdf test-data/Heatmaps_imzml.pdf test-data/Heatmaps_rdata.pdf test-data/analyze75.svg
diffstat 6 files changed, 67 insertions(+), 24 deletions(-) [+]
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:
 
Binary file test-data/Heatmaps_LM8_file16.pdf has changed
Binary file test-data/Heatmaps_analyze75.pdf has changed
Binary file test-data/Heatmaps_imzml.pdf has changed
Binary file test-data/Heatmaps_rdata.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/analyze75.svg	Wed Aug 15 05:40:16 2018 -0400
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="216pt" height="216pt" viewBox="0 0 216 216" version="1.1">
+<g id="surface1">
+<rect x="0" y="0" width="216" height="216" style="fill:rgb(100%,100%,100%);fill-opacity:1;stroke:none;"/>
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,100%,80%);fill-opacity:1;" d="M 0 0 L 72 0 L 72 72 L 0 72 Z M 0 0 "/>
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,100%,32.156863%);fill-opacity:1;" d="M 0 72 L 72 72 L 72 144 L 0 144 Z M 0 72 "/>
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,3.921569%,0%);fill-opacity:1;" d="M 0 144 L 72 144 L 72 216 L 0 216 Z M 0 144 "/>
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 72 0 L 144 0 L 144 72 L 72 72 Z M 72 0 "/>
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0.392157%,33.333333%);fill-opacity:1;" d="M 72 72 L 144 72 L 144 144 L 72 144 Z M 72 72 "/>
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,1.568627%,93.72549%);fill-opacity:1;" d="M 72 144 L 144 144 L 144 216 L 72 216 Z M 72 144 "/>
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0.784314%,54.509804%);fill-opacity:1;" d="M 144 0 L 216 0 L 216 72 L 144 72 Z M 144 0 "/>
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,1.568627%,81.568627%);fill-opacity:1;" d="M 144 72 L 216 72 L 216 144 L 144 144 Z M 144 72 "/>
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,1.960784%,100%);fill-opacity:1;" d="M 144 144 L 216 144 L 216 216 L 144 216 Z M 144 144 "/>
+</g>
+</svg>