comparison msi_preprocessing.xml @ 2:50ba097d03e0 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_preprocessing commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
author galaxyp
date Mon, 23 Apr 2018 17:19:16 -0400
parents c4abf42419c2
children b9523950e79d
comparison
equal deleted inserted replaced
1:c4abf42419c2 2:50ba097d03e0
1 <tool id="mass_spectrometry_imaging_preprocessing" name="MSI preprocessing" version="1.7.0.1"> 1 <tool id="mass_spectrometry_imaging_preprocessing" name="MSI preprocessing" version="1.7.0.2">
2 <description> 2 <description>
3 mass spectrometry imaging preprocessing 3 mass spectrometry imaging preprocessing
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>
7 <requirement type="package" version="2.2.1">r-gridextra</requirement>
8 <requirement type="package" version="0.20-35">r-lattice</requirement>
7 </requirements> 9 </requirements>
8 <command detect_errors="exit_code"> 10 <command detect_errors="exit_code">
9 <![CDATA[ 11 <![CDATA[
10 12
11 #if $infile.ext == 'imzml' 13 #if $infile.ext == 'imzml'
24 ]]> 26 ]]>
25 </command> 27 </command>
26 <configfiles> 28 <configfiles>
27 <configfile name="cardinal_preprocessing"><![CDATA[ 29 <configfile name="cardinal_preprocessing"><![CDATA[
28 library(Cardinal) 30 library(Cardinal)
31 library(gridExtra)
32 library(lattice)
29 33
30 #if $infile.ext == 'imzml' 34 #if $infile.ext == 'imzml'
31 msidata <- readMSIData('infile.imzML') 35 msidata <- readMSIData('infile.imzML')
32 #elif $infile.ext == 'analyze75' 36 #elif $infile.ext == 'analyze75'
33 msidata <- readMSIData('infile.hdr') 37 msidata <- readMSIData('infile.hdr')
34 #else 38 #else
35 load('infile.RData') 39 load('infile.RData')
36 #end if 40 #end if
37 41
38 42
39 maxpixel = length(pixels(msidata)) 43 ##################################### Preparations for QC report #######################################################################################
40 pixelnumber = c(1:maxpixel) 44
41 45 #if $outputs.outputs_select == "quality_control":
46
47 ### values for QC table:
48 maxfeatures = length(features(msidata))
49 medianpeaks = median(colSums(spectra(msidata)[]>0))
50 medint = round(median(spectra(msidata)[]), digits=2)
51 TICs = round(mean(colSums(spectra(msidata)[])), digits=1)
52 QC_numbers= data.frame(rawdata = c(maxfeatures, medianpeaks, medint, TICs))
53 vectorofactions = "rawdata"
54
55
56 ### Read tabular file with calibrant masses:
57 calibrant_list = read.delim("$outputs.calibrant_file", header = FALSE, na.strings=c("","NA"), stringsAsFactors = FALSE)
58
59 ### calculate how many input calibrant masses are valid:
60 inputcalibrants = calibrant_list[calibrant_list[,$outputs.calibrants_column]>min(mz(msidata)) & calibrant_list[,$outputs.calibrants_column]<max(mz(msidata)),$outputs.calibrants_column]
61 number_calibrants_in = length(calibrant_list[,$outputs.calibrants_column])
62 number_calibrants_valid = length(inputcalibrants)
63
64
65
66
67 ### Quality control report
68
69
70 pdf("Preprocessing.pdf", fonts = "Times", pointsize = 12)
71 plot(0,type='n',axes=FALSE,ann=FALSE)
72 title(main=paste("Quality control during preprocessing \n", "Filename:", "$infile.display_name"))
73 title(main=paste0("\n\n\n\n Number valid masses in ", "$outputs.calibrant_file.display_name",": ", number_calibrants_valid, "/", number_calibrants_in))
74
75
76
77 for (calibrant in inputcalibrants)
78 {
79
80 currentimage = image(msidata , mz=calibrant, strip = strip.custom(bg="lightgrey",
81 par.strip.text=list(col="black", cex=.9)),lattice=TRUE,
82 scales = list(draw = FALSE), plusminus = $outputs.plusminus_dalton, main="raw")
83
84 assign(paste("rawdata",calibrant, sep="_"), currentimage)
85 }
86
87
88 current_plot_raw <- vector(length(inputcalibrants), mode='list')
89
90
91 #end if
92
93 ################################################### Preprocessing steps #######################################################################################
42 #for $method in $methods: 94 #for $method in $methods:
43 #if str( $method.methods_conditional.preprocessing_method ) == 'Normalization': 95 #if str( $method.methods_conditional.preprocessing_method ) == 'Normalization':
44 print('Normalization') 96 print('Normalization')
45 ##normalization 97 ##normalization
46 msidata <- normalize(msidata, pixel=pixelnumber, method="tic") 98
99 msidata <- normalize(msidata, method="tic")
100
101 #if $outputs.outputs_select == "quality_control":
102 ### values for QC table:
103 maxfeatures = length(features(msidata))
104 medianpeaks = median(colSums(spectra(msidata)[]>0))
105 medint = round(median(spectra(msidata)[]), digits=2)
106 TICs = round(mean(colSums(spectra(msidata)[])), digits=1)
107 normalized = c(maxfeatures, medianpeaks, medint, TICs)
108 QC_numbers= cbind(QC_numbers, normalized)
109 ### preparation for QC plots
110 vectorofactions = append(vectorofactions, "normalized")
111
112 for (calibrant in inputcalibrants)
113 {
114 currentimage = image(msidata , mz=calibrant, strip = strip.custom(bg="lightgrey",
115 par.strip.text=list(col="black", cex=.9)),lattice=TRUE,
116 scales = list(draw = FALSE), plusminus = $outputs.plusminus_dalton, main="normalized")
117
118 assign(paste("normalized",calibrant, sep="_"), currentimage)
119 }
120
121
122 #end if
47 123
48 #elif str( $method.methods_conditional.preprocessing_method ) == 'Baseline_reduction': 124 #elif str( $method.methods_conditional.preprocessing_method ) == 'Baseline_reduction':
49 print('Baseline_reduction') 125 print('Baseline_reduction')
50 ##baseline reduction 126 ##baseline reduction
51 msidata = reduceBaseline(msidata, pixel=pixelnumber, method="median", blocks=$method.methods_conditional.blocks_baseline) 127 msidata = reduceBaseline(msidata, method="median", blocks=$method.methods_conditional.blocks_baseline)
128
129 #if $outputs.outputs_select == "quality_control":
130 maxfeatures = length(features(msidata))
131 medianpeaks = median(colSums(spectra(msidata)[]>0))
132 medint = round(median(spectra(msidata)[]), digits=2)
133 TICs = round(mean(colSums(spectra(msidata)[])), digits=1)
134 baseline= c(maxfeatures, medianpeaks, medint, TICs)
135 QC_numbers= cbind(QC_numbers, baseline)
136 ### preparation for QC plots
137 vectorofactions = append(vectorofactions, "baseline_rem")
138
139 for (calibrant in inputcalibrants)
140 {
141 currentimage = image(msidata , mz=calibrant, strip = strip.custom(bg="lightgrey",
142 par.strip.text=list(col="black", cex=.9)),lattice=TRUE,
143 scales = list(draw = FALSE), plusminus = $outputs.plusminus_dalton, main="baseline removed")
144
145 assign(paste("baseline_rem",calibrant, sep="_"), currentimage)
146 }
147 #end if
52 148
53 #elif str( $method.methods_conditional.preprocessing_method ) == 'Smoothing': 149 #elif str( $method.methods_conditional.preprocessing_method ) == 'Smoothing':
54 print('Smoothing') 150 print('Smoothing')
55 ## Smoothing 151 ## Smoothing
56 152
63 #elif str($method.methods_conditional.methods_for_smoothing.smoothing_method) == 'ma': 159 #elif str($method.methods_conditional.methods_for_smoothing.smoothing_method) == 'ma':
64 print('sgolay smoothing') 160 print('sgolay smoothing')
65 msidata <- smoothSignal(msidata, method="$method.methods_conditional.methods_for_smoothing.smoothing_method", window=$method.methods_conditional.window_smoothing, coef = $method.methods_conditional.methods_for_smoothing.coefficients_ma_filter) 161 msidata <- smoothSignal(msidata, method="$method.methods_conditional.methods_for_smoothing.smoothing_method", window=$method.methods_conditional.window_smoothing, coef = $method.methods_conditional.methods_for_smoothing.coefficients_ma_filter)
66 #end if 162 #end if
67 163
164 #if $outputs.outputs_select == "quality_control":
165 maxfeatures = length(features(msidata))
166 medianpeaks = median(colSums(spectra(msidata)[]>0))
167 medint = round(median(spectra(msidata)[]), digits=2)
168 TICs = round(mean(colSums(spectra(msidata)[])), digits=1)
169 smoothed= c(maxfeatures, medianpeaks, medint, TICs)
170 QC_numbers= cbind(QC_numbers, smoothed)
171 ### preparation for QC plots
172 vectorofactions = append(vectorofactions, "smoothed")
173
174 for (calibrant in inputcalibrants)
175 {
176 currentimage = image(msidata , mz=calibrant, strip = strip.custom(bg="lightgrey",
177 par.strip.text=list(col="black", cex=.9)),lattice=TRUE,
178 scales = list(draw = FALSE), plusminus = $outputs.plusminus_dalton, main="smoothed")
179
180 assign(paste("smoothed",calibrant, sep="_"), currentimage)
181 }
182 #end if
68 183
69 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_picking': 184 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_picking':
70 print('Peak_picking') 185 print('Peak_picking')
71 ## Peakpicking 186 ## Peakpicking
72 187
73 #if str( $method.methods_conditional.methods_for_picking.picking_method) == 'adaptive': 188 #if str( $method.methods_conditional.methods_for_picking.picking_method) == 'adaptive':
74 print('adaptive peakpicking') 189 print('adaptive peakpicking')
75 msidata = peakPick(msidata, pixel=pixelnumber, 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, spar=$method.methods_conditional.methods_for_picking.spar_picking) 190 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, spar=$method.methods_conditional.methods_for_picking.spar_picking)
76 191
77 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'limpic': 192 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'limpic':
78 print('limpic peakpicking') 193 print('limpic peakpicking')
79 msidata = peakPick(msidata, pixel=pixelnumber, 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, thresh=$method.methods_conditional.methods_for_picking.tresh_picking) 194 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, thresh=$method.methods_conditional.methods_for_picking.tresh_picking)
80 195
81 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'simple': 196 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'simple':
82 print('simple peakpicking') 197 print('simple peakpicking')
83 msidata = peakPick(msidata, pixel=pixelnumber, 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) 198 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)
84 #end if 199 #end if
85 200
86 201 #if $outputs.outputs_select == "quality_control":
202 maxfeatures = length(features(msidata))
203 medianpeaks = median(colSums(spectra(msidata)[]>0))
204 medint = round(median(spectra(msidata)[]), digits=2)
205 TICs = round(mean(colSums(spectra(msidata)[])), digits=1)
206 picked= c(maxfeatures, medianpeaks, medint, TICs)
207 QC_numbers= cbind(QC_numbers, picked)
208 ### preparation for QC plots
209 vectorofactions = append(vectorofactions, "picked")
210
211 for (calibrant in inputcalibrants)
212 {
213 currentimage = image(msidata , mz=calibrant, strip = strip.custom(bg="lightgrey",
214 par.strip.text=list(col="black", cex=.9)),lattice=TRUE,
215 scales = list(draw = FALSE), plusminus = $outputs.plusminus_dalton, main="picked")
216
217 assign(paste("picked",calibrant, sep="_"), currentimage)
218 }
219 #end if
87 220
88 #elif str( $method.methods_conditional.preprocessing_method ) == 'Peak_alignment': 221 #elif str( $method.methods_conditional.preprocessing_method ) == 'Peak_alignment':
89 print('Peak_alignment') 222 print('Peak_alignment')
90 ## Peakalignment 223 ## Peakalignment
91 224
225 #if str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_noref':
226 align_peak_reference = msidata
227
228 #elif str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_table':
229 align_reference_table = read.delim("$method.methods_conditional.align_ref_type.align_peaks_table", header = FALSE, na.strings=c("","NA"), stringsAsFactors = FALSE)
230
231 align_reference_column = align_reference_table[,$method.methods_conditional.align_ref_type.align_mass_column]
232
233 align_peak_reference = align_reference_column[align_reference_column>=min(mz(msidata)) & align_reference_column<=max(mz(msidata))]
234 if (length(align_peak_reference) == 0)
235 {align_peak_reference = 0
236 }
237
238
239
240 #### if length <0: align_peak_reference = 0
241
242
243 #elif str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_msidata_ref':
244 loadRData <- function(fileName){
245 #loads an RData file, and returns it
246 load(fileName)
247 get(ls()[ls() != "fileName"])
248 }
249 align_peak_reference = loadRData('$method.methods_conditional.align_ref_type.align_peaks_msidata')
250 #end if
251
92 #if str( $method.methods_conditional.methods_for_alignment.alignment_method) == 'diff': 252 #if str( $method.methods_conditional.methods_for_alignment.alignment_method) == 'diff':
93 print('diff peaklignment') 253 print('diff peakalignment')
94 msidata = peakAlign(msidata, method='$method.methods_conditional.methods_for_alignment.alignment_method',diff.max =$method.methods_conditional.methods_for_alignment.value_diffalignment, units = "$method.methods_conditional.methods_for_alignment.units_diffalignment") 254 msidata = peakAlign(msidata, method='$method.methods_conditional.methods_for_alignment.alignment_method',diff.max =$method.methods_conditional.methods_for_alignment.value_diffalignment, units = "$method.methods_conditional.methods_for_alignment.units_diffalignment", ref=align_peak_reference)
95 255
96 #elif str( $method.methods_conditional.methods_for_alignment.alignment_method) == 'DP': 256 #elif str( $method.methods_conditional.methods_for_alignment.alignment_method) == 'DP':
97 print('DPpeaklignment') 257 print('DPpeakalignment')
98 msidata = peakAlign(msidata, method='$method.methods_conditional.methods_for_alignment.alignment_method',gap = $method.methods_conditional.methods_for_alignment.gap_DPalignment ) 258 msidata = peakAlign(msidata, method='$method.methods_conditional.methods_for_alignment.alignment_method',gap = $method.methods_conditional.methods_for_alignment.gap_DPalignment, ref=align_peak_reference)
99 #end if 259 #end if
260
261 #if $outputs.outputs_select == "quality_control":
262 maxfeatures = length(features(msidata))
263 medianpeaks = median(colSums(spectra(msidata)[]>0))
264 medint = round(median(spectra(msidata)[]), digits=2)
265 TICs = round(mean(colSums(spectra(msidata)[])), digits=1)
266 aligned= c(maxfeatures, medianpeaks, medint, TICs)
267 QC_numbers= cbind(QC_numbers, aligned)
268 ### preparation for QC plots
269 vectorofactions = append(vectorofactions, "aligned")
270
271 for (calibrant in inputcalibrants)
272 {
273 currentimage = image(msidata , mz=calibrant, strip = strip.custom(bg="lightgrey",
274 par.strip.text=list(col="black", cex=.9)),lattice=TRUE,
275 scales = list(draw = FALSE), plusminus = $outputs.plusminus_dalton, main="aligned")
276
277 assign(paste("aligned",calibrant, sep="_"), currentimage)
278 }
279 #end if
100 280
101 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_filtering': 281 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_filtering':
102 print('Peak_filtering') 282 print('Peak_filtering')
103 msidata = peakFilter(msidata, method='freq', freq.min = $method.methods_conditional.frequ_filtering) 283 msidata = peakFilter(msidata, method='freq', freq.min = $method.methods_conditional.frequ_filtering)
284
285 #if $outputs.outputs_select == "quality_control":
286 maxfeatures = length(features(msidata))
287 medianpeaks = median(colSums(spectra(msidata)[]>0))
288 medint = round(median(spectra(msidata)[]), digits=2)
289 TICs = round(mean(colSums(spectra(msidata)[])), digits=1)
290 filtered= c(maxfeatures, medianpeaks, medint, TICs)
291 QC_numbers= cbind(QC_numbers, filtered)
292 ### preparation for QC plots
293 vectorofactions = append(vectorofactions, "filtered")
294
295 for (calibrant in inputcalibrants)
296 {
297 currentimage = image(msidata , mz=calibrant, strip = strip.custom(bg="lightgrey",
298 par.strip.text=list(col="black", cex=.9)),lattice=TRUE,
299 scales = list(draw = FALSE), plusminus = $outputs.plusminus_dalton, main="filtered")
300
301 assign(paste("filtered",calibrant, sep="_"), currentimage)
302 }
303 #end if
304
305 #elif str( $method.methods_conditional.preprocessing_method) == 'Data_reduction':
306 print('Data_reduction')
307
308 #if str( $method.methods_conditional.methods_for_reduction.reduction_method) == 'bin':
309 print('bin reduction')
310 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)
311
312 #elif str( $method.methods_conditional.methods_for_reduction.reduction_method) == 'resample':
313 print('resample reduction')
314 msidata = reduceDimension(msidata, method="resample", step=$method.methods_conditional.methods_for_reduction.resample_step)
315
316 #elif str( $method.methods_conditional.methods_for_reduction.reduction_method) == 'peaks':
317 print('peaks reduction')
318
319 #if str( $method.methods_conditional.methods_for_reduction.ref_type.reference_datatype) == 'table':
320 reference_table = read.delim("$method.methods_conditional.methods_for_reduction.ref_type.peaks_table", header = FALSE, na.strings=c("","NA"), stringsAsFactors = FALSE)
321 reference_column = reference_table[,$method.methods_conditional.methods_for_reduction.ref_type.mass_column]
322 peak_reference = reference_column[reference_column>min(mz(msidata)) & reference_column<max(mz(msidata))]
323
324 #elif str( $method.methods_conditional.methods_for_reduction.ref_type.reference_datatype) == 'msidata_ref':
325 loadRData <- function(fileName){
326 #loads an RData file, and returns it
327 load(fileName)
328 get(ls()[ls() != "fileName"])
329 }
330 peak_reference = loadRData('$method.methods_conditional.methods_for_reduction.ref_type.peaks_msidata')
331 #end if
332 msidata = reduceDimension(msidata, method="peaks", ref=peak_reference, type="$method.methods_conditional.methods_for_reduction.peaks_type")
333 #end if
334
335 #if $outputs.outputs_select == "quality_control":
336 maxfeatures = length(features(msidata))
337 medianpeaks = median(colSums(spectra(msidata)[]>0))
338 medint = round(median(spectra(msidata)[]), digits=2)
339 TICs = round(mean(colSums(spectra(msidata)[])), digits=1)
340 reduced= c(maxfeatures, medianpeaks, medint, TICs)
341 QC_numbers= cbind(QC_numbers, reduced)
342 ### preparation for QC plots
343 vectorofactions = append(vectorofactions, "reduced")
344
345 for (calibrant in inputcalibrants)
346 {
347 currentimage = image(msidata , mz=calibrant, strip = strip.custom(bg="lightgrey",
348 par.strip.text=list(col="black", cex=.9)),lattice=TRUE,
349 scales = list(draw = FALSE), plusminus = $outputs.plusminus_dalton, main="reduced")
350
351 assign(paste("reduced",calibrant, sep="_"), currentimage)
352 }
353 #end if
104 #end if 354 #end if
105 #end for 355 #end for
106 356
107 357 ####################################################### Outputs: RData, tabular and QC report ######################################################
108 ## save as as (.RData) 358
359
360 ## save as (.RData)
109 save(msidata, file="$msidata_preprocessed") 361 save(msidata, file="$msidata_preprocessed")
110 362
111 if (length(features(msidata))> 0) 363
112 { 364 #if $output_matrix:
113 365
114 ## save as intensity matrix 366
115 spectramatrix = spectra(msidata) 367 if (length(features(msidata))> 0)
116 rownames(spectramatrix) = mz(msidata) 368 {
117 newmatrix = rbind(pixels(msidata), spectramatrix) 369
118 write.table(newmatrix[2:nrow(newmatrix),], file="$matrixasoutput", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") 370 ## save as intensity matrix
119 371
120 }else{ 372 spectramatrix = spectra(msidata)
121 print("file has no features left") 373 rownames(spectramatrix) = mz(msidata)
122 write.table(matrix(rownames(coord(msidata)), ncol=ncol(msidata), nrow=1), file="$matrixasoutput", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") 374 newmatrix = rbind(pixels(msidata), spectramatrix)
123 } 375 write.table(newmatrix[2:nrow(newmatrix),], file="$matrixasoutput", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t")
376
377 }else{
378 print("file has no features left")
379 write.table(matrix(rownames(coord(msidata)), ncol=ncol(msidata), nrow=1), file="$matrixasoutput", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t")
380 }
381
382 #end if
383
384
385 #if $outputs.outputs_select == "quality_control":
386
387 rownames(QC_numbers) = c("# features", "median # peaks", "median intensity", "median TIC")
388 grid.table(t(QC_numbers))
389
390 for (calibrant in inputcalibrants)
391 {
392 imagelist = list()
393
394 for (numberprepro in 1:length(vectorofactions)){
395
396 imagelist[[numberprepro]] = get(paste(vectorofactions[numberprepro],calibrant, sep="_"))
397
398
399 }
400
401 do.call(grid.arrange,imagelist)
402 }
403
404
405 dev.off()
406
407 #end if
124 408
125 409
126 ]]></configfile> 410 ]]></configfile>
127 </configfiles> 411 </configfiles>
128 <inputs> 412 <inputs>
129 <param name="infile" type="data" format="imzml,rdata,analyze75" 413 <param name="infile" type="data" format="imzml,rdata,analyze75"
130 label="MSI rawdata as imzml or Cardinal MSImageSet saved as RData" 414 label="MSI rawdata as imzml, analyze7.5 or Cardinal MSImageSet saved as RData"
131 help="load imzml and ibd file by uploading composite datatype imzml"/> 415 help="load imzml and ibd file by uploading composite datatype imzml"/>
132 <repeat name="methods" title="Preprocessing" min="1" max="50"> 416 <repeat name="methods" title="Preprocessing" min="1" max="50">
133 <conditional name="methods_conditional"> 417 <conditional name="methods_conditional">
134 <param name="preprocessing_method" type="select" label="Select the preprocessing methods you want to apply"> 418 <param name="preprocessing_method" type="select" label="Select the preprocessing methods you want to apply">
135 <option value="Normalization" selected="True">Normalization to TIC</option> 419 <option value="Normalization" selected="True">Normalization to TIC</option>
136 <option value="Baseline_reduction">Baseline Reduction</option> 420 <option value="Baseline_reduction">Baseline Reduction</option>
137 <option value="Smoothing">Peak smoothing</option> 421 <option value="Smoothing">Peak smoothing</option>
138 <option value="Peak_picking">Peak picking</option> 422 <option value="Peak_picking">Peak picking</option>
139 <option value="Peak_alignment">Peak alignment</option> 423 <option value="Peak_alignment">Peak alignment</option>
140 <option value="Peak_filtering">Peak filtering</option> 424 <option value="Peak_filtering">Peak filtering</option>
425 <option value="Data_reduction">Data reduction</option>
141 </param> 426 </param>
427
142 <when value="Normalization"/> 428 <when value="Normalization"/>
143 <when value="Baseline_reduction"> 429 <when value="Baseline_reduction">
144 <param name="blocks_baseline" type="integer" value="50" 430 <param name="blocks_baseline" type="integer" value="50"
145 label="blocks"/> 431 label="Blocks"/>
146 </when> 432 </when>
147 <when value="Smoothing"> 433 <when value="Smoothing">
148 <conditional name="methods_for_smoothing"> 434 <conditional name="methods_for_smoothing">
149 <param name="smoothing_method" type="select" label="Smoothing method"> 435 <param name="smoothing_method" type="select" label="Smoothing method">
150 <option value="gaussian" selected="True">gaussian</option> 436 <option value="gaussian" selected="True">gaussian</option>
169 </when> 455 </when>
170 <when value="Peak_picking"> 456 <when value="Peak_picking">
171 <param name="SNR_picking_method" type="integer" value="3" 457 <param name="SNR_picking_method" type="integer" value="3"
172 label="Signal to noise ratio" 458 label="Signal to noise ratio"
173 help="The minimal signal to noise ratio for peaks to be considered as a valid peak."/> 459 help="The minimal signal to noise ratio for peaks to be considered as a valid peak."/>
174 <param name="blocks_picking" type="integer" value="100" label = "number of blocks" 460 <param name="blocks_picking" type="integer" value="100" label = "Number of blocks"
175 help="Number of blocks in which to divide mass spectrum to calculate noise"/> 461 help="Number of blocks in which to divide mass spectrum to calculate noise"/>
176 <param name="window_picking" type="integer" value="5" label= "window size" help="Window width for seeking local maxima"/> 462 <param name="window_picking" type="integer" value="5" label= "Window size" help="Window width for seeking local maxima"/>
177 <conditional name="methods_for_picking"> 463 <conditional name="methods_for_picking">
178 <param name="picking_method" type="select" label="Peak picking method" help = "only simple works for processed imzML files"> 464 <param name="picking_method" type="select" label="Peak picking method" help="only simple works for processed imzML files">
179 <option value="adaptive" selected="True">adaptive</option> 465 <option value="adaptive" selected="True">adaptive</option>
180 <option value="limpic">limpic</option> 466 <option value="limpic">limpic</option>
181 <option value="simple">simple</option> 467 <option value="simple">simple</option>
182 </param> 468 </param>
183 <when value="adaptive"> 469 <when value="adaptive">
184 <param name="spar_picking" type="float" value="1.0" 470 <param name="spar_picking" type="float" value="1.0"
185 label="spar value" 471 label="Spar value"
186 help = "Smoothing parameter for the spline smoothing 472 help = "Smoothing parameter for the spline smoothing
187 applied to the spectrum in order to decide the cutoffs 473 applied to the spectrum in order to decide the cutoffs
188 for throwing away false noise spikes that might occur inside peaks"/> 474 for throwing away false noise spikes that might occur inside peaks"/>
189 </when> 475 </when>
190 <when value="limpic"> 476 <when value="limpic">
191 <param name="tresh_picking" type="float" value="0.75" 477 <param name="tresh_picking" type="float" value="0.75"
192 label="thresh value" help = "The thresholding quantile to use when comparing slopes in order to throw away peaks that are too flat"/> 478 label="thresh value" help="The thresholding quantile to use when comparing slopes in order to throw away peaks that are too flat"/>
193 </when> 479 </when>
194 <when value="simple"/> 480 <when value="simple"/>
195 </conditional> 481 </conditional>
196 </when> 482 </when>
197 <when value="Peak_alignment"> 483 <when value="Peak_alignment">
202 </param> 488 </param>
203 <when value="diff"> 489 <when value="diff">
204 <param name="value_diffalignment" type="integer" value="200" 490 <param name="value_diffalignment" type="integer" value="200"
205 label="diff.max" help="Peaks that differ less than this value will be aligned together"/> 491 label="diff.max" help="Peaks that differ less than this value will be aligned together"/>
206 <param name="units_diffalignment" type="select" display = "radio" optional = "False" 492 <param name="units_diffalignment" type="select" display = "radio" optional = "False"
207 label="units" help= "The coefficients for the moving average filter"> 493 label="units" help="The coefficients for the moving average filter">
208 <option value="ppm" selected="True">ppm</option> 494 <option value="ppm" selected="True">ppm</option>
209 <option value="Da">Da</option> 495 <option value="Da">Da</option>
210 </param> 496 </param>
211 </when> 497 </when>
212 <when value="DP"> 498 <when value="DP">
213 <param name="gap_DPalignment" type="integer" value="0" 499 <param name="gap_DPalignment" type="integer" value="0"
214 label="gap" help = "The gap penalty for the dynamic programming sequence alignment"/> 500 label="Gap" help="The gap penalty for the dynamic programming sequence alignment"/>
501 </when>
502 </conditional>
503 <conditional name="align_ref_type">
504 <param name="align_reference_datatype" type="select" label="Choose reference">
505 <option value="align_noref" selected="True">no reference</option>
506 <option value="align_table" >tabular file as reference</option>
507 <option value="align_msidata_ref">msidata file as reference</option>
508 </param>
509 <when value="align_noref"/>
510 <when value="align_table">
511 <param name="align_peaks_table" type="data" format="tabular"
512 label="Reference mz values to use for alignment - only these will be kept" help="One column with mz values (without empty cells or letters)"/>
513 <param name="align_mass_column" data_ref="align_peaks_table" label="Column with reference mz" type="data_column"/>
514 </when>
515 <when value="align_msidata_ref">
516 <param name="align_peaks_msidata" type="data" format="rdata," label="Picked and aligned Cardinal MSImageSet saved as RData"/>
215 </when> 517 </when>
216 </conditional> 518 </conditional>
217 </when> 519 </when>
218 <when value="Peak_filtering"> 520 <when value="Peak_filtering">
219 <param name="frequ_filtering" type="float" value="1" 521 <param name="frequ_filtering" type="integer" value="1000"
220 label="freq.min" help = "Peaks that occur in the dataset fewer times than this will be removed"/> 522 label="Freq.min" help="Peaks that occur in the dataset fewer times than this will be removed. Number should be between 1 (no filtering) and number of spectra (pixel)"/>
523 </when>
524 <when value="Data_reduction">
525 <conditional name="methods_for_reduction">
526 <param name="reduction_method" type="select" label="Reduction method">
527 <option value="bin" selected="True">bin</option>
528 <option value="resample">resample</option>
529 <option value="peaks">peaks</option>
530 </param>
531 <when value="bin">
532 <param name="bin_width" type="float" value="1"
533 label="The width of a bin in mz or ppm" help="Width must be greater than Range of mz values/Number of mz features"/>
534 <param name="bin_units" type="select" display="radio"
535 label="Unit for bin">
536 <option value="mz" selected="True">mz</option>
537 <option value="ppm">ppm</option>
538 </param>
539 <param name="bin_fun" type="select" display="radio"
540 label="Calculate sum or mean intensity for ions of the same bin">
541 <option value="mean" selected="True">mean</option>
542 <option value="sum">sum</option>
543 </param>
544 </when>
545 <when value="resample">
546 <param name="resample_step" type="float" value="1"
547 label="The step size in mz" help="Step size must be greater than Range of mz values/Number of mz features"/>
548 </when>
549 <when value="peaks">
550 <param name="peaks_type" type="select" display="radio"
551 label="Should the peak height or area under the curve be taken as the intensity value?">
552 <option value="height" selected="True">height</option>
553 <option value="area">area</option>
554 </param>
555 <conditional name="ref_type">
556 <param name="reference_datatype" type="select" label="Choose reference datatype">
557 <option value="table" selected="True">tabular file</option>
558 <option value="msidata_ref">msidata file</option>
559 </param>
560 <when value="table">
561 <param name="peaks_table" type="data" format="tabular"
562 label="Reference mz values to use to reduce the dimension" help="One column with mz values (without empty cells or letters, mz outside mz range are not used for filtering)"/>
563 <param name="mass_column" data_ref="peaks_table" label="Column with reference mz" type="data_column"/>
564 </when>
565 <when value="msidata_ref">
566 <param name="peaks_msidata" type="data" format="rdata," label="Picked and aligned Cardinal MSImageSet saved as RData"/>
567 </when>
568 </conditional>
569 </when>
570 </conditional>
221 </when> 571 </when>
222 </conditional> 572 </conditional>
223 </repeat> 573 </repeat>
574 <conditional name="outputs">
575 <param name="outputs_select" type="select" label="Quality control output">
576 <option value="quality_control" selected="True">yes</option>
577 <option value="no_quality_control">no</option>
578 </param>
579 <when value="quality_control">
580 <param name="calibrant_file" type="data" format="tabular"
581 label="Provide a list of masses which will be plotted in the quality control report"
582 help="Use internal calibrant masses"/>
583 <param name="calibrants_column" data_ref="calibrant_file" label="Column with masses" type="data_column"/>
584 <param name="plusminus_dalton" value="0.25" type="text" label="Mass range" help="Plusminus mass window in Dalton"/>
585 </when>
586 <when value="no_quality_control"/>
587 </conditional>
588 <param name="output_matrix" type="boolean" display="radio" label="Intensity matrix output"/>
224 </inputs> 589 </inputs>
225 <outputs> 590 <outputs>
226 <data format="rdata" name="msidata_preprocessed" label="${tool.name} on $infile.display_name"/> 591 <data format="rdata" name="msidata_preprocessed" label="Preprocessed ${on_string}"/>
227 <data format="tabular" name="matrixasoutput" label="${tool.name} on $infile.display_name" /> 592 <data format="pdf" name="QC_plots" from_work_dir="Preprocessing.pdf" label = "QC preprocessing report on ${on_string}">
593 <filter>outputs["outputs_select"] == "quality_control"</filter>
594 </data>
595 <data format="tabular" name="matrixasoutput" label="Intensity matrix ${on_string}">
596 <filter>output_matrix</filter>
597 </data>
228 </outputs> 598 </outputs>
229 <tests> 599 <tests>
230 <test> 600 <test>
231 <param name="infile" value="" ftype="imzml"> 601 <param name="infile" value="" ftype="imzml">
232 <composite_data value="Example_Continuous.imzML"/> 602 <composite_data value="Example_Continuous.imzML"/>
237 <param name="preprocessing_method" value="Normalization" /> 607 <param name="preprocessing_method" value="Normalization" />
238 </conditional> 608 </conditional>
239 </repeat> 609 </repeat>
240 <repeat name="methods"> 610 <repeat name="methods">
241 <conditional name="methods_conditional"> 611 <conditional name="methods_conditional">
242 <param name="preprocessing_method" value="Baseline_reduction" />
243 <param name="blocks_baseline" value="100" />
244 </conditional>
245 </repeat>
246 <repeat name="methods">
247 <conditional name="methods_conditional">
248 <param name="preprocessing_method" value="Smoothing" /> 612 <param name="preprocessing_method" value="Smoothing" />
249 <conditional name="methods_for_smoothing"> 613 <conditional name="methods_for_smoothing">
250 <param name="smoothing_method" value="gaussian" /> 614 <param name="smoothing_method" value="gaussian" />
251 </conditional> 615 </conditional>
252 </conditional> 616 </conditional>
267 <conditional name="methods_for_alignment"> 631 <conditional name="methods_for_alignment">
268 <param name="alignment_method" value="diff" /> 632 <param name="alignment_method" value="diff" />
269 </conditional> 633 </conditional>
270 </conditional> 634 </conditional>
271 </repeat> 635 </repeat>
272 <!--repeat name="methods"> 636 <repeat name="methods">
273 <conditional name="methods_conditional"> 637 <conditional name="methods_conditional">
274 <param name="preprocessing_method" value="Peak_filtering" /> 638 <param name="preprocessing_method" value="Peak_filtering" />
275 </conditional> 639 <param name="frequ_filtering" value="2"/>
276 </repeat--> 640 </conditional>
641 </repeat>
642 <param name="outputs_select" value="no_quality_control"/>
643 <param name="output_matrix" value="True"/>
277 <output name="msidata_preprocessed" file="preprocessing_results1.RData" compare="sim_size" /> 644 <output name="msidata_preprocessed" file="preprocessing_results1.RData" compare="sim_size" />
278 <output name="matrixasoutput" file="preprocessing_results1.txt" /> 645 <output name="matrixasoutput" file="preprocessing_results1.txt" />
279 </test> 646 </test>
280 <test> 647 <test>
281 <param name="infile" value="example_continous.RData" ftype="rdata"/> 648 <param name="infile" value="example_continous.RData" ftype="rdata"/>
282 <!--repeat name="methods">
283 <conditional name="methods_conditional">
284 <param name="preprocessing_method" value="Baseline_reduction" />
285 <param name="blocks_baseline" value="3" />
286 </conditional>
287 </repeat-->
288 <repeat name="methods"> 649 <repeat name="methods">
289 <conditional name="methods_conditional"> 650 <conditional name="methods_conditional">
290 <param name="preprocessing_method" value="Peak_picking" /> 651 <param name="preprocessing_method" value="Peak_picking" />
291 <param name="blocks_picking" value="3" /> 652 <param name="blocks_picking" value="3" />
292 <param name="window_picking" value="5" /> 653 <param name="window_picking" value="5" />
297 <conditional name="methods_conditional"> 658 <conditional name="methods_conditional">
298 <param name="preprocessing_method" value="Peak_alignment" /> 659 <param name="preprocessing_method" value="Peak_alignment" />
299 <param name="methods_for_alignment" value="DP" /> 660 <param name="methods_for_alignment" value="DP" />
300 </conditional> 661 </conditional>
301 </repeat> 662 </repeat>
663 <param name="outputs_select" value="quality_control"/>
664 <param name="calibrant_file" ftype="tabular" value="inputcalibrantfile2.tabular"/>
665 <param name="calibrants_column" value="1"/>
666 <param name="plusminus_dalton" value="0.25"/>
667 <param name="output_matrix" value="True"/>
302 <output name="msidata_preprocessed" file="preprocessing_results2.RData" compare="sim_size" /> 668 <output name="msidata_preprocessed" file="preprocessing_results2.RData" compare="sim_size" />
303 <output name="matrixasoutput" file="preprocessing_results2.txt" lines_diff="2" /> 669 <output name="matrixasoutput" file="preprocessing_results2.txt" lines_diff="2" />
670 <output name="QC_plots" file="preprocessing_results2.pdf" compare="sim_size"/>
304 </test> 671 </test>
305 <test> 672 <test>
306 <param name="infile" value="" ftype="analyze75"> 673 <param name="infile" value="" ftype="analyze75">
307 <composite_data value="Analyze75.hdr"/> 674 <composite_data value="Analyze75.hdr"/>
308 <composite_data value="Analyze75.img"/> 675 <composite_data value="Analyze75.img"/>
311 <repeat name="methods"> 678 <repeat name="methods">
312 <conditional name="methods_conditional"> 679 <conditional name="methods_conditional">
313 <param name="preprocessing_method" value="Normalization" /> 680 <param name="preprocessing_method" value="Normalization" />
314 </conditional> 681 </conditional>
315 </repeat> 682 </repeat>
316 <!--repeat name="methods">
317 <conditional name="methods_conditional">
318 <param name="preprocessing_method" value="Baseline_reduction" />
319 <param name="blocks_baseline" value="50" />
320 </conditional>
321 </repeat-->
322 <repeat name="methods"> 683 <repeat name="methods">
323 <conditional name="methods_conditional"> 684 <conditional name="methods_conditional">
324 <param name="preprocessing_method" value="Peak_picking" /> 685 <param name="preprocessing_method" value="Peak_picking" />
325 <param name="blocks_picking" value="3" /> 686 <param name="blocks_picking" value="3" />
326 <param name="window_picking" value="5" /> 687 <param name="window_picking" value="5" />
331 <conditional name="methods_conditional"> 692 <conditional name="methods_conditional">
332 <param name="preprocessing_method" value="Peak_alignment" /> 693 <param name="preprocessing_method" value="Peak_alignment" />
333 <param name="methods_for_alignment" value="diff" /> 694 <param name="methods_for_alignment" value="diff" />
334 </conditional> 695 </conditional>
335 </repeat> 696 </repeat>
697 <param name="outputs_select" value="quality_control"/>
698 <param name="calibrant_file" ftype="tabular" value="inputcalibrantfile2.tabular"/>
699 <param name="calibrants_column" value="1"/>
700 <param name="plusminus_dalton" value="0.25"/>
336 <output name="msidata_preprocessed" file="preprocessing_results3.RData" compare="sim_size" /> 701 <output name="msidata_preprocessed" file="preprocessing_results3.RData" compare="sim_size" />
337 <output name="matrixasoutput" file="preprocessing_results3.txt" /> 702 <output name="QC_plots" file="preprocessing_results3.pdf" compare="sim_size"/>
338 </test> 703 </test>
339 704 <test>
705 <param name="infile" value="" ftype="analyze75">
706 <composite_data value="Analyze75.hdr"/>
707 <composite_data value="Analyze75.img"/>
708 <composite_data value="Analyze75.t2m"/>
709 </param>
710 <repeat name="methods">
711 <conditional name="methods_conditional">
712 <param name="preprocessing_method" value="Normalization" />
713 </conditional>
714 </repeat>
715 <repeat name="methods">
716 <conditional name="methods_conditional">
717 <param name="preprocessing_method" value="Data_reduction" />
718 <param name="bin_width" value="0.1" />
719 </conditional>
720 </repeat>
721 <param name="outputs_select" value="no_quality_control"/>
722 <param name="output_matrix" value="True"/>
723 <output name="msidata_preprocessed" file="preprocessing_results4.RData" compare="sim_size" />
724 <output name="matrixasoutput" file="preprocessing_results4.txt" />
725 </test>
726 <test>
727 <param name="infile" value="" ftype="imzml">
728 <composite_data value="Example_Continuous.imzML"/>
729 <composite_data value="Example_Continuous.ibd"/>
730 </param>
731 <repeat name="methods">
732 <conditional name="methods_conditional">
733 <param name="preprocessing_method" value="Data_reduction" />
734 <param name="step_width" value="0.1" />
735 </conditional>
736 </repeat>
737 <param name="outputs_select" value="quality_control"/>
738 <param name="calibrant_file" ftype="tabular" value="inputcalibrantfile1.tabular"/>
739 <param name="calibrants_column" value="1"/>
740 <param name="plusminus_dalton" value="0.25"/>
741 <param name="output_matrix" value="True"/>
742 <output name="msidata_preprocessed" file="preprocessing_results5.RData" compare="sim_size" />
743 <output name="matrixasoutput" file="preprocessing_results5.txt" />
744 <output name="QC_plots" file="preprocessing_results5.pdf" compare="sim_size"/>
745 </test>
340 </tests> 746 </tests>
341 <help> 747 <help>
342 <![CDATA[ 748 <![CDATA[
343 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. 749 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets.
344 750
346 752
347 - Smoothening: Smoothing of the mass peaks reduces noise and improves peak detection 753 - Smoothening: Smoothing of the mass peaks reduces noise and improves peak detection
348 - Normalization: Normalization of intensities to total ion current (TIC) 754 - Normalization: Normalization of intensities to total ion current (TIC)
349 - Baseline reduction: Baseline reduction removes backgroundintensity generated by chemical noise (common in MALDI datasets) 755 - Baseline reduction: Baseline reduction removes backgroundintensity generated by chemical noise (common in MALDI datasets)
350 - Peak picking: relevant peaks are picked while noise-peaks are removed 756 - Peak picking: relevant peaks are picked while noise-peaks are removed
351 - Peak alignment: mz inaccuracies are removed by alignment of same peaks to a common mz value 757 - Peak alignment: after peak picking, mz inaccuracies are removed by alignment of same peaks to a common mz value
352 - Peak filtering: removes peaks that occur infrequently, such as those which only occur in a small proportion of pixels 758 - Peak filtering: after peak picking and alignment, removes peaks that occur infrequently, such as those which only occur in a small proportion of pixels. If not sure which cutoff to chose run qualitycontrol first and decide according to the zero value plot.
759 - Data reduction: binning, resampling or peak filtering to reduce data
353 ]]> 760 ]]>
354 </help> 761 </help>
355 <citations> 762 <citations>
356 <citation type="doi">10.1093/bioinformatics/btv146</citation> 763 <citation type="doi">10.1093/bioinformatics/btv146</citation>
357 </citations> 764 </citations>