comparison maldi_quant_preprocessing.xml @ 2:e754c2b545a9 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/MALDIquant commit d2f311f7fff24e54c565127c40414de708e31b3c
author galaxyp
date Thu, 25 Oct 2018 07:31:55 -0400
parents 0892a051eb17
children 71411ac28268
comparison
equal deleted inserted replaced
1:0892a051eb17 2:e754c2b545a9
1 <tool id="maldi_quant_preprocessing" name="MALDIquant preprocessing" version="@VERSION@.1"> 1 <tool id="maldi_quant_preprocessing" name="MALDIquant preprocessing" version="@VERSION@.2">
2 <description> 2 <description>
3 Preprocessing of mass-spectrometry imaging data 3 Preprocessing of mass-spectrometry imaging data
4 </description> 4 </description>
5 <macros> 5 <macros>
6 <import>maldi_macros.xml</import> 6 <import>maldi_macros.xml</import>
7 </macros> 7 </macros>
8 <expand macro="requirements"/> 8 <expand macro="requirements"/>
9 <command detect_errors="exit_code"> 9 <command detect_errors="exit_code">
10 <![CDATA[ 10 <![CDATA[
11 cat '${maldi_quant_preprocessing}' &&
11 #if $infile.ext == 'imzml' 12 #if $infile.ext == 'imzml'
12 cp '${infile.extra_files_path}/imzml' infile.imzML && 13 cp '${infile.extra_files_path}/imzml' infile.imzML &&
13 cp '${infile.extra_files_path}/ibd' infile.ibd && 14 cp '${infile.extra_files_path}/ibd' infile.ibd &&
14 #elif $infile.ext == 'analyze75' 15 #elif $infile.ext == 'analyze75'
15 cp '${infile.extra_files_path}/hdr' infile.hdr && 16 cp '${infile.extra_files_path}/hdr' infile.hdr &&
20 du -s -B1 infile.hdr && 21 du -s -B1 infile.hdr &&
21 #else 22 #else
22 ln -s $infile infile.RData && 23 ln -s $infile infile.RData &&
23 #end if 24 #end if
24 Rscript "${maldi_quant_preprocessing}" && 25 Rscript "${maldi_quant_preprocessing}" &&
26
25 mkdir $outfile_imzml.files_path && 27 mkdir $outfile_imzml.files_path &&
26 mv ./out.imzMl "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true && 28 mv ./out.imzMl "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true &&
27 mv ./out.ibd "${os.path.join($outfile_imzml.files_path, 'ibd')}" | true && 29 mv ./out.ibd "${os.path.join($outfile_imzml.files_path, 'ibd')}" | true &&
28 echo "imzML file:" > $outfile_imzml && 30 echo "imzML file:" > $outfile_imzml &&
29 ls -l "$outfile_imzml.files_path" >> $outfile_imzml 31 ls -l "$outfile_imzml.files_path" >> $outfile_imzml
52 ## Import imzML file 54 ## Import imzML file
53 maldi_data = import( 'infile.imzML', type="imzML" ) 55 maldi_data = import( 'infile.imzML', type="imzML" )
54 coordinates_info = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data))) 56 coordinates_info = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data)))
55 #elif $infile.ext == 'analyze75' 57 #elif $infile.ext == 'analyze75'
56 ## Import analyze7.5 file 58 ## Import analyze7.5 file
57 maldi_data = import( 'infile.hdr' ) 59 maldi_data = importAnalyze( 'infile.hdr' )
58 coordinates_info = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data))) 60 coordinates_info = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data)))
59 #else 61 #else
60 loadRData <- function(fileName){ 62 loadRData <- function(fileName){
61 #loads an RData file, and returns it 63 #loads an RData file, and returns it
62 load(fileName) 64 load(fileName)
140 plot(avgSpectra, main="Average spectrum for input file") 142 plot(avgSpectra, main="Average spectrum for input file")
141 143
142 pixel_number = length(maldi_data) 144 pixel_number = length(maldi_data)
143 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4) 145 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
144 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4) 146 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
145 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2) 147 mean_features = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
148 number_features = length(unique(unlist(lapply(maldi_data,mass))))
146 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2) 149 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
147 inputdata = c(minmz, maxmz,maxfeatures, medint) 150 inputdata = c(minmz, maxmz,number_features,mean_features, medint)
148 QC_numbers= data.frame(inputdata = c(minmz, maxmz,maxfeatures, medint)) 151 QC_numbers= data.frame(inputdata = c(minmz, maxmz,number_features, mean_features, medint))
149 vectorofactions = "inputdata" 152 vectorofactions = "inputdata"
150 153
151 154
152 #for $method in $methods: 155 #for $method in $methods:
153 156
160 avgSpectra = averageMassSpectra(maldi_data,method="mean") 163 avgSpectra = averageMassSpectra(maldi_data,method="mean")
161 plot(avgSpectra, main="Average spectrum after transformation") 164 plot(avgSpectra, main="Average spectrum after transformation")
162 pixel_number = length(maldi_data) 165 pixel_number = length(maldi_data)
163 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4) 166 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
164 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4) 167 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
165 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2) 168 mean_features = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
166 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2) 169 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
167 transformed = c(minmz, maxmz,maxfeatures, medint) 170 number_features = length(unique(unlist(lapply(maldi_data,mass))))
171 transformed = c(minmz, maxmz,number_features,mean_features, medint)
168 QC_numbers= cbind(QC_numbers, transformed) 172 QC_numbers= cbind(QC_numbers, transformed)
169 vectorofactions = append(vectorofactions, "transformed") 173 vectorofactions = append(vectorofactions, "transformed")
170 174
171 175
172 #elif str( $method.methods_conditional.method ) == 'Smoothing': 176 #elif str( $method.methods_conditional.method ) == 'Smoothing':
194 avgSpectra = averageMassSpectra(maldi_data,method="mean") 198 avgSpectra = averageMassSpectra(maldi_data,method="mean")
195 plot(avgSpectra, main="Average spectrum after smoothing", sub="") 199 plot(avgSpectra, main="Average spectrum after smoothing", sub="")
196 pixel_number = length(maldi_data) 200 pixel_number = length(maldi_data)
197 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4) 201 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
198 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4) 202 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
199 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2) 203 mean_features = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
200 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2) 204 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
201 smoothed = c(minmz, maxmz,maxfeatures, medint) 205 number_features = length(unique(unlist(lapply(maldi_data,mass))))
206 smoothed = c(minmz, maxmz,number_features,mean_features, medint)
202 QC_numbers= cbind(QC_numbers, smoothed) 207 QC_numbers= cbind(QC_numbers, smoothed)
203 vectorofactions = append(vectorofactions, "smoothed") 208 vectorofactions = append(vectorofactions, "smoothed")
204 209
205 210
206 #elif str( $method.methods_conditional.method ) == 'Baseline': 211 #elif str( $method.methods_conditional.method ) == 'Baseline':
249 avgSpectra = averageMassSpectra(maldi_data,method="mean") 254 avgSpectra = averageMassSpectra(maldi_data,method="mean")
250 plot(avgSpectra, main="Average spectrum after baseline removal") 255 plot(avgSpectra, main="Average spectrum after baseline removal")
251 pixel_number = length(maldi_data) 256 pixel_number = length(maldi_data)
252 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4) 257 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
253 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4) 258 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
254 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2) 259 mean_features = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
255 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2) 260 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
256 baseline_removed = c(minmz, maxmz,maxfeatures, medint) 261 number_features = length(unique(unlist(lapply(maldi_data,mass))))
262 baseline_removed = c(minmz, maxmz,number_features,mean_features, medint)
257 QC_numbers= cbind(QC_numbers, baseline_removed) 263 QC_numbers= cbind(QC_numbers, baseline_removed)
258 vectorofactions = append(vectorofactions, "baseline_removed") 264 vectorofactions = append(vectorofactions, "baseline_removed")
259 265
260 266
261 #elif str( $method.methods_conditional.method ) == 'Calibrate': 267 #elif str( $method.methods_conditional.method ) == 'Calibrate':
262 268
263 print('calibrate') 269 print('calibrate')
264 ##calibrate 270 ##calibrate
265 271
266 #if $method.methods_conditional.mass_start != 0 and $method.methods_conditional.mass_end != 0: 272 #if str($method.methods_conditional.cond_calibration_range) == "yes":
267 ## calibrate only given m/z range 273 ## calibrate only given m/z range
268 maldi_data = calibrateIntensity(maldi_data, 274 maldi_data = calibrateIntensity(maldi_data,
269 method="$method.methods_conditional.calibrate_method", 275 method="$method.methods_conditional.calibrate_method",
270 range=c($method.methods_conditional.mass_start, $method.methods_conditional.mass_end)) 276 range=c($method.methods_conditional.cond_calibration_range.mass_start, $method.methods_conditional.cond_calibration_range.mass_end))
271 #else: 277 #else:
272 maldi_data = calibrateIntensity(maldi_data, 278 maldi_data = calibrateIntensity(maldi_data,
273 method="$method.methods_conditional.calibrate_method") 279 method="$method.methods_conditional.calibrate_method")
274 #end if 280 #end if
275 ## QC plot and numbers 281 ## QC plot and numbers
276 avgSpectra = averageMassSpectra(maldi_data,method="mean") 282 avgSpectra = averageMassSpectra(maldi_data,method="mean")
277 plot(avgSpectra, main="Average spectrum after normalization") 283 plot(avgSpectra, main="Average spectrum after normalization")
278 pixel_number = length(maldi_data) 284 pixel_number = length(maldi_data)
279 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4) 285 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
280 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4) 286 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
281 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2) 287 mean_features = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
282 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2) 288 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
283 intensity_calibrated = c(minmz, maxmz,maxfeatures, medint) 289 number_features = length(unique(unlist(lapply(maldi_data,mass))))
284 QC_numbers= cbind(QC_numbers, intensity_calibrated ) 290 intensity_calibrated = c(minmz, maxmz,number_features,mean_features, medint)
291 QC_numbers= cbind(QC_numbers, intensity_calibrated)
285 vectorofactions = append(vectorofactions, "intensity_calibrated ") 292 vectorofactions = append(vectorofactions, "intensity_calibrated ")
286 293
287 294
288 #elif str( $method.methods_conditional.method ) == 'Align': 295 #elif str( $method.methods_conditional.method ) == 'Align':
289 296
331 }else{"All spectra are empty"} 338 }else{"All spectra are empty"}
332 339
333 pixel_number = length(maldi_data) 340 pixel_number = length(maldi_data)
334 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4) 341 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
335 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4) 342 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
336 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2) 343 mean_features = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
337 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2) 344 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
338 spectra_aligned = c(minmz, maxmz,maxfeatures, medint) 345 number_features = length(unique(unlist(lapply(maldi_data,mass))))
339 QC_numbers= cbind(QC_numbers, spectra_aligned ) 346 spectra_aligned = c(minmz, maxmz,number_features,mean_features, medint)
347 QC_numbers= cbind(QC_numbers, spectra_aligned)
340 vectorofactions = append(vectorofactions, "spectra_aligned") 348 vectorofactions = append(vectorofactions, "spectra_aligned")
341 #end if 349 #end if
342 350
343 #end for 351 #end for
344 352
345 rownames(QC_numbers) = c("min m/z", "max mz", "# features", "median\nintensity") 353 rownames(QC_numbers) = c("min m/z", "max mz", "# features", "median \n# features", "median\nintensity")
346 plot(0,type='n',axes=FALSE,ann=FALSE) 354 plot(0,type='n',axes=FALSE,ann=FALSE)
347 grid.table(t(QC_numbers)) 355 grid.table(t(QC_numbers))
348 356
349 dev.off() 357 dev.off()
350 358
354 MALDIquantForeign::exportImzMl(maldi_data, file="out.imzMl", processed=$export_processed, coordinates=cardinal_coordinates) 362 MALDIquantForeign::exportImzMl(maldi_data, file="out.imzMl", processed=$export_processed, coordinates=cardinal_coordinates)
355 #else 363 #else
356 MALDIquantForeign::exportImzMl(maldi_data, file="out.imzMl", processed=$export_processed) 364 MALDIquantForeign::exportImzMl(maldi_data, file="out.imzMl", processed=$export_processed)
357 #end if 365 #end if
358 366
359 ## export annotation tabular file
360 #if str($tabular_annotation.load_annotation) == 'yes_annotation':
361 write.table(merged_annotation, file="$annotation_output", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t")
362 #end if
363 }else{"All spectra are empty, outputfiles will be empty,too."} 367 }else{"All spectra are empty, outputfiles will be empty,too."}
364 368
365 ]]> 369 ]]>
366 </configfile> 370 </configfile>
367 </configfiles> 371 </configfiles>
368 <inputs> 372 <inputs>
369 <param name="infile" type="data" format="imzml,rdata" label="Inputfile as imzML or Cardinal MSImageSet saved as RData" help="This file is in imzML format or Cardinal MSImageSet saved as RData. The file must be in profile mode, not centroided"/> 373 <param name="infile" type="data" format="imzml,rdata,analyze75" label="Inputfile as imzML or Cardinal MSImageSet saved as RData" help="This file is in imzML format or Cardinal MSImageSet saved as RData. The file must be in profile mode, not centroided"/>
370 <conditional name="restriction_conditional"> 374 <conditional name="restriction_conditional">
371 <param name="restriction" type="select" label="Read in only spectra of interest" help="This option only works for imzML files"> 375 <param name="restriction" type="select" label="Read in only spectra of interest" help="This option only works for imzML files">
372 <option value="no_restriction" selected="True">Calculate on entire file</option> 376 <option value="no_restriction" selected="True">Calculate on entire file</option>
373 <option value="restrict">Restrict to coordinates of interest</option> 377 <option value="restrict">Restrict to coordinates of interest</option>
374 </param> 378 </param>
375 <when value="restrict"> 379 <when value="restrict">
376 <param name="coordinates_file" type="data" format="tabular" label="Tabular file with coordinates" help="x-values in first column, y-values in second column"/> 380 <param name="coordinates_file" type="data" format="tabular" label="Tabular file with coordinates" help="x-values in first column, y-values in second column"/>
377 <param name="coordinates_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/> 381 <param name="coordinates_header" type="boolean" label="File contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
378 </when> 382 </when>
379 <when value="no_restriction"/> 383 <when value="no_restriction"/>
380 </conditional> 384 </conditional>
381 <conditional name="tabular_annotation"> 385 <conditional name="tabular_annotation">
382 <param name="load_annotation" type="select" label="For Cardinal RData only: Use pixel annotation from tabular file to have updated annotation information in case empty spectra will be removed"> 386 <param name="load_annotation" type="select" label="For Cardinal RData only: Use pixel annotation from tabular file to have updated annotation information in case empty spectra will be removed">
387 <param name="annotation_file" type="data" format="tabular" label="Use annotations from tabular file" 391 <param name="annotation_file" type="data" format="tabular" label="Use annotations from tabular file"
388 help="Tabular file with three columns: x values, y values and pixel annotations"/> 392 help="Tabular file with three columns: x values, y values and pixel annotations"/>
389 <param name="column_x" data_ref="annotation_file" label="Column with x values" type="data_column"/> 393 <param name="column_x" data_ref="annotation_file" label="Column with x values" type="data_column"/>
390 <param name="column_y" data_ref="annotation_file" label="Column with y values" type="data_column"/> 394 <param name="column_y" data_ref="annotation_file" label="Column with y values" type="data_column"/>
391 <param name="column_names" data_ref="annotation_file" label="Column with pixel annotations" type="data_column"/> 395 <param name="column_names" data_ref="annotation_file" label="Column with pixel annotations" type="data_column"/>
392 <param name="tabular_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/> 396 <param name="tabular_header" type="boolean" label="File contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
393 </when> 397 </when>
394 <when value="no_annotation"/> 398 <when value="no_annotation"/>
395 </conditional> 399 </conditional>
396 <repeat name="methods" title="Method" min="1"> 400 <repeat name="methods" title="Method" min="1">
397 <conditional name="methods_conditional"> 401 <conditional name="methods_conditional">
402 <option value="Calibrate">Calibrate</option> 406 <option value="Calibrate">Calibrate</option>
403 <option value="Align">Align Spectra (warping/phase correction)</option> 407 <option value="Align">Align Spectra (warping/phase correction)</option>
404 <validator type="empty_field" /> 408 <validator type="empty_field" />
405 </param> 409 </param>
406 <when value="Transformation"> 410 <when value="Transformation">
407 <param name="transform_method" type="select" label="Select the transfprormation method"> 411 <param name="transform_method" type="select" label="Select a transfprormation method">
408 <option value="sqrt" selected="True">sqrt</option> 412 <option value="sqrt" selected="True">sqrt</option>
409 <option value="log">log</option> 413 <option value="log">log</option>
410 <option value="log2">log2</option> 414 <option value="log2">log2</option>
411 <option value="log10">log10</option> 415 <option value="log10">log10</option>
412 <validator type="empty_field" /> 416 <validator type="empty_field" />
417 <param name="smooth_method" type="select" label="This method smoothes the intensity values of a MassSpectrum object"> 421 <param name="smooth_method" type="select" label="This method smoothes the intensity values of a MassSpectrum object">
418 <option value="SavitzkyGolay" selected="True">SavitzkyGolay</option> 422 <option value="SavitzkyGolay" selected="True">SavitzkyGolay</option>
419 <option value="MovingAverage">MovingAverage</option> 423 <option value="MovingAverage">MovingAverage</option>
420 </param> 424 </param>
421 <when value="SavitzkyGolay"> 425 <when value="SavitzkyGolay">
422 <param name="polynomial" value="3" type="text" label="PolynomialOrder argument to control the order of the filter"/> 426 <param name="polynomial" value="3" type="text" label="PolynomialOrder argument to control the order of the filter"
427 help="should be smaller than the resulting window"/>
423 </when> 428 </when>
424 <when value="MovingAverage"> 429 <when value="MovingAverage">
425 <param name="weighted" type="boolean" label="Weighted average" help = "indicates if the average should be equal weight or if it should have weights depending on the distance from the center as calculated as 1/2^abs(-halfWindowSize:halfWindowSize) with the sum of all weigths normalized to 1" truevalue="TRUE" falsevalue="FALSE"/> 430 <param name="weighted" type="boolean" label="Weighted average" help = "Indicates if the average should be equal weight or if it should have weights depending on the distance from the center as calculated as 1/2^abs(-halfWindowSize:halfWindowSize) with the sum of all weigths normalized to 1" truevalue="TRUE" falsevalue="FALSE"/>
426 </when> 431 </when>
427 </conditional> 432 </conditional>
428 <param name="halfWindowSize" type="integer" value="10" 433 <param name="halfWindowSize" type="integer" value="10"
429 label="Half window size" 434 label="Half window size (number of data points)"
430 help="The resulting window reaches from 435 help="The resulting window reaches from
431 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize] 436 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]
432 (window size is 2*halfWindowSize+1). 437 (window size is 2*halfWindowSize+1)."/>
433 The best size differs depending on the selected smoothing method."/>
434 </when> 438 </when>
435 <when value="Baseline"> 439 <when value="Baseline">
436 <conditional name="methods_for_baseline"> 440 <conditional name="methods_for_baseline">
437 <param name="baseline_method" type="select" label="Baseline removal method"> 441 <param name="baseline_method" type="select" label="Baseline removal method">
438 <option value="SNIP" selected="True">SNIP</option> 442 <option value="SNIP" selected="True">SNIP</option>
445 <param name="iterations" type="integer" value="100" 449 <param name="iterations" type="integer" value="100"
446 label="Number of iterations" help="Corresponds to half window size: The resulting window reaches from mass[cur_index-iterations] to mass[cur_index+iterations]"/> 450 label="Number of iterations" help="Corresponds to half window size: The resulting window reaches from mass[cur_index-iterations] to mass[cur_index+iterations]"/>
447 </when> 451 </when>
448 <when value="TopHat"> 452 <when value="TopHat">
449 <param name="tophat_halfWindowSize" type="integer" value="10" 453 <param name="tophat_halfWindowSize" type="integer" value="10"
450 label="Half window size" help="The resulting window reaches from 454 label="Half window size (number of data points)"
455 help="The resulting window reaches from
451 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]"/> 456 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]"/>
452 </when> 457 </when>
453 <when value="ConvexHull"/> 458 <when value="ConvexHull"/>
454 <when value="median"> 459 <when value="median">
455 <param name="median_halfWindowSize" type="integer" value="10" 460 <param name="median_halfWindowSize" type="integer" value="10"
456 label="Half window size" help="The resulting window reaches from 461 label="Half window size (number of data points)"
462 help="The resulting window reaches from
457 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]"/> 463 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]"/>
458 </when> 464 </when>
459 </conditional> 465 </conditional>
460 </when> 466 </when>
461 <when value="Calibrate"> 467 <when value="Calibrate">
462 <param name="calibrate_method" type="select" label="Calibration method"> 468 <param name="calibrate_method" type="select" label="Intensity calibration (normalization) method">
463 <option value="TIC" selected="True">TIC</option> 469 <option value="TIC" selected="True">TIC</option>
464 <option value="PQN">PQN</option> 470 <option value="PQN">PQN</option>
465 <option value="median">median</option> 471 <option value="median">median</option>
466 <validator type="empty_field" /> 472 <validator type="empty_field" />
467 </param> 473 </param>
468 <param name="mass_start" type="integer" value="0" 474 <conditional name="cond_calibration_range">
469 label="Start of m/z range, has to be inside m/z range" 475 <param name="calibration_range" type="select" label="Instead of the whole m/z range, a specified m/z range can be used to calculate the scaling factor">
470 help="Scaling factor is calculated on the mass range and applied to the whole spectrum. Start and end are not allowed to be 0"/> 476 <option value="no" selected="True">complete m/z range</option>
471 <param name="mass_end" type="integer" value="0" 477 <option value="yes">specify a m/z range</option>
472 label="End of m/z range, has to be inside m/z range"/> 478 </param>
479 <when value="no"/>
480 <when value="yes">
481 <param name="mass_start" type="integer" value="800"
482 label="Start of m/z range, has to be inside m/z range"
483 help="Scaling factor is calculated on the mass range and applied to the whole spectrum."/>
484 <param name="mass_end" type="integer" value="3000"
485 label="End of m/z range, has to be inside m/z range"/>
486 </when>
487 </conditional>
473 </when> 488 </when>
474 <when value="Align"> 489 <when value="Align">
475 <param name="warping_method" type="select" label="Warping methods"> 490 <param name="warping_method" type="select" label="Warping methods">
476 <option value="lowess" selected="True">Lowess</option> 491 <option value="lowess" selected="True">Lowess</option>
477 <option value="linear">Linear</option> 492 <option value="linear">Linear</option>
478 <option value="quadratic">Quadratic</option> 493 <option value="quadratic">Quadratic</option>
479 <option value="cubic">Cubic</option> 494 <option value="cubic">Cubic</option>
480 </param> 495 </param>
481 496
482 <param name="tolerance" type="float" value="0.002" 497 <param name="tolerance" type="float" value="0.00005"
483 label="Tolerance" 498 label="Tolerance = abs(mz1 - mz2)/mz2"
484 help="Double, maximal relative deviation of a peak position (m/z) to be considered as identical" /> 499 help="Maximal relative deviation of a peak position (m/z) to be considered as identical. For 50ppm use 0.00005 or 50e-6" />
485 500
486 <param name="halfWindowSize" type="integer" value="20" 501 <param name="halfWindowSize" type="integer" value="20"
487 label="Half window size" 502 label="Half window size (number of data points)"
488 help="The resulting window reaches from 503 help="The resulting window reaches from
489 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize] 504 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]
490 (window size is 2*halfWindowSize+1). 505 (window size is 2*halfWindowSize+1).
491 The best size differs depending on the selected smoothing method."/> 506 The best size differs depending on the selected smoothing method."/>
492 507
493 <param name="snr" type="integer" value="2" label="Signal-to-noise-ratio"/> 508 <param name="snr" type="integer" value="2" label="Signal-to-noise-ratio"/>
494 <param name="allow_nomatch" type="boolean" label="Don't throw an error when less than 2 reference m/z were found in a spectrum" truevalue="TRUE" falsevalue="FALSE"/> 509 <param name="allow_nomatch" type="boolean" label="Don't throw an error when less than 2 reference m/z were found in a spectrum" truevalue="TRUE" falsevalue="FALSE"/>
495 <param name="empty_nomatch" type="boolean" label="logical, if TRUE the intensity values of MassSpectrum or MassPeaks objects with missing (NA) warping functions are set to zero" truevalue="TRUE" falsevalue="FALSE"/> 510 <param name="empty_nomatch" type="boolean" label="If TRUE the intensity values of MassSpectrum or MassPeaks objects with missing (NA) warping functions are set to zero" truevalue="TRUE" falsevalue="FALSE"/>
496 <param name="remove_empty" type="boolean" label="Should empty spectra be removed" truevalue="TRUE" falsevalue="FALSE" help="For Cardinal RData files this step can only be performed if pixel annotations were provided"/> 511 <param name="remove_empty" type="boolean" label="Should empty spectra be removed" truevalue="TRUE" falsevalue="FALSE" help="For Cardinal RData files this step can only be performed if pixel annotations were provided"/>
497 512
498 <conditional name="reference_for_alignment"> 513 <conditional name="reference_for_alignment">
499 <param name="align_ref" type="select" label="Reference to which the samples should be aligned" help="Use internal calibrants to perform m/z calibration"> 514 <param name="align_ref" type="select" label="Reference to which the samples should be aligned" help="Use internal calibrants to perform m/z calibration">
500 <option value="no_reference" selected="True">no reference</option> 515 <option value="no_reference" selected="True">no reference</option>
501 <option value="yes_reference">reference from tabular file</option> 516 <option value="yes_reference">reference from tabular file</option>
502 </param> 517 </param>
503 <when value="no_reference"/> 518 <when value="no_reference"/>
504 <when value="yes_reference"> 519 <when value="yes_reference">
505 <param name="reference_file" type="data" format="tabular" 520 <param name="reference_file" type="data" format="tabular"
506 label="Tabular file with m/z of internal calibrants (MassPeaks) which should be used for spectra alignment" 521 label="Tabular file with m/z (MassPeaks) which should be used for spectra alignment"
507 help="calibration of m/z values to internal calibrants, at least 2 m/z per spectrum are needed"/> 522 help="At least 2 reference m/z per spectrum are needed"/>
508 <param name="reference_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/> 523 <param name="reference_header" type="boolean" label="File contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
509 </when> 524 </when>
510 </conditional> 525 </conditional>
511 </when> 526 </when>
512 </conditional> 527 </conditional>
513 </repeat> 528 </repeat>
514 <param name="export_processed" type="boolean" label="Export file as processed imzML" help="otherwise continuous imzML will be exported" truevalue="TRUE" falsevalue="FALSE"/> 529 <param name="export_processed" type="boolean" label="Export file as processed imzML" help="otherwise continuous imzML will be exported" truevalue="TRUE" falsevalue="FALSE"/>
515 </inputs> 530 </inputs>
516 <outputs> 531 <outputs>
517 <data format="imzml" name="outfile_imzml" label="$infile.display_name preprocessed" /> 532 <data format="imzml" name="outfile_imzml" label="${tool.name} on ${on_string}" />
518 <data format="pdf" name="plots" from_work_dir="prepro_qc_plot.pdf" label="$infile.display_name preprocessed QC"/> 533 <data format="pdf" name="plots" from_work_dir="prepro_qc_plot.pdf" label="${tool.name} on ${on_string}: QC"/>
519 <data format="tabular" name="annotation_output" label="$infile.display_name annotations">
520 <filter>tabular_annotation["load_annotation"] == 'yes_annotation'</filter>
521 </data>
522 </outputs> 534 </outputs>
523 <tests> 535 <tests>
524 <test> 536 <test>
525 <param name="infile" value="" ftype="imzml"> 537 <param name="infile" value="" ftype="imzml">
526 <composite_data value="Example_Continuous.imzML"/> 538 <composite_data value="Example_Continuous.imzML"/>
567 </conditional> 579 </conditional>
568 <conditional name="methods_conditional"> 580 <conditional name="methods_conditional">
569 <param name="method" value="Align"/> 581 <param name="method" value="Align"/>
570 <param name="warping_method" value="linear"/> 582 <param name="warping_method" value="linear"/>
571 <param name="halfWindowSize" value="1"/> 583 <param name="halfWindowSize" value="1"/>
584 <param name="tolerance" value="0.002"/>
572 <param name="allow_nomatch" value="TRUE"/> 585 <param name="allow_nomatch" value="TRUE"/>
573 <param name="remove_empty" value="TRUE"/> 586 <param name="remove_empty" value="TRUE"/>
574 <param name="empty_nomatch" value="TRUE"/> 587 <param name="empty_nomatch" value="TRUE"/>
575 <conditional name="reference_for_alignment"> 588 <conditional name="reference_for_alignment">
576 <param name="align_ref" value="yes_reference"/> 589 <param name="align_ref" value="yes_reference"/>
578 </conditional> 591 </conditional>
579 </conditional> 592 </conditional>
580 <output name="outfile_imzml" file="outfile3.imzML" compare="sim_size"/> 593 <output name="outfile_imzml" file="outfile3.imzML" compare="sim_size"/>
581 <output name="outfile_imzml" file="outfile3.ibd" compare="sim_size"/> 594 <output name="outfile_imzml" file="outfile3.ibd" compare="sim_size"/>
582 <output name="plots" file="Preprocessing3_QC.pdf" compare="sim_size"/> 595 <output name="plots" file="Preprocessing3_QC.pdf" compare="sim_size"/>
583 <output name="annotation_output" file="annotations_output3.tabular"/>
584 </test> 596 </test>
585 </tests> 597 </tests>
586 <help><![CDATA[ 598 <help><![CDATA[
587 599
588 @MADLI_QUANT_DESCRIPTION@ 600 @MADLI_QUANT_DESCRIPTION@
621 633
622 634
623 635
624 **Options** 636 **Options**
625 637
626 - Transformation: transformation of intensities with log, log2, log10 and squareroot 638 - Transformation: Variance stabilization through intensity transformation:'log', 'log2', 'log10' and 'squareroot' (sqrt) are available
627 - Smoothing: Smoothing of the peaks reduces noise and improves peak detection. Available smoothing methods are SavitzkyGolay and Moving Average 639 - Smoothing: Smoothing of the peaks reduces noise and improves peak detection. Available smoothing methods are 'SavitzkyGolay' and 'Moving Average'
640
641 - For all smoothing methods: The larger the 'Half window size'f, the stronger the smoothing. The resulting window should be smaller than the FWHM (full width at half maximum) of the typical peaks. Moving average needs smaller window size than SavitzkyGolay.
642 - Moving average: Recommended for broader peaks/high m/z range spectra. Weighted moving average: Points in the center get larger weight factors than points away from the center.
643 - SavitzkyGolay: Recommended for sharp peaks/low m/z range, preserves the shape of the local maxima. The PolynomialOrder should be smaller than the resulting window. Negative values will be replaced with 0.
644
628 - Baseline reduction: Baseline reduction removes background intensity generated by chemical noise (common in MALDI datasets). 645 - Baseline reduction: Baseline reduction removes background intensity generated by chemical noise (common in MALDI datasets).
629 646
630 - Available methods are SNIP, TopHat,ConvexHull and median: 647 - Available methods are SNIP, TopHat,ConvexHull and median:
631 - SNIP is the default baseline reduction method in MALDIquant. 648 - SNIP is the default baseline reduction method in MALDIquant.
632 - ConvexHull cannot be used for MALDI-TOF baseline removal. 649 - ConvexHull is not appropriate for MALDI-TOF baseline removal.
633 - The moving median may generate negative intensities. 650 - The moving median may generate negative intensities.
634 - Except for the ConvexHull all methods have a parameter for the 'Half window size' (in SNIP it is called 'iterations'). The smaller the window the more baseline will be removed but also parts of the peaks. Wider windows preserve the peak height better and produce a smoother baseline, but some local background variation will remain. 651 - Except for the ConvexHull all methods have a parameter for the 'Half window size' (in SNIP it is called 'iterations'). The smaller the window the more baseline will be removed but also parts of the peaks. Wider windows preserve the peak height better and produce a smoother baseline, but some local background variation will remain.
635 652
636 - Intensity calibration (normalization): Normalization of intensities to Total Ion Current (TIC), median spectrum, Probabilistic Quotient Normalization (PQN) 653 - Intensity calibration (normalization): Normalization of intensities to Total Ion Current (TIC), median spectrum, Probabilistic Quotient Normalization (PQN)
654
655 - TIC and median are local calibration methods: each spectrum is normalized on its own (each peak is divided by the TIC or median of the spectrum)
656 - PQN is a global calibration method: In PQN all spectra are calibrated using the TIC calibration first. Subsequently, a median reference spectrum is created and the intensities in all spectra are standardized using the reference spectrum and a spectrum-specific median is calculated for each spectrum. Finally, each spectrum is rescaled by the median of the ratios of its intensity values and that of the reference spectrum
657
637 - Spectra alignment (warping): alignment for (re)calibration of m/z values, at least two m/z per spectrum are needed for the alignment. This requirement can be skipped by setting "Don't throw an error when less than 2 reference m/z were found in a spectrum" to yes. If the not aligned spectra should be set to zero select yes in "logical, if TRUE the intensity values of MassSpectrum or MassPeaks objects with missing (NA) warping functions are set to zero". In order to remove such empty spectra set "Should empty spectra be removed" to yes. 658 - Spectra alignment (warping): alignment for (re)calibration of m/z values, at least two m/z per spectrum are needed for the alignment. This requirement can be skipped by setting "Don't throw an error when less than 2 reference m/z were found in a spectrum" to yes. If the not aligned spectra should be set to zero select yes in "logical, if TRUE the intensity values of MassSpectrum or MassPeaks objects with missing (NA) warping functions are set to zero". In order to remove such empty spectra set "Should empty spectra be removed" to yes.
638 659
639 660
640 **Output** 661 **Output**
641 662