Mercurial > repos > galaxyp > msi_ion_images
comparison msi_ion_images.xml @ 1:845fee459824 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_ion_images commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
author | galaxyp |
---|---|
date | Thu, 01 Mar 2018 08:25:18 -0500 |
parents | 385e8a4accd9 |
children | b2ad54eabcca |
comparison
equal
deleted
inserted
replaced
0:385e8a4accd9 | 1:845fee459824 |
---|---|
1 <tool id="mass_spectrometry_imaging_ion_images" name="MSI ion images" version="1.7.0"> | 1 <tool id="mass_spectrometry_imaging_ion_images" name="MSI ion images" version="1.7.0.1"> |
2 <description> | 2 <description> |
3 mass spectrometry imaging heatmaps | 3 mass spectrometry imaging heatmaps |
4 </description> | 4 </description> |
5 <requirements> | 5 <requirements> |
6 <requirement type="package" version="1.7.0">bioconductor-cardinal</requirement> | 6 <requirement type="package" version="1.7.0">bioconductor-cardinal</requirement> |
34 library(lattice) | 34 library(lattice) |
35 | 35 |
36 ## Read MALDI Imaging dataset | 36 ## Read MALDI Imaging dataset |
37 | 37 |
38 #if $infile.ext == 'imzml' | 38 #if $infile.ext == 'imzml' |
39 msidata <- readMSIData('infile.imzML') | 39 msidata = readMSIData('infile.imzML') |
40 #elif $infile.ext == 'analyze75' | 40 #elif $infile.ext == 'analyze75' |
41 msidata <- readMSIData('infile.hdr') | 41 msidata = readMSIData('infile.hdr') |
42 #else | 42 #else |
43 load('infile.RData') | 43 load('infile.RData') |
44 #end if | 44 #end if |
45 | 45 |
46 #if $massfile: | |
47 ### Read tabular file with peptide masses for plots and heatmap images: | |
48 input_list = read.delim("$massfile", header = FALSE, na.strings=c("","NA", "#NUM!", "#ZAHL!"), stringsAsFactors = FALSE) | |
49 if (ncol(input_list) == 1) | |
50 { | |
51 input_list = cbind(input_list, input_list) | |
52 } | |
53 #else | |
54 input_list = data.frame(0, 0) | |
55 #end if | |
56 colnames(input_list)[1:2] = c("mz", "name") | |
57 | 46 |
58 ###################################### file properties in numbers ###################### | 47 ###################################### file properties in numbers ###################### |
59 | 48 |
60 ## Number of features (mz) | 49 ## Number of features (mz) |
61 maxfeatures = length(features(msidata)) | 50 maxfeatures = length(features(msidata)) |
113 peakpickinginfo='FALSE' | 102 peakpickinginfo='FALSE' |
114 } else { | 103 } else { |
115 peakpickinginfo=processinginfo@peakPicking | 104 peakpickinginfo=processinginfo@peakPicking |
116 } | 105 } |
117 | 106 |
118 ### calculate how many input masses are valid: | 107 #if $massfile: |
119 inputmasses = input_list[input_list[,1]>minmz & input_list[,1]<maxmz,] | 108 ### Read tabular file with peptide masses for plots and heatmap images: |
120 | 109 input_list = read.delim("$massfile", header = FALSE, stringsAsFactors = FALSE) |
121 inputmz = inputmasses[,1] | 110 if (ncol(input_list) == 1) |
122 inputnames = inputmasses[,2] | 111 { |
123 | 112 input_list = cbind(input_list, input_list) |
113 } | |
114 ### calculate how many input masses are valid: | |
115 inputmasses = input_list[input_list[,1]>minmz & input_list[,1]<maxmz,] | |
116 | |
117 inputmz = inputmasses[,1] | |
118 inputnames = inputmasses[,2] | |
119 #else | |
120 input_list = data.frame(0, 0) | |
121 inputmz = 0 | |
122 #end if | |
123 | |
124 | |
125 countpixels = rowSums(spectra(msidata)[features(msidata, mz=inputmz),]>0) | |
126 percentpixels = round(countpixels/pixelcount*100, digits=1) | |
127 valuesdataframe = cbind(inputmz, cbind(countpixels, percentpixels)) | |
128 | |
129 | |
130 write.table(valuesdataframe, file="$pixel_count", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") | |
131 | |
132 colnames(input_list)[1:2] = c("mz", "name") | |
124 properties = c("Number of mz features", | 133 properties = c("Number of mz features", |
125 "Range of mz values [Da]", | 134 "Range of mz values [Da]", |
126 "Number of pixels", | 135 "Number of pixels", |
127 "Range of x coordinates", | 136 "Range of x coordinates", |
128 "Range of y coordinates", | 137 "Range of y coordinates", |
134 "Normalization", | 143 "Normalization", |
135 "Smoothing", | 144 "Smoothing", |
136 "Baseline reduction", | 145 "Baseline reduction", |
137 "Peak picking", | 146 "Peak picking", |
138 "Centroided", | 147 "Centroided", |
139 paste0("# valid masses in ", "$filename")) | 148 paste0("# valid masses in ", "$massfile.display_name")) |
140 | 149 |
141 values = c(paste0(maxfeatures), | 150 values = c(paste0(maxfeatures), |
142 paste0(minmz, " - ", maxmz), | 151 paste0(minmz, " - ", maxmz), |
143 paste0(pixelcount), | 152 paste0(pixelcount), |
144 paste0(minimumx, " - ", maximumx), | 153 paste0(minimumx, " - ", maximumx), |
155 paste0(centroidedinfo), | 164 paste0(centroidedinfo), |
156 paste0(length(inputmz), "/", length(input_list[,1]))) | 165 paste0(length(inputmz), "/", length(input_list[,1]))) |
157 | 166 |
158 property_df = data.frame(properties, values) | 167 property_df = data.frame(properties, values) |
159 | 168 |
169 | |
170 | |
171 | |
160 ######################################## PDF ############################################# | 172 ######################################## PDF ############################################# |
161 ########################################################################################## | 173 ########################################################################################## |
162 ########################################################################################## | 174 ########################################################################################## |
163 | 175 |
164 | 176 |
174 | 186 |
175 grid.table(property_df, rows= NULL) | 187 grid.table(property_df, rows= NULL) |
176 | 188 |
177 if (npeaks > 0) | 189 if (npeaks > 0) |
178 { | 190 { |
191 | |
179 if (length(inputmz) != 0) | 192 if (length(inputmz) != 0) |
180 { | 193 { |
194 | |
181 for (mass in 1:length(inputmz)) | 195 for (mass in 1:length(inputmz)) |
182 { | 196 { |
183 print(image(msidata, mz=inputmz[mass], strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), | 197 |
184 lattice=TRUE, ylim = c(maximumy+1,minimumy-1), plusminus = $plusminusinDalton, contrast.enhance = "histogram", | 198 |
185 main= paste0(mass, ") ", inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminusinDalton, " Da)"))) | 199 print(image(msidata, mz=inputmz[mass], strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), |
200 lattice=TRUE, ylim = c(maximumy+1,minimumy-1), plusminus = $plusminus_dalton, contrast.enhance = "$image_contrast", smooth.image = "$image_smoothing", | |
201 main= paste0(mass, ") ", inputnames[mass], " (", round(inputmz[mass], digits = 2)," ± ", $plusminus_dalton, " Da)"))) | |
186 } | 202 } |
187 } else {print("The input masses were outside the mass range")} | 203 } else {print("The input masses were invalid")} |
188 | 204 |
189 dev.off() | 205 dev.off() |
190 | 206 |
191 }else{ | 207 }else{ |
192 print("inputfile has no intensities > 0") | 208 print("inputfile has no intensities > 0") |
196 </configfiles> | 212 </configfiles> |
197 <inputs> | 213 <inputs> |
198 <param name="infile" type="data" format="imzml,rdata,analyze75" label="Inputfile as imzML, Analyze7.5 or Cardinal MSImageSet saved as RData" | 214 <param name="infile" type="data" format="imzml,rdata,analyze75" label="Inputfile as imzML, Analyze7.5 or Cardinal MSImageSet saved as RData" |
199 help="Upload composite datatype imzml (ibd+imzML) or analyze75 (hdr+img+t2m) or regular upload .RData (Cardinal MSImageSet)"/> | 215 help="Upload composite datatype imzml (ibd+imzML) or analyze75 (hdr+img+t2m) or regular upload .RData (Cardinal MSImageSet)"/> |
200 <param name="filename" type="text" value="" label="Title" help="will appear in the quality report. If nothing given it will take the dataset name."/> | 216 <param name="filename" type="text" value="" label="Title" help="will appear in the quality report. If nothing given it will take the dataset name."/> |
201 <param name="massfile" type="data" optional="true" format="tabular" label="Text file with masses and names" | 217 <param name="massfile" type="data" format="tabular" label="Text file with masses and names" |
202 help="first column mass (m/z), second column mass name, tab separated file"/> | 218 help="first column mass (m/z), second column mass name, tab separated file"/> |
203 <param name="plusminusinDalton" value="0.25" type="float" label="Mass range" help="plusminus mass window in Dalton"/> | 219 <param name="image_contrast" type="select" label="Select a contrast enhancement function for the heatmap images." help="The 'histogram' equalization method flatterns the distribution of intensities. The hotspot 'suppression' method uses thresholding to reduce the intensities of hotspots"> |
220 <option value="none" selected="True">none</option> | |
221 <option value="suppression">suppression</option> | |
222 <option value="histogram">histogram</option> | |
223 </param> | |
224 <param name="image_smoothing" type="select" label="Select an image smoothing function for the heatmap images." help="The 'gaussian' smoothing method smooths images with a simple gaussian kernel. The 'adaptive' method uses bilateral filtering to preserve edges."> | |
225 <option value="none" selected="True">none</option> | |
226 <option value="gaussian">gaussian</option> | |
227 <option value="adaptive">adaptive</option> | |
228 </param> | |
229 <param name="plusminus_dalton" value="0.25" type="float" label="Mass range" help="plusminus mass window in Dalton"/> | |
204 </inputs> | 230 </inputs> |
205 <outputs> | 231 <outputs> |
206 <data format="pdf" name="plots" from_work_dir="heatmaps.pdf" label = "${tool.name} on $infile.display_name"/> | 232 <data format="pdf" name="plots" from_work_dir="heatmaps.pdf" label = "${tool.name} on $infile.display_name"/> |
233 <data format="tabular" name="pixel_count" label="Number of pixels per mz with intensity"/> | |
207 </outputs> | 234 </outputs> |
208 <tests> | 235 <tests> |
209 <test> | 236 <test> |
210 <param name="infile" value="" ftype="imzml"> | 237 <param name="infile" value="" ftype="imzml"> |
211 <composite_data value="Example_Continuous.imzML"/> | 238 <composite_data value="Example_Continuous.imzML"/> |
212 <composite_data value="Example_Continuous.ibd"/> | 239 <composite_data value="Example_Continuous.ibd"/> |
213 </param> | 240 </param> |
214 <param name="massfile" value="inputpeptides.csv" ftype="tabular"/> | 241 <param name="massfile" value="inputpeptides.tabular" ftype="tabular"/> |
215 <param name="plusminusinDalton" value="0.25"/> | 242 <param name="plusminus_dalton" value="0.25"/> |
216 <param name="filename" value="Testfile_imzml"/> | 243 <param name="filename" value="Testfile_imzml"/> |
244 <param name="image_contrast" value="histogram"/> | |
217 <output name="plots" file="Heatmaps_imzml.pdf" compare="sim_size" delta="20000"/> | 245 <output name="plots" file="Heatmaps_imzml.pdf" compare="sim_size" delta="20000"/> |
218 </test> | 246 </test> |
219 | 247 |
220 <test> | 248 <test> |
221 <param name="infile" value="" ftype="analyze75"> | 249 <param name="infile" value="" ftype="analyze75"> |
222 <composite_data value="Analyze75.hdr"/> | 250 <composite_data value="Analyze75.hdr"/> |
223 <composite_data value="Analyze75.img"/> | 251 <composite_data value="Analyze75.img"/> |
224 <composite_data value="Analyze75.t2m"/> | 252 <composite_data value="Analyze75.t2m"/> |
225 </param> | 253 </param> |
226 <param name="massfile" value="inputpeptides.txt" ftype="tabular"/> | 254 <param name="massfile" value="inputpeptides2.tabular" ftype="tabular"/> |
227 <param name="plusminusinDalton" value="0.5"/> | 255 <param name="plusminus_dalton" value="0.5"/> |
228 <param name="filename" value="Testfile_analyze75"/> | 256 <param name="filename" value="Testfile_analyze75"/> |
257 <param name="image_smoothing" value="gaussian"/> | |
229 <output name="plots" file="Heatmaps_analyze75.pdf" compare="sim_size" delta="20000"/> | 258 <output name="plots" file="Heatmaps_analyze75.pdf" compare="sim_size" delta="20000"/> |
230 </test> | 259 </test> |
231 <test> | 260 <test> |
232 <param name="infile" value="preprocessing_results1.RData" ftype="rdata"/> | 261 <param name="infile" value="preprocessing_results1.RData" ftype="rdata"/> |
233 <param name="massfile" value="inputpeptides.csv" ftype="tabular"/> | 262 <param name="massfile" value="inputpeptides.tabular" ftype="tabular"/> |
234 <param name="plusminusinDalton" value="0.1"/> | 263 <param name="plusminus_dalton" value="0.1"/> |
235 <param name="filename" value="Testfile_rdata"/> | 264 <param name="filename" value="Testfile_rdata"/> |
236 <output name="plots" file="Heatmaps_rdata.pdf" compare="sim_size" delta="20000"/> | 265 <output name="plots" file="Heatmaps_rdata.pdf" compare="sim_size" delta="20000"/> |
237 </test> | 266 </test> |
238 <test> | 267 <test> |
239 <param name="infile" value="LM8_file16.rdata" ftype="rdata"/> | 268 <param name="infile" value="LM8_file16.rdata" ftype="rdata"/> |
240 <param name="massfile" value="inputpeptides.txt" ftype="tabular"/> | 269 <param name="massfile" value="inputpeptides2.tabular" ftype="tabular"/> |
241 <param name="plusminusinDalton" value="0.1"/> | 270 <param name="plusminus_dalton" value="0.1"/> |
242 <param name="filename" value="Testfile_rdata"/> | 271 <param name="filename" value="Testfile_rdata"/> |
243 <output name="plots" file="Heatmaps_LM8_file16.pdf" compare="sim_size" delta="20000"/> | 272 <output name="plots" file="Heatmaps_LM8_file16.pdf" compare="sim_size" delta="20000"/> |
244 </test> | 273 </test> |
245 </tests> | 274 </tests> |
246 <help><![CDATA[ | 275 <help><![CDATA[ |
247 | 276 |
248 Heatmaps for different ion masses in mass-spectrometry imaging data. | 277 Heatmaps for different masses in mass-spectrometry imaging data as pdf output. |
249 | 278 |
250 Input data: 3 types of input data can be used: | 279 Input data: |
280 | |
281 3 types of mass-spectrometry imaging data can be used: | |
251 | 282 |
252 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <http://ms-imaging.org/wp/introduction/>`_ | 283 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <http://ms-imaging.org/wp/introduction/>`_ |
253 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) | 284 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) |
254 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) | 285 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) |
255 | 286 |
256 The output of this tool contains heatmaps for every ion mass of interest as pdf. | 287 tabular file with masses: |
288 - tab separated file (.tabular), datatype in Galaxy must be tabular (if Galaxy auto-detection was wrong, datatype can be changed by pressing the pen button) | |
289 - no empty fields or letters are allowed (tool crashes with empty fields and a single letter prohibits generation of images) | |
290 - separate point numbers by point (a single number with comma prohibits generation of images) | |
291 | |
292 Trouble shooting: | |
293 - no heatmaps are plotted when tabular file contains letters or point numbers with commas or when the input MSI file had no intensities > 0 | |
294 - contrast enhance functions need masses with intensities > 0 in about 1.5% of all pixels - tool crashes when contrast enhance is used on too few intensities | |
295 | |
257 | 296 |
258 ]]> | 297 ]]> |
259 </help> | 298 </help> |
260 <citations> | 299 <citations> |
261 <citation type="doi">10.1093/bioinformatics/btv146</citation> | 300 <citation type="doi">10.1093/bioinformatics/btv146</citation> |