comparison mz_images.xml @ 2:27a4c660bbca draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit f127be2141cf22e269c85282d226eb16fe14a9c1
author galaxyp
date Fri, 15 Feb 2019 10:20:01 -0500
parents 4d5f798a7a18
children 773a24b240e1
comparison
equal deleted inserted replaced
1:4d5f798a7a18 2:27a4c660bbca
1 <tool id="cardinal_mz_images" name="MSI mz images" version="@VERSION@.1"> 1 <tool id="cardinal_mz_images" name="MSI mz images" version="@VERSION@.2">
2 <description> 2 <description>
3 mass spectrometry imaging m/z heatmaps 3 mass spectrometry imaging m/z heatmaps
4 </description> 4 </description>
5 <macros> 5 <macros>
6 <import>macros.xml</import> 6 <import>macros.xml</import>
56 56
57 grid.table(property_df, rows= NULL) 57 grid.table(property_df, rows= NULL)
58 58
59 ############################# II) images #################################### 59 ############################# II) images ####################################
60 60
61 ### only plot images when file has peaks and valid input m/z: 61 ### only plot images when file has features and pixels:
62 62
63 if (npeaks > 0){ 63 if (ncol(msidata)>0 & nrow(msidata) >0){
64 if (length(inputmz) != 0){ 64 if (length(inputmz) != 0){
65 for (mass in 1:length(inputmz)){ 65 for (mass in 1:length(inputmz)){
66 66
67 ###standard image 67 ###standard image
68 68
69 #if str($image_type) == "standard_image": 69 #if str($image_type) == "standard_image":
70 print("standard image") 70 print("standard image")
71 71
72 print(image(msidata, mz=inputmz[mass],plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast", 72 print(image(msidata, mz=inputmz[mass],plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast",
73 smooth.image = "$image_smoothing", strip=$strip, colorkey=$colorkey,ylim= c(maximumy+0.1*maximumy,minimumy-0.1*minimumy), 73 smooth.image = "$image_smoothing", strip=$strip, colorkey=$colorkey,ylim= c(maximumy+0.2*maximumy,minimumy-1),
74 main= paste0(inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)")))} 74 main= paste0(inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)")))}
75 75
76 76
77 ###lattice image 77 ###lattice image
78 78
81 81
82 #if str($strip) =="TRUE": 82 #if str($strip) =="TRUE":
83 83
84 print(image(msidata, mz=inputmz[mass], strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), 84 print(image(msidata, mz=inputmz[mass], strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)),
85 lattice=TRUE, plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing", 85 lattice=TRUE, plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing",
86 colorkey=$colorkey,ylim= c(maximumy+0.1*maximumy,minimumy-0.1*minimumy), 86 colorkey=$colorkey,ylim=c(maximumy+0.2*maximumy,minimumy-1),
87 main= paste0(inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)")))} 87 main= paste0(inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)")))}
88 88
89 #elif str($strip) =="FALSE": 89 #elif str($strip) =="FALSE":
90 90
91 print(image(msidata, mz=inputmz[mass], strip = $strip, 91 print(image(msidata, mz=inputmz[mass], strip = $strip,
98 #end if 98 #end if
99 99
100 ## optional svg output with original coordinates 100 ## optional svg output with original coordinates
101 #if $svg_pixelimage: 101 #if $svg_pixelimage:
102 print("svg pixel image") 102 print("svg pixel image")
103 ## reverse y axis for svg output = correct order and nice svg image
104 coord(msidata)\$y <- max(coord(msidata)\$y) - coord(msidata)\$y + 1
103 svg(file="svg_pixel_output.svg") 105 svg(file="svg_pixel_output.svg")
104 par(mar=c(0,0,0,0)) 106 par(mar=c(0,0,0,0))
105 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") 107 image(msidata, mz = inputmz[1],strip=FALSE, plusminus = $plusminus_dalton,colorkey = FALSE,axes=FALSE, xlab=NA, ylab=NA,contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing")
106 dev.off() 108 dev.off()
109 #end if
110
111 ## optional overlay all input m/z in one image
112 #if str($overlay_cond.overlay_selection) == "yes_overlay":
113
114 #set $color_string = ','.join(['"%s"' % $color.feature_color for $color in $overlay_cond.colours])
115 colourvector = c($color_string)
116
117 image(msidata, mz=inputmz,
118 plusminus = $plusminus_dalton,
119 col=colourvector,
120 contrast.enhance = "$image_contrast",
121 normalize.image="linear",
122 smooth.image = "$image_smoothing",
123 superpose=TRUE, main="overlay of all m/z",
124 ylim= c(maximumy+0.2*maximumy,minimumy-1))
125
126 legend("topright",
127 fill=colourvector,
128 legend=as.numeric(sort(as.character(inputmz))))
107 #end if 129 #end if
108 130
109 } else {print("The input m/z were invalid")} 131 } else {print("The input m/z were invalid")}
110 dev.off() 132 dev.off()
111 }else{ 133 }else{
112 print("inputfile has no intensities > 0") 134 print("input file has no features or pixels left")
113 dev.off() 135 dev.off()
114 } 136 }
115 137
116 138
117 ]]></configfile> 139 ]]></configfile>
136 <param name="strip" type="boolean" checked="True" truevalue="TRUE" falsevalue="FALSE" label="Display m/z value in plot"/> 158 <param name="strip" type="boolean" checked="True" truevalue="TRUE" falsevalue="FALSE" label="Display m/z value in plot"/>
137 <param name="colorkey" type="boolean" checked="True" truevalue="TRUE" falsevalue="FALSE" label="Display colorkey in plot"/> 159 <param name="colorkey" type="boolean" checked="True" truevalue="TRUE" falsevalue="FALSE" label="Display colorkey in plot"/>
138 <param name="image_type" type="boolean" checked="True" truevalue="standard_image" falsevalue="lattice_image" 160 <param name="image_type" type="boolean" checked="True" truevalue="standard_image" falsevalue="lattice_image"
139 label="Standard image" help="No: lattice function is used to display image"/> 161 label="Standard image" help="No: lattice function is used to display image"/>
140 <param name="svg_pixelimage" type="boolean" label="Export first valid m/z from tabular file as SVG"/> 162 <param name="svg_pixelimage" type="boolean" label="Export first valid m/z from tabular file as SVG"/>
163 <conditional name="overlay_cond">
164 <param name="overlay_selection" type="select" label="Overlay image">
165 <option value="no_overlay" selected="True">no</option>
166 <option value="yes_overlay">yes</option>
167 </param>
168 <when value="no_overlay"/>
169 <when value="yes_overlay">
170 <repeat name="colours" title="Colours for the plots" min="1" max="50">
171 <param name="feature_color" type="color" label="Colours" value="#ff00ff" help="Numbers of colours should be the same as number of m/z in tabular file">
172 <sanitizer>
173 <valid initial="string.letters,string.digits">
174 <add value="#" />
175 </valid>
176 </sanitizer>
177 </param>
178 </repeat>
179 </when>
180 </conditional>
141 </inputs> 181 </inputs>
142 <outputs> 182 <outputs>
143 <data format="pdf" name="plots" from_work_dir="heatmaps.pdf" label="${tool.name} on ${on_string}"/> 183 <data format="pdf" name="plots" from_work_dir="heatmaps.pdf" label="${tool.name} on ${on_string}: results"/>
144 <data format="svg" name="svg_output" from_work_dir="svg_pixel_output.svg" label="${tool.name} on ${on_string}: image.svg"> 184 <data format="svg" name="svg_output" from_work_dir="svg_pixel_output.svg" label="${tool.name} on ${on_string}: image.svg">
145 <filter>svg_pixelimage</filter> 185 <filter>svg_pixelimage</filter>
146 </data> 186 </data>
147 </outputs> 187 </outputs>
148 <tests> 188 <tests>
172 <param name="svg_pixelimage" value="True"/> 212 <param name="svg_pixelimage" value="True"/>
173 <output name="plots" file="Heatmaps_analyze75.pdf" ftype="pdf" compare="sim_size"/> 213 <output name="plots" file="Heatmaps_analyze75.pdf" ftype="pdf" compare="sim_size"/>
174 <output name="svg_output" file="analyze75.svg" ftype="svg" compare="sim_size"/> 214 <output name="svg_output" file="analyze75.svg" ftype="svg" compare="sim_size"/>
175 </test> 215 </test>
176 <test> 216 <test>
177 <param name="infile" value="preprocessed.rdata" ftype="rdata"/> 217 <param name="infile" value="preprocessed.RData" ftype="rdata"/>
178 <param name="calibrant_file" value="inputpeptides.tabular" ftype="tabular"/> 218 <param name="calibrant_file" value="inputpeptides.tabular" ftype="tabular"/>
179 <param name="mz_column" value="1"/> 219 <param name="mz_column" value="1"/>
180 <param name="name_column" value="2"/> 220 <param name="name_column" value="2"/>
181 <param name="plusminus_dalton" value="0.5"/> 221 <param name="plusminus_dalton" value="0.5"/>
182 <param name="strip" value="True"/> 222 <param name="strip" value="True"/>