Mercurial > repos > galaxyp > cardinal_mz_images
comparison mz_images.xml @ 13:a2b57ea6666e draft
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 39bd480e8813fa7a96b640150365577a69885d17-dirty"
author | galaxyp |
---|---|
date | Sun, 29 Nov 2020 23:23:01 +0000 |
parents | a95a82eb4d50 |
children | 5629069fca8f |
comparison
equal
deleted
inserted
replaced
12:a95a82eb4d50 | 13:a2b57ea6666e |
---|---|
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> |
60 | 60 |
61 ############################# II) images #################################### | 61 ############################# II) images #################################### |
62 | 62 |
63 ### only plot images when file has features and pixels: | 63 ### only plot images when file has features and pixels: |
64 par(mar=c(0,0,0,0), oma=c(0,0,0,1))## margin for image legend | 64 par(mar=c(0,0,0,0), oma=c(0,0,0,1))## margin for image legend |
65 | |
66 #if str($light_mode) == "white": | |
67 lightmode() | |
68 #else | |
69 darkmode() | |
70 #end if | |
71 | |
65 if (ncol(msidata)>0 & nrow(msidata) >0){ | 72 if (ncol(msidata)>0 & nrow(msidata) >0){ |
66 if (length(inputmz) != 0){ | 73 if (length(inputmz) != 0){ |
67 for (mass in 1:length(inputmz)){ | 74 for (mass in 1:length(inputmz)){ |
68 | 75 |
69 print(image(msidata, mz=inputmz[mass],plusminus = $plusminus_dalton, normalize.image="$normalize_image", contrast.enhance = "$image_contrast", | 76 print(image(msidata, mz=inputmz[mass],plusminus = $plusminus_dalton, normalize.image="$normalize_image", contrast.enhance = "$image_contrast", |
70 smooth.image = "$image_smoothing", colorkey=$colorkey, colorscale=$colorscale, ylim= c(maximumy,minimumy))) | 77 smooth.image = "$image_smoothing", colorkey=$colorkey, colorscale=$colorscale, alpha.power=$alpha_power, ylim= c(maximumy,minimumy))) |
71 title(inputnames[mass], adj = 0.5, line = 1)} | 78 title(inputnames[mass], adj = 0.5, line = 1)} |
72 | 79 |
73 | 80 |
74 ## optional svg output with original coordinates | 81 ## optional svg output with original coordinates |
75 #if $svg_pixelimage: | 82 #if $svg_pixelimage: |
79 ## works only with MSImageSet as expected | 86 ## works only with MSImageSet as expected |
80 msidata = as(msidata, "MSImageSet") | 87 msidata = as(msidata, "MSImageSet") |
81 | 88 |
82 svg(file="svg_pixel_output.svg", width=maximumx, height=maximumy) | 89 svg(file="svg_pixel_output.svg", width=maximumx, height=maximumy) |
83 par(mar=c(0,0,0,0), oma=c(0,0,0,0))## no margin for svg | 90 par(mar=c(0,0,0,0), oma=c(0,0,0,0))## no margin for svg |
84 print(image(msidata, mz = inputmz[1],strip=FALSE, plusminus = $plusminus_dalton, colorscale=$colorscale, colorkey = FALSE,axes=FALSE, xlab=NA, ylab=NA,contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing", normalize.image="$normalize_image")) | 91 #if str($light_mode) == "white": |
92 lightmode() | |
93 #else | |
94 darkmode() | |
95 #end if | |
96 print(image(msidata, mz = inputmz[1],strip=FALSE, plusminus = $plusminus_dalton,colorscale=$colorscale, colorkey = FALSE,axes=FALSE, xlab=NA, ylab=NA,contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing", alpha.power=$alpha_power, normalize.image="$normalize_image")) | |
85 dev.off() | 97 dev.off() |
86 #end if | 98 #end if |
87 | 99 |
88 ## optional overlay all input m/z in one image | 100 ## optional overlay all input m/z in one image |
89 #if str($overlay_cond.overlay_selection) == "yes_overlay": | 101 #if str($overlay_cond.overlay_selection) == "yes_overlay": |
90 | 102 |
91 #set $color_string = ','.join(['"%s"' % $color.feature_color for $color in $overlay_cond.colours]) | 103 #set $color_string = ','.join(['"%s"' % $color.feature_color for $color in $overlay_cond.colours]) |
92 colourvector = c($color_string) | 104 colourvector = c($color_string) |
93 par(mar=c(0,0,0,0), oma=c(0,0,0,1))## margin for image legend | |
94 print(image(msidata, mz=inputmz, | 105 print(image(msidata, mz=inputmz, |
95 plusminus = $plusminus_dalton, | 106 plusminus = $plusminus_dalton, |
96 col=colourvector, | 107 col=colourvector, |
97 contrast.enhance = "$image_contrast", | 108 contrast.enhance = "$image_contrast", |
98 normalize.image="$normalize_image", | 109 normalize.image="$normalize_image", |
99 smooth.image = "$image_smoothing", | 110 smooth.image = "$image_smoothing", |
100 superpose=TRUE, main="overlay of all m/z", | 111 superpose=TRUE, main="overlay of all m/z", |
101 key=FALSE, | 112 key=FALSE, alpha.power=$alpha_power, |
102 ylim= c(maximumy,minimumy))) | 113 ylim= c(maximumy,minimumy))) |
103 | 114 |
104 legend("$overlay_cond.legend_position", | 115 legend("$overlay_cond.legend_position", |
105 fill=colourvector, | 116 fill=colourvector, |
106 legend=as.numeric(inputmz)) | 117 legend=as.numeric(inputmz)) |
119 <inputs> | 130 <inputs> |
120 <expand macro="reading_msidata"/> | 131 <expand macro="reading_msidata"/> |
121 <expand macro="pdf_filename"/> | 132 <expand macro="pdf_filename"/> |
122 <expand macro="reading_2_column_mz_tabular"/> | 133 <expand macro="reading_2_column_mz_tabular"/> |
123 | 134 |
124 <param name="plusminus_dalton" value="0.25" type="float" label="m/z range" help="average of the m/z window will be computed"/> | 135 <param name="plusminus_dalton" value="0.25" type="float" label="plusminus m/" help="m/z range to add on either side of the given m/z to create a window in which the mean of all intensities will be computed"/> |
125 <param name="image_contrast" type="select" label="Contrast enhancement" help="The 'histogram' equalization method flatterns the distribution of intensities. The hotspot 'suppression' method uses thresholding to reduce the intensities of hotspots"> | 136 <param name="image_contrast" type="select" label="Contrast enhancement" help="The 'histogram' equalization method flatterns the distribution of intensities. The hotspot 'suppression' method uses thresholding to reduce the intensities of hotspots"> |
126 <option value="none" selected="True">none</option> | 137 <option value="none" selected="True">none</option> |
127 <option value="suppression">suppression</option> | 138 <option value="suppression">suppression</option> |
128 <option value="histogram">histogram</option> | 139 <option value="histogram">histogram</option> |
129 </param> | 140 </param> |
136 <option value="viridis" selected="True">viridis</option> | 147 <option value="viridis" selected="True">viridis</option> |
137 <option value="magma">magma</option> | 148 <option value="magma">magma</option> |
138 <option value="plasma">plasma</option> | 149 <option value="plasma">plasma</option> |
139 <option value="inferno">inferno</option> | 150 <option value="inferno">inferno</option> |
140 </param> | 151 </param> |
152 <param name="light_mode" type="select" display="radio" label="Image Background"> | |
153 <option value="white" selected="True">white</option> | |
154 <option value="black">black</option> | |
155 </param> | |
156 <param name="alpha_power" type="float" value="1" label="Alpha power" help="Opacity scaling factor (1 is linear)"/> | |
141 <param name="colorkey" type="boolean" checked="True" truevalue="TRUE" falsevalue="FALSE" label="Display colorkey in plot"/> | 157 <param name="colorkey" type="boolean" checked="True" truevalue="TRUE" falsevalue="FALSE" label="Display colorkey in plot"/> |
142 <param name="normalize_image" type="boolean" truevalue="linear" falsevalue="none" label="Linear normalization of image"/> | 158 <param name="normalize_image" type="boolean" truevalue="linear" falsevalue="none" label="Linear normalization of image"/> |
143 <param name="svg_pixelimage" type="boolean" label="Export first valid m/z from tabular file as SVG"/> | 159 <param name="svg_pixelimage" type="boolean" label="Export first valid m/z from tabular file as SVG"/> |
144 <conditional name="overlay_cond"> | 160 <conditional name="overlay_cond"> |
145 <param name="overlay_selection" type="select" label="Overlay image"> | 161 <param name="overlay_selection" type="select" label="Overlay image"> |
231 <param name="units" value="ppm"/> | 247 <param name="units" value="ppm"/> |
232 </conditional> | 248 </conditional> |
233 <param name="calibrant_file" value="inputpeptides.tabular" ftype="tabular"/> | 249 <param name="calibrant_file" value="inputpeptides.tabular" ftype="tabular"/> |
234 <param name="mz_column" value="1"/> | 250 <param name="mz_column" value="1"/> |
235 <param name="name_column" value="2"/> | 251 <param name="name_column" value="2"/> |
252 <param name="light_mode" value="black"/> | |
236 <conditional name="overlay_cond"> | 253 <conditional name="overlay_cond"> |
237 <param name="overlay_selection" value="yes_overlay"/> | 254 <param name="overlay_selection" value="yes_overlay"/> |
238 <repeat name="colours"> | 255 <repeat name="colours"> |
239 <param name="feature_color" value="#ff00ff"/> | 256 <param name="feature_color" value="#ff00ff"/> |
240 </repeat> | 257 </repeat> |