comparison preprocessing.xml @ 9:e0bbaf9f7da0 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit e499c9124d3fd85a7fc47b95c206ce91a5e3678c-dirty"
author galaxyp
date Tue, 03 Nov 2020 22:41:21 +0000
parents 413a1b74f496
children aa479a0cfb43
comparison
equal deleted inserted replaced
8:413a1b74f496 9:e0bbaf9f7da0
1 <tool id="cardinal_preprocessing" name="MSI preprocessing" version="@VERSION@.2"> 1 <tool id="cardinal_preprocessing" name="MSI preprocessing" version="@VERSION@.1">
2 <description> 2 <description>
3 mass spectrometry imaging preprocessing 3 mass spectrometry imaging preprocessing
4 </description> 4 </description>
5 <macros> 5 <macros>
6 <import>macros.xml</import> 6 <import>macros.xml</import>
7 </macros> 7 </macros>
8 <expand macro="requirements"> 8 <expand macro="requirements">
9 <requirement type="package" version="2.3">r-gridextra</requirement> 9 <requirement type="package" version="2.3">r-gridextra</requirement>
10 <requirement type="package" version="3.2.1">r-ggplot2</requirement> 10 <requirement type="package" version="3.3.2">r-ggplot2</requirement>
11 </expand> 11 </expand>
12 <command detect_errors="exit_code"> 12 <command detect_errors="exit_code">
13 <![CDATA[ 13 <![CDATA[
14 14
15 @INPUT_LINKING@ 15 @INPUT_LINKING@
72 QC_numbers= data.frame(inputdata = c(minmz, maxmz,maxfeatures, pixelcount)) 72 QC_numbers= data.frame(inputdata = c(minmz, maxmz,maxfeatures, pixelcount))
73 vectorofactions = "inputdata" 73 vectorofactions = "inputdata"
74 ## Choose random spectra for QC plots 74 ## Choose random spectra for QC plots
75 random_spectra = sample(pixels(msidata), 4, replace=FALSE) 75 random_spectra = sample(pixels(msidata), 4, replace=FALSE)
76 par(oma=c(0,0,2,0)) 76 par(oma=c(0,0,2,0))
77 print(plot(msidata, pixel=random_spectra)) 77 print(plot(msidata, pixel=random_spectra, col="black"))
78 title("Input spectra", outer=TRUE, line=0) 78 title("Input spectra", outer=TRUE, line=0)
79 79
80 ############################### Preprocessing steps ########################### 80 ############################### Preprocessing steps ###########################
81 ############################################################################### 81 ###############################################################################
82 82
86 86
87 #if str( $method.methods_conditional.preprocessing_method ) == 'Normalization': 87 #if str( $method.methods_conditional.preprocessing_method ) == 'Normalization':
88 print('Normalization') 88 print('Normalization')
89 ##normalization 89 ##normalization
90 90
91 if (class(msidata) == "MSProcessedImagingExperiment"){
92 msidata = as(msidata, "MSContinuousImagingExperiment")
93 }
94
95 msidata = normalize(msidata, method="$method.methods_conditional.methods_for_normalization.normalization_method") 91 msidata = normalize(msidata, method="$method.methods_conditional.methods_for_normalization.normalization_method")
96 msidata <- process(msidata, BPPARAM=MulticoreParam(workers=number_cpu)) 92 msidata <- process(msidata, BPPARAM=MulticoreParam(workers=number_cpu))
97 93
98 94
99 ############################### QC ########################### 95 ############################### QC ###########################
103 minmz = round(min(mz(msidata)), digits=2) 99 minmz = round(min(mz(msidata)), digits=2)
104 maxmz = round(max(mz(msidata)), digits=2) 100 maxmz = round(max(mz(msidata)), digits=2)
105 normalized = c(minmz, maxmz,maxfeatures, pixelcount) 101 normalized = c(minmz, maxmz,maxfeatures, pixelcount)
106 QC_numbers= cbind(QC_numbers, normalized) 102 QC_numbers= cbind(QC_numbers, normalized)
107 vectorofactions = append(vectorofactions, "normalized") 103 vectorofactions = append(vectorofactions, "normalized")
108 print(plot(msidata, pixel=random_spectra)) 104 print(plot(msidata, pixel=random_spectra, col="black"))
109 title("Spectra after normalization", outer=TRUE, line=0) 105 title("Spectra after normalization", outer=TRUE, line=0)
110 106
111 ############################### Baseline reduction ########################### 107 ############################### Baseline reduction ###########################
112 108
113 #elif str( $method.methods_conditional.preprocessing_method ) == 'Baseline_reduction': 109 #elif str( $method.methods_conditional.preprocessing_method ) == 'Baseline_reduction':
114 print('Baseline_reduction') 110 print('Baseline_reduction')
115 ##baseline reduction 111 ##baseline reduction
116 112
117 if (class(msidata) == "MSProcessedImagingExperiment"){
118 msidata = as(msidata, "MSContinuousImagingExperiment")
119 }
120
121 msidata = reduceBaseline(msidata, method="median", blocks=$method.methods_conditional.blocks_baseline, spar=$method.methods_conditional.spar_baseline) 113 msidata = reduceBaseline(msidata, method="median", blocks=$method.methods_conditional.blocks_baseline, spar=$method.methods_conditional.spar_baseline)
122 msidata <- process(msidata, BPPARAM=MulticoreParam(workers=number_cpu)) 114 msidata <- process(msidata, BPPARAM=MulticoreParam(workers=number_cpu))
123 115
124 ############################### QC ########################### 116 ############################### QC ###########################
125 117
128 minmz = round(min(mz(msidata)), digits=2) 120 minmz = round(min(mz(msidata)), digits=2)
129 maxmz = round(max(mz(msidata)), digits=2) 121 maxmz = round(max(mz(msidata)), digits=2)
130 baseline = c(minmz, maxmz,maxfeatures, pixelcount) 122 baseline = c(minmz, maxmz,maxfeatures, pixelcount)
131 QC_numbers= cbind(QC_numbers, baseline) 123 QC_numbers= cbind(QC_numbers, baseline)
132 vectorofactions = append(vectorofactions, "baseline red.") 124 vectorofactions = append(vectorofactions, "baseline red.")
133 print(plot(msidata, pixel=random_spectra)) 125 print(plot(msidata, pixel=random_spectra, col="black"))
134 title("Spectra after baseline reduction", outer=TRUE, line=0) 126 title("Spectra after baseline reduction", outer=TRUE, line=0)
135 127
136 ############################### Smoothing ########################### 128 ############################### Smoothing ###########################
137 129
138 #elif str( $method.methods_conditional.preprocessing_method ) == 'Smoothing': 130 #elif str( $method.methods_conditional.preprocessing_method ) == 'Smoothing':
139 print('Smoothing') 131 print('Smoothing')
140 ## Smoothing 132 ## Smoothing
141
142 if (class(msidata) == "MSProcessedImagingExperiment"){
143 msidata = as(msidata, "MSContinuousImagingExperiment")
144 }
145
146 133
147 #if str( $method.methods_conditional.methods_for_smoothing.smoothing_method) == 'gaussian': 134 #if str( $method.methods_conditional.methods_for_smoothing.smoothing_method) == 'gaussian':
148 print('gaussian smoothing') 135 print('gaussian smoothing')
149 136
150 msidata = smoothSignal(msidata, method="$method.methods_conditional.methods_for_smoothing.smoothing_method", window=$method.methods_conditional.window_smoothing, sd = $method.methods_conditional.methods_for_smoothing.sd_gaussian) 137 msidata = smoothSignal(msidata, method="$method.methods_conditional.methods_for_smoothing.smoothing_method", window=$method.methods_conditional.window_smoothing, sd = $method.methods_conditional.methods_for_smoothing.sd_gaussian)
174 minmz = round(min(mz(msidata)), digits=2) 161 minmz = round(min(mz(msidata)), digits=2)
175 maxmz = round(max(mz(msidata)), digits=2) 162 maxmz = round(max(mz(msidata)), digits=2)
176 smoothed = c(minmz, maxmz,maxfeatures, pixelcount) 163 smoothed = c(minmz, maxmz,maxfeatures, pixelcount)
177 QC_numbers= cbind(QC_numbers, smoothed) 164 QC_numbers= cbind(QC_numbers, smoothed)
178 vectorofactions = append(vectorofactions, "smoothed") 165 vectorofactions = append(vectorofactions, "smoothed")
179 print(plot(msidata, pixel=random_spectra)) 166 print(plot(msidata, pixel=random_spectra, col="black"))
180 title("Spectra after smoothing", outer=TRUE, line=0) 167 title("Spectra after smoothing", outer=TRUE, line=0)
181 168
182 169
183 ############################### Mz alignment ########################### 170 ############################### Mz alignment ###########################
184 171
209 minmz = round(min(mz(msidata)), digits=2) 196 minmz = round(min(mz(msidata)), digits=2)
210 maxmz = round(max(mz(msidata)), digits=2) 197 maxmz = round(max(mz(msidata)), digits=2)
211 mz_aligned = c(minmz, maxmz,maxfeatures, pixelcount) 198 mz_aligned = c(minmz, maxmz,maxfeatures, pixelcount)
212 QC_numbers= cbind(QC_numbers, mz_aligned) 199 QC_numbers= cbind(QC_numbers, mz_aligned)
213 vectorofactions = append(vectorofactions, "mz aligned") 200 vectorofactions = append(vectorofactions, "mz aligned")
214 print(plot(msidata, pixel=random_spectra)) 201 print(plot(msidata, pixel=random_spectra, col="black"))
215 title("Spectra after m/z alignment", outer=TRUE, line=0) 202 title("Spectra after m/z alignment", outer=TRUE, line=0)
216 203
217 204
218 ############################### Peak picking ########################### 205 ############################### Peak picking ###########################
219 206
238 msidata = peakPick(msidata, window = $method.methods_conditional.window_picking, blocks = $method.methods_conditional.blocks_picking, method='$method.methods_conditional.methods_for_picking.picking_method', SNR=$method.methods_conditional.SNR_picking_method) 225 msidata = peakPick(msidata, window = $method.methods_conditional.window_picking, blocks = $method.methods_conditional.blocks_picking, method='$method.methods_conditional.methods_for_picking.picking_method', SNR=$method.methods_conditional.SNR_picking_method)
239 226
240 #end if 227 #end if
241 msidata <- process(msidata, BPPARAM=MulticoreParam(workers=number_cpu)) 228 msidata <- process(msidata, BPPARAM=MulticoreParam(workers=number_cpu))
242 229
243 #if str($method.methods_conditional.imzml_output) == "cont_format":
244 #set $continuous_format = True
245 #end if
246
247 230
248 ############################### QC ########################### 231 ############################### QC ###########################
249 232
250 maxfeatures =nrow(msidata) 233 maxfeatures =nrow(msidata)
251 pixelcount = ncol(msidata) 234 pixelcount = ncol(msidata)
252 minmz = round(min(mz(msidata)), digits=2) 235 minmz = round(min(mz(msidata)), digits=2)
253 maxmz = round(max(mz(msidata)), digits=2) 236 maxmz = round(max(mz(msidata)), digits=2)
254 picked = c(minmz, maxmz,maxfeatures, pixelcount) 237 picked = c(minmz, maxmz,maxfeatures, pixelcount)
255 QC_numbers= cbind(QC_numbers, picked) 238 QC_numbers= cbind(QC_numbers, picked)
256 vectorofactions = append(vectorofactions, "picked") 239 vectorofactions = append(vectorofactions, "picked")
257 print(plot(msidata, pixel=random_spectra)) 240 print(plot(msidata, pixel=random_spectra, col="black"))
258 title("Spectra after peak picking", outer=TRUE, line=0) 241 title("Spectra after peak picking", outer=TRUE, line=0)
259 242
260 ############################### Peak alignment ########################### 243 ############################### Peak alignment ###########################
261 244
262 #elif str( $method.methods_conditional.preprocessing_method ) == 'Peak_alignment': 245 #elif str( $method.methods_conditional.preprocessing_method ) == 'Peak_alignment':
283 266
284 #end if 267 #end if
285 268
286 msidata <- process(msidata, BPPARAM=MulticoreParam(workers=number_cpu)) 269 msidata <- process(msidata, BPPARAM=MulticoreParam(workers=number_cpu))
287 270
288 #if str($method.methods_conditional.imzml_output) == "cont_format":
289 #set $continuous_format = True
290 #end if
291 271
292 ############################### QC ########################### 272 ############################### QC ###########################
293 273
294 maxfeatures =nrow(msidata) 274 maxfeatures =nrow(msidata)
295 pixelcount = ncol(msidata) 275 pixelcount = ncol(msidata)
296 minmz = round(min(mz(msidata)), digits=2) 276 minmz = round(min(mz(msidata)), digits=2)
297 maxmz = round(max(mz(msidata)), digits=2) 277 maxmz = round(max(mz(msidata)), digits=2)
298 aligned = c(minmz, maxmz,maxfeatures, pixelcount) 278 aligned = c(minmz, maxmz,maxfeatures, pixelcount)
299 QC_numbers= cbind(QC_numbers, aligned) 279 QC_numbers= cbind(QC_numbers, aligned)
300 vectorofactions = append(vectorofactions, "aligned") 280 vectorofactions = append(vectorofactions, "aligned")
301 print(plot(msidata, pixel=random_spectra)) 281 print(plot(msidata, pixel=random_spectra, col="black"))
302 title("Spectra after alignment", outer=TRUE, line=0) 282 title("Spectra after alignment", outer=TRUE, line=0)
303 283
304 ############################### Peak filtering ########################### 284 ############################### Peak filtering ###########################
305 285
306 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_filtering': 286 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_filtering':
316 minmz = round(min(mz(msidata)), digits=2) 296 minmz = round(min(mz(msidata)), digits=2)
317 maxmz = round(max(mz(msidata)), digits=2) 297 maxmz = round(max(mz(msidata)), digits=2)
318 filtered = c(minmz, maxmz,maxfeatures, pixelcount) 298 filtered = c(minmz, maxmz,maxfeatures, pixelcount)
319 QC_numbers= cbind(QC_numbers, filtered) 299 QC_numbers= cbind(QC_numbers, filtered)
320 vectorofactions = append(vectorofactions, "filtered") 300 vectorofactions = append(vectorofactions, "filtered")
321 print(plot(msidata, pixel=random_spectra)) 301 print(plot(msidata, pixel=random_spectra, col="black"))
322 title("Spectra after filtering", outer=TRUE, line=0) 302 title("Spectra after filtering", outer=TRUE, line=0)
323 303
324 ############################### Peak binning ########################### 304 ############################### Peak binning ###########################
325 305
326 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_binning': 306 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_binning':
341 minmz = round(min(mz(msidata)), digits=2) 321 minmz = round(min(mz(msidata)), digits=2)
342 maxmz = round(max(mz(msidata)), digits=2) 322 maxmz = round(max(mz(msidata)), digits=2)
343 peak_binned = c(minmz, maxmz,maxfeatures, pixelcount) 323 peak_binned = c(minmz, maxmz,maxfeatures, pixelcount)
344 QC_numbers= cbind(QC_numbers, peak_binned) 324 QC_numbers= cbind(QC_numbers, peak_binned)
345 vectorofactions = append(vectorofactions, "peak binned") 325 vectorofactions = append(vectorofactions, "peak binned")
346 print(plot(msidata, pixel=random_spectra)) 326 print(plot(msidata, pixel=random_spectra, col="black"))
347 title("Spectra after peak binning", outer=TRUE, line=0) 327 title("Spectra after peak binning", outer=TRUE, line=0)
348 328
349 329
350 ############################### Data reduction ########################### 330 ############################### Mass binning ###########################
351 331
352 #elif str( $method.methods_conditional.preprocessing_method) == 'Data_reduction': 332 #elif str( $method.methods_conditional.preprocessing_method) == 'Mass_binning':
353 print('Data_reduction') 333 print('mass binning')
354 334
355 ## these functions only work on MSImageSet 335 #if str( $method.methods_conditional.mz_range.features_filtering) == 'change_mz_range':
356 msidata = as(msidata, "MSImageSet") 336
357 337 #if str($processed_cond.processed_file) == "processed":
358 #if str( $method.methods_conditional.methods_for_reduction.reduction_method) == 'bin': 338
359 print('bin reduction') 339 msidata = mse_bin = mzBin(msidata,resolution=$method.methods_conditional.bin_width, from=$method.methods_conditional.mz_range.min_mz, to=$method.methods_conditional.mz_range.max_mz, units="$method.methods_conditional.bin_units", fun="$method.methods_conditional.bin_fun")
360 340
361 msidata = reduceDimension(msidata, method="bin", width=$method.methods_conditional.methods_for_reduction.bin_width, units="$method.methods_conditional.methods_for_reduction.bin_units", fun=$method.methods_conditional.methods_for_reduction.bin_fun) 341 #else
362 342 ## continuous file cannot be binned from m/z to m/z, therefore first cut m/z range and then do mzbin:
343 msidata = msidata[mz(msidata) >= $method.methods_conditional.mz_range.min_mz & mz(msidata) <= $method.methods_conditional.mz_range.max_mz,]
344 msidata = mse_bin = mzBin(msidata,resolution=$method.methods_conditional.bin_width, units="$method.methods_conditional.bin_units", fun="$method.methods_conditional.bin_fun")
345 #end if
346
347
348 #elif str( $method.methods_conditional.mz_range.features_filtering) == 'none':
349
350 msidata = mse_bin = mzBin(msidata,resolution=$method.methods_conditional.bin_width, units="$method.methods_conditional.bin_units", fun=$method.methods_conditional.bin_fun)
351
352 #end if
353
354 msidata <- process(msidata, BPPARAM=MulticoreParam(workers=number_cpu))
355
363 ## optional: replace NA with 0 356 ## optional: replace NA with 0
364 #if $method.methods_conditional.methods_for_reduction.replace_NA_bin: 357 #if $method.methods_conditional.replace_NA_bin:
365 ## count and replace NAs 358 ## count and replace NAs
366 print(paste0("Number of NA that were set to zero after binning:",sum(is.na(spectra(msidata))))) 359 print(paste0("Number of NA that were set to zero after binning:",sum(is.na(spectra(msidata)))))
367 spectra(msidata)[is.na(spectra(msidata))] = 0 360 spectra(msidata)[is.na(spectra(msidata))] = 0
368 #end if 361 #end if
369 362
370 #elif str( $method.methods_conditional.methods_for_reduction.reduction_method) == 'resample':
371 print('resample reduction')
372
373 msidata = reduceDimension(msidata, method="resample", step=$method.methods_conditional.methods_for_reduction.resample_step)
374 #end if
375
376 ## coercition into new format
377 msidata = as(msidata, "MSImagingExperiment")
378
379 ############################### QC ########################### 363 ############################### QC ###########################
380 364
381 maxfeatures =nrow(msidata) 365 maxfeatures =nrow(msidata)
382 pixelcount = ncol(msidata) 366 pixelcount = ncol(msidata)
383 minmz = round(min(mz(msidata)), digits=2) 367 minmz = round(min(mz(msidata)), digits=2)
384 maxmz = round(max(mz(msidata)), digits=2) 368 maxmz = round(max(mz(msidata)), digits=2)
385 reduced = c(minmz, maxmz,maxfeatures, pixelcount) 369 reduced = c(minmz, maxmz,maxfeatures, pixelcount)
386 QC_numbers= cbind(QC_numbers, reduced) 370 QC_numbers= cbind(QC_numbers, reduced)
387 vectorofactions = append(vectorofactions, "reduced") 371 vectorofactions = append(vectorofactions, "reduced")
388 print(plot(msidata, pixel=random_spectra)) 372 print(plot(msidata, pixel=random_spectra, col="black"))
389 title("Spectra after data reduction", outer=TRUE, line=0) 373 title("Spectra after m/z binning", outer=TRUE, line=0)
390 374
391 ############################### Transformation ########################### 375 ############################### Transformation ###########################
392 376
393 #elif str( $method.methods_conditional.preprocessing_method) == 'Transformation': 377 #elif str( $method.methods_conditional.preprocessing_method) == 'Transformation':
394 print('Transformation') 378 print('Transformation')
426 minmz = round(min(mz(msidata)), digits=2) 410 minmz = round(min(mz(msidata)), digits=2)
427 maxmz = round(max(mz(msidata)), digits=2) 411 maxmz = round(max(mz(msidata)), digits=2)
428 transformed = c(minmz, maxmz,maxfeatures, pixelcount) 412 transformed = c(minmz, maxmz,maxfeatures, pixelcount)
429 QC_numbers= cbind(QC_numbers, transformed) 413 QC_numbers= cbind(QC_numbers, transformed)
430 vectorofactions = append(vectorofactions, "transformed") 414 vectorofactions = append(vectorofactions, "transformed")
431 print(plot(msidata, pixel=random_spectra)) 415 print(plot(msidata, pixel=random_spectra, col="black"))
432 title("Spectra after transformation", outer=TRUE, line=0) 416 title("Spectra after transformation", outer=TRUE, line=0)
433 417
434 #end if 418 #end if
435 #end for 419 #end for
436 420
437 ############# Outputs: RData, imzml and QC report ############# 421 ############# Outputs: RData, imzml and QC report #############
438 ################################################################################ 422 ################################################################################
439 423
440 ## save msidata as imzML file, will only work if there is at least 1 m/z left 424 ## save msidata as imzML file, will only work if there is at least 1 m/z left
425
426 #if str($imzml_output) == "cont_format":
427 #set $continuous_format = True
428 #end if
441 429
442 if (nrow(msidata) > 0){ 430 if (nrow(msidata) > 0){
443 ## make sure that coordinates are integers 431 ## make sure that coordinates are integers
444 coord(msidata)\$y = as.integer(coord(msidata)\$y) 432 coord(msidata)\$y = as.integer(coord(msidata)\$y)
445 coord(msidata)\$x = as.integer(coord(msidata)\$x) 433 coord(msidata)\$x = as.integer(coord(msidata)\$x)
477 <option value="mz_alignment">m/z alignment</option> 465 <option value="mz_alignment">m/z alignment</option>
478 <option value="Peak_picking">Peak picking</option> 466 <option value="Peak_picking">Peak picking</option>
479 <option value="Peak_alignment">Peak alignment</option> 467 <option value="Peak_alignment">Peak alignment</option>
480 <option value="Peak_filtering">Peak filtering</option> 468 <option value="Peak_filtering">Peak filtering</option>
481 <option value="Peak_binning">Peak binning to reference peaks</option> 469 <option value="Peak_binning">Peak binning to reference peaks</option>
482 <option value="Data_reduction">Data reduction</option> 470 <option value="Mass_binning">m/z binning</option>
483 <option value="Transformation">Transformation</option> 471 <option value="Transformation">Transformation</option>
484 </param> 472 </param>
485 <when value="Normalization"> 473 <when value="Normalization">
486 <conditional name="methods_for_normalization"> 474 <conditional name="methods_for_normalization">
487 <param name="normalization_method" type="select" label="Normalization method"> 475 <param name="normalization_method" type="select" label="Normalization method">
574 for throwing away false noise spikes that might occur inside peaks"/> 562 for throwing away false noise spikes that might occur inside peaks"/>
575 </when> 563 </when>
576 <when value="mad"/> 564 <when value="mad"/>
577 <when value="simple"/> 565 <when value="simple"/>
578 </conditional> 566 </conditional>
579 <param name="imzml_output" type="boolean" label="imzML output in processed format" checked="True" truevalue="proc_format" falsevalue="cont_format"/>
580 </when> 567 </when>
581 <when value="Peak_alignment"> 568 <when value="Peak_alignment">
582 <param name="value_diffalignment" type="float" value="200" 569 <param name="value_diffalignment" type="float" value="200"
583 label="tolerance" help="Peaks that differ less than this value will be aligned together"/> 570 label="tolerance" help="Peaks that differ less than this value will be aligned together"/>
584 <param name="units_diffalignment" type="select" display="radio" optional="False" label="units"> 571 <param name="units_diffalignment" type="select" display="radio" optional="False" label="units">
593 <when value="align_noref"/> 580 <when value="align_noref"/>
594 <when value="align_table"> 581 <when value="align_table">
595 <expand macro="reading_1_column_mz_tabular" label="Tabular file with m/z features to use for alignment. Only the m/z values from the tabular file will be kept."/> 582 <expand macro="reading_1_column_mz_tabular" label="Tabular file with m/z features to use for alignment. Only the m/z values from the tabular file will be kept."/>
596 </when> 583 </when>
597 </conditional> 584 </conditional>
598 <param name="imzml_output" type="boolean" label="imzML output in processed format" checked="True" truevalue="proc_format" falsevalue="cont_format" help= "Processed imzML works only in MALDIquant tools, not yet in MSI tools (Cardinal)"/>
599 </when> 585 </when>
600 <when value="Peak_filtering"> 586 <when value="Peak_filtering">
601 <param name="frequ_filtering" type="float" value="0.01" max="1" min="0" label="Minimum frequency" help="Peaks that occur in the dataset in lesser proportion than this will be dropped (0.01 --> filtering for 1% of spectra)"/> 587 <param name="frequ_filtering" type="float" value="0.01" max="1" min="0" label="Minimum frequency" help="Peaks that occur in the dataset in lesser proportion than this will be dropped (0.01 --> filtering for 1% of spectra)"/>
602 </when> 588 </when>
603 <when value="Peak_binning"> 589 <when value="Peak_binning">
618 label="Should the peak height or area under the curve be taken as the intensity value?"> 604 label="Should the peak height or area under the curve be taken as the intensity value?">
619 <option value="height" selected="True">height</option> 605 <option value="height" selected="True">height</option>
620 <option value="area">area</option> 606 <option value="area">area</option>
621 </param> 607 </param>
622 </when> 608 </when>
623 <when value="Data_reduction"> 609 <when value="Mass_binning">
624 <conditional name="methods_for_reduction"> 610 <param name="bin_width" type="float" value="1" label="The width of a bin in m/z or ppm" help="Width must be greater than range of m/z values divided by number of m/z features"/>
625 <param name="reduction_method" type="select" label="Reduction method"> 611 <param name="bin_units" type="select" display="radio"
626 <option value="bin" selected="True">bin</option> 612 label="Unit for bin">
627 <option value="resample">resample</option> 613 <option value="mz" selected="True">mz</option>
614 <option value="ppm">ppm</option>
615 </param>
616 <param name="bin_fun" type="select" display="radio"
617 label="Calculate sum or mean intensity for ions of the same bin">
618 <option value="mean" selected="True">mean</option>
619 <option value="sum">sum</option>
620 </param>
621 <param name="replace_NA_bin" type="boolean" label="Replace NA with 0" truevalue="TRUE" falsevalue="FALSE" checked="True" help="Binning can introduce NAs, should they be replaced with 0"/>
622 <conditional name="mz_range">
623 <param name="features_filtering" type="select" label="Select m/z feature filtering option">
624 <option value="none" selected="True">none</option>
625 <option value="change_mz_range">change m/z range</option>
628 </param> 626 </param>
629 <when value="bin"> 627 <when value="none"/>
630 <param name="bin_width" type="float" value="1" 628 <when value="change_mz_range">
631 label="The width of a bin in m/z or ppm" help="Width must be greater than range of m/z values divided by number of m/z features"/> 629 <param name="min_mz" type="float" value="1" label="Minimum value for m/z"/>
632 <param name="bin_units" type="select" display="radio" 630 <param name="max_mz" type="float" value="10000" label="Maximum value for m/z"/>
633 label="Unit for bin"> 631 </when>
634 <option value="mz" selected="True">mz</option>
635 <option value="ppm">ppm</option>
636 </param>
637 <param name="bin_fun" type="select" display="radio"
638 label="Calculate sum or mean intensity for ions of the same bin">
639 <option value="mean" selected="True">mean</option>
640 <option value="sum">sum</option>
641 </param>
642 <param name="replace_NA_bin" type="boolean" label="Replace NA with 0" truevalue="TRUE" falsevalue="FALSE" checked="True" help="Binning can introduce NAs, should they be replaced with 0"/>
643 </when>
644 <when value="resample">
645 <param name="resample_step" type="float" value="1"
646 label="The step size in m/z" help="Step size must be greater than range of m/z values divided by number of m/z features"/>
647 </when>
648 </conditional> 632 </conditional>
649 </when> 633 </when>
650 <when value="Transformation"> 634 <when value="Transformation">
651 <conditional name="transf_conditional"> 635 <conditional name="transf_conditional">
652 <param name="trans_type" type="select" label="Intensity transformations" help="logarithm base 2 (log2) or squareroot (sqrt)"> 636 <param name="trans_type" type="select" label="Intensity transformations" help="logarithm base 2 (log2) or squareroot (sqrt)">
659 <when value="sqrt"/> 643 <when value="sqrt"/>
660 </conditional> 644 </conditional>
661 </when> 645 </when>
662 </conditional> 646 </conditional>
663 </repeat> 647 </repeat>
648 <param name="imzml_output" type="boolean" label="imzML output in processed format" checked="True" truevalue="proc_format" falsevalue="cont_format"/>
664 </inputs> 649 </inputs>
665 <outputs> 650 <outputs>
666 <data format="imzml" name="outfile_imzml" label="${tool.name} on ${on_string}: imzML"/> 651 <data format="imzml" name="outfile_imzml" label="${tool.name} on ${on_string}: imzML"/>
667 <data format="pdf" name="QC_overview" from_work_dir="Preprocessing.pdf" label = "${tool.name} on ${on_string}: QC"/> 652 <data format="pdf" name="QC_overview" from_work_dir="Preprocessing.pdf" label = "${tool.name} on ${on_string}: QC"/>
668 </outputs> 653 </outputs>
694 <param name="picking_method" value="adaptive"/> 679 <param name="picking_method" value="adaptive"/>
695 </conditional> 680 </conditional>
696 <param name="blocks_picking" value="3"/> 681 <param name="blocks_picking" value="3"/>
697 <param name="window_picking" value="3"/> 682 <param name="window_picking" value="3"/>
698 <param name="SNR_picking_method" value="3"/> 683 <param name="SNR_picking_method" value="3"/>
699 <param name="imzml_output" value="cont_format"/>
700 </conditional> 684 </conditional>
701 </repeat> 685 </repeat>
702 <repeat name="methods"> 686 <repeat name="methods">
703 <conditional name="methods_conditional"> 687 <conditional name="methods_conditional">
704 <param name="preprocessing_method" value="Peak_alignment"/> 688 <param name="preprocessing_method" value="Peak_alignment"/>
705 <param name="imzml_output" value="cont_format"/>
706 </conditional> 689 </conditional>
707 </repeat> 690 </repeat>
708 <repeat name="methods"> 691 <repeat name="methods">
709 <conditional name="methods_conditional"> 692 <conditional name="methods_conditional">
710 <param name="preprocessing_method" value="Peak_filtering"/> 693 <param name="preprocessing_method" value="Peak_filtering"/>
717 <conditional name="transf_conditional"> 700 <conditional name="transf_conditional">
718 <param name="trans_type" value="sqrt"/> 701 <param name="trans_type" value="sqrt"/>
719 </conditional> 702 </conditional>
720 </conditional> 703 </conditional>
721 </repeat> 704 </repeat>
705 <param name="imzml_output" value="cont_format"/>
722 <output name="QC_overview" file="preprocessing_results1.pdf" compare="sim_size"/> 706 <output name="QC_overview" file="preprocessing_results1.pdf" compare="sim_size"/>
723 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results1.imzml.txt" compare="sim_size"> 707 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results1.imzml.txt" compare="sim_size">
724 <extra_files type="file" file="preprocessing_results1.imzml" name="imzml" lines_diff="6"/> 708 <extra_files type="file" file="preprocessing_results1.imzml" name="imzml" lines_diff="6"/>
725 <extra_files type="file" file="preprocessing_results1.ibd" name="ibd" compare="sim_size"/> 709 <extra_files type="file" file="preprocessing_results1.ibd" name="ibd" compare="sim_size"/>
726 </output> 710 </output>
734 <param name="window_picking" value="5"/> 718 <param name="window_picking" value="5"/>
735 <param name="SNR_picking_method" value="2"/> 719 <param name="SNR_picking_method" value="2"/>
736 <conditional name="methods_for_picking"> 720 <conditional name="methods_for_picking">
737 <param name="picking_method" value="adaptive"/> 721 <param name="picking_method" value="adaptive"/>
738 </conditional> 722 </conditional>
739 <param name="imzml_output" value="cont_format"/>
740 </conditional> 723 </conditional>
741 </repeat> 724 </repeat>
742 <repeat name="methods"> 725 <repeat name="methods">
743 <conditional name="methods_conditional"> 726 <conditional name="methods_conditional">
744 <param name="preprocessing_method" value="Peak_alignment"/> 727 <param name="preprocessing_method" value="Peak_alignment"/>
745 <param name="imzml_output" value="cont_format"/> 728 </conditional>
746 </conditional> 729 </repeat>
747 </repeat> 730 <param name="imzml_output" value="cont_format"/>
748 <output name="QC_overview" file="preprocessing_results2.pdf" compare="sim_size"/> 731 <output name="QC_overview" file="preprocessing_results2.pdf" compare="sim_size"/>
749 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results2.imzml.txt" compare="sim_size"> 732 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results2.imzml.txt" compare="sim_size">
750 <extra_files type="file" file="preprocessing_results2.imzml" name="imzml" lines_diff="6"/> 733 <extra_files type="file" file="preprocessing_results2.imzml" name="imzml" lines_diff="6"/>
751 <extra_files type="file" file="preprocessing_results2.ibd" name="ibd" compare="sim_size"/> 734 <extra_files type="file" file="preprocessing_results2.ibd" name="ibd" compare="sim_size"/>
752 </output> 735 </output>
798 <param name="preprocessing_method" value="mz_alignment"/> 781 <param name="preprocessing_method" value="mz_alignment"/>
799 </conditional> 782 </conditional>
800 </repeat> 783 </repeat>
801 <repeat name="methods"> 784 <repeat name="methods">
802 <conditional name="methods_conditional"> 785 <conditional name="methods_conditional">
803 <param name="preprocessing_method" value="Data_reduction"/> 786 <param name="preprocessing_method" value="Mass_binning"/>
804 <conditional name="methods_for_reduction">
805 <param name="reduction_method" value="bin"/>
806 <param name="bin_width" value="0.1"/> 787 <param name="bin_width" value="0.1"/>
807 </conditional> 788 <param name="bin_units" value="mz"/>
808 </conditional> 789 </conditional>
809 </repeat> 790 </repeat>
810 <output name="QC_overview" file="preprocessing_results4.pdf" compare="sim_size"/> 791 <output name="QC_overview" file="preprocessing_results4.pdf" compare="sim_size"/>
811 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results4.imzml.txt" compare="sim_size"> 792 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results4.imzml.txt" compare="sim_size">
812 <extra_files type="file" file="preprocessing_results4.imzml" name="imzml" lines_diff="6"/> 793 <extra_files type="file" file="preprocessing_results4.imzml" name="imzml" lines_diff="6"/>
815 </test> 796 </test>
816 <test> 797 <test>
817 <expand macro="processed_infile_imzml"/> 798 <expand macro="processed_infile_imzml"/>
818 <conditional name="processed_cond"> 799 <conditional name="processed_cond">
819 <param name="processed_file" value="processed"/> 800 <param name="processed_file" value="processed"/>
820 <param name="accuracy" value="100"/> 801 <param name="accuracy" value="200"/>
821 <param name="units" value="ppm"/> 802 <param name="units" value="ppm"/>
822 </conditional> 803 </conditional>
823 <repeat name="methods"> 804 <repeat name="methods">
824 <conditional name="methods_conditional"> 805 <conditional name="methods_conditional">
825 <param name="preprocessing_method" value="Transformation"/> 806 <param name="preprocessing_method" value="Transformation"/>
853 - Coordinates stored as decimals rather than integers will be rounded to obtain a regular pixel grid. This might lead to duplicated coordinates which will be automatically removed after the data is read by the tool. 834 - Coordinates stored as decimals rather than integers will be rounded to obtain a regular pixel grid. This might lead to duplicated coordinates which will be automatically removed after the data is read by the tool.
854 @MZ_TABULAR_INPUT_DESCRIPTION@ 835 @MZ_TABULAR_INPUT_DESCRIPTION@
855 836
856 **Options** 837 **Options**
857 838
858 - Normalization: Normalization of intensities to total ion current (TIC) or to root-mean-square (RMS) 839 - Normalization: normalization of intensities to total ion current (TIC) or to root-mean-square (RMS)
859 - Baseline reduction: Baseline reduction removes background intensity generated by chemical noise (common in MALDI datasets) 840 - Baseline reduction: baseline reduction removes background intensity generated by chemical noise (common in MALDI datasets)
860 - Smoothing: Smoothing of the peaks reduces noise and improves peak detection 841 - Smoothing: Smoothing of the peaks reduces noise and improves peak detection
842 - m/z alignment: removes small m/z shifts between spectra
861 - Peak picking: relevant peaks are picked while noise-peaks are removed (needs peak alignment afterwards) 843 - Peak picking: relevant peaks are picked while noise-peaks are removed (needs peak alignment afterwards)
862 - Peak alignment: only possible after peak picking, m/z inaccuracies are removed by alignment of same peaks to a common m/z value; if no reference is given the peaks are aligned to the local maxima of the mean spectrum of the current dataset; external reference data can be used from another MSI data file or a tabular file with m/z values, but then only the m/z from the reference will be kept 844 - Peak alignment: only possible after peak picking, m/z inaccuracies are removed by alignment of same peaks to a common m/z value; if no reference is given the peaks are aligned to the local maxima of the mean spectrum of the current dataset; external reference data can be used from another MSI data file or a tabular file with m/z values, but then only the m/z from the reference will be kept
863 - Peak filtering: removes peaks that occur only in a small proportion of pixels. If not sure which cut off to choose run quality control tool first and decide according to the number of peaks per m/z plot 845 - Peak filtering: removes peaks that occur only in a small proportion of pixels. If not sure which cut off to choose run quality control tool first and decide according to the number of peaks per m/z plot
864 - Peak binning: extracts peaks intensities (from a profile dataset) for a list of m/z (reference) values 846 - Peak binning: extracts peaks intensities, either peak height or area under curve (from a profile dataset) for a list of m/z (reference) values
865 - Data reduction: binning or resampling to reduce data 847 - m/z binning: generates new m/z bins
866 - Transformation: log2 or squareroot transformation of all intensities; when using log2 transformation zero intensities will become NA, this can lead to compatibility problems. 848 - Transformation: log2 or squareroot transformation of all intensities; when using log2 transformation zero intensities will become NA, this can lead to compatibility problems.
849
867 850
868 **Output** 851 **Output**
869 852
870 - MSI data as continuous or processed imzML file 853 - MSI data as continuous or processed imzML file
871 - pdf with key values and four random mass spectra after each processing step 854 - pdf with key values and four random mass spectra after each processing step