comparison maldi_quant_preprocessing.xml @ 1:0892a051eb17 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/MALDIquant commit 0825a4ccd3ebf4ca8a298326d14f3e7b25ae8415
author galaxyp
date Mon, 01 Oct 2018 01:09:28 -0400
parents e2aa05746a69
children e754c2b545a9
comparison
equal deleted inserted replaced
0:e2aa05746a69 1:0892a051eb17
1 <tool id="maldi_quant_preprocessing" name="MALDIquant preprocessing" version="1.18.0.0"> 1 <tool id="maldi_quant_preprocessing" name="MALDIquant preprocessing" version="@VERSION@.1">
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>
37 #if $restriction_conditional.restriction == 'restrict': 37 #if $restriction_conditional.restriction == 'restrict':
38 38
39 print('Reading mask region') 39 print('Reading mask region')
40 ## Import imzML file 40 ## Import imzML file
41 41
42 coordinate_matrix = as.matrix(read.delim("$restriction_conditional.coordinates_file", header = FALSE, stringsAsFactors = FALSE))[,1:2] 42 coordinate_matrix = as.matrix(read.delim("$restriction_conditional.coordinates_file", header = $restriction_conditional.coordinates_header, stringsAsFactors = FALSE))[,1:2]
43 43
44 maldi_data = importImzMl('infile.imzML', 44 maldi_data = importImzMl('infile.imzML',
45 coordinates = coordinate_matrix) 45 coordinates = coordinate_matrix)
46 pixelnames = paste0("x = ", coordinates(maldi_data)[,1],", y = ", coordinates(maldi_data)[,2]) 46 pixelnames = paste0("x = ", coordinates(maldi_data)[,1],", y = ", coordinates(maldi_data)[,2])
47 47
49 49
50 print('Reading entire file') 50 print('Reading entire file')
51 #if $infile.ext == 'imzml' 51 #if $infile.ext == 'imzml'
52 ## Import imzML file 52 ## Import imzML file
53 maldi_data = import( 'infile.imzML', type="imzML" ) 53 maldi_data = import( 'infile.imzML', type="imzML" )
54 coordinates_info = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data)))
54 #elif $infile.ext == 'analyze75' 55 #elif $infile.ext == 'analyze75'
55 ## Import analyze7.5 file 56 ## Import analyze7.5 file
56 maldi_data = import( 'infile.hdr' ) 57 maldi_data = import( 'infile.hdr' )
58 coordinates_info = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data)))
57 #else 59 #else
58 loadRData <- function(fileName){ 60 loadRData <- function(fileName){
59 #loads an RData file, and returns it 61 #loads an RData file, and returns it
60 load(fileName) 62 load(fileName)
61 get(ls()[ls() != "fileName"]) 63 get(ls()[ls() != "fileName"])
62 } 64 }
63 msidata = loadRData('infile.RData') 65 msidata = loadRData('infile.RData')
64
65 ## save coordinates 66 ## save coordinates
66 cardinal_coordinates = as.matrix(Cardinal::coord(msidata)[,1:2]) 67 cardinal_coordinates = as.matrix(Cardinal::coord(msidata)[,1:2])
67 ## save mz values 68 ## save mz values
68 cardinal_mzs = Cardinal::mz(msidata) 69 cardinal_mzs = Cardinal::mz(msidata)
69 ## create MALDIquant MassSpectrum object 70 ## create MALDIquant MassSpectrum object
70 maldi_data = list() 71 maldi_data = list()
71 for(number_spectra in 1:ncol(msidata)){ 72 for(number_spectra in 1:ncol(msidata)){
72 maldi_data[[number_spectra]] = createMassSpectrum(mass = cardinal_mzs, intensity = iData(msidata)[,number_spectra]) 73 maldi_data[[number_spectra]] = createMassSpectrum(mass = cardinal_mzs, intensity = iData(msidata)[,number_spectra])
74 coordinates_info = cbind(cardinal_coordinates, c(1:length(maldi_data)))
73 } 75 }
74 76
75 #end if 77 #end if
76 78
77 #end if 79 #end if
78 80
79 ## Quality control plots during preprocessing 81 ## Quality control plots during preprocessing
80 82
81 pdf("prepro_qc_plot.pdf", fonts = "Times", pointsize = 12) 83 pdf("prepro_qc_plot.pdf", fonts = "Times", pointsize = 12)
82 plot(0,type='n',axes=FALSE,ann=FALSE) 84 plot(0,type='n',axes=FALSE,ann=FALSE)
83 85
84 ## if no filename is given, name of file in Galaxy history is used 86 ## if no filename is given, name of file in Galaxy history is used
85 #set $filename = $infile.display_name 87 #set $filename = $infile.display_name
86 title(main=paste("$filename")) 88 title(main=paste("$filename"))
87 89
88 #if str($tabular_annotation.load_annotation) == 'yes_annotation': 90 #if str($tabular_annotation.load_annotation) == 'yes_annotation':
89 print("use annotation file") 91 print("use annotation file")
92
90 ## read and extract x,y,annotation information 93 ## read and extract x,y,annotation information
91 input_tabular = read.delim("$tabular_annotation.annotation_file", header = $tabular_annotation.tabular_header, stringsAsFactors = FALSE) 94 input_tabular = read.delim("$tabular_annotation.annotation_file", header = $tabular_annotation.tabular_header, stringsAsFactors = FALSE)
92 annotation_input = input_tabular[,c($tabular_annotation.column_x, $tabular_annotation.column_y, $tabular_annotation.column_names)] 95 annotation_input = input_tabular[,c($tabular_annotation.column_x, $tabular_annotation.column_y, $tabular_annotation.column_names)]
93 colnames(annotation_input) = c("x", "y", "annotation") ## rename annotations header to default name "annotation" 96 colnames(annotation_input) = c("x", "y", "annotation") ## rename annotations header to default name "annotation"
94 97
95 ## merge with coordinate information of MSI data 98 ## merge with coordinate information (from above) of MSI data
96 coordinates_st = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data))) 99 colnames(coordinates_info)[3] = "pixel_index"
97 colnames(coordinates_st)[3] = "pixel_index" 100 merged_annotation = merge(coordinates_info, annotation_input, by=c("x", "y"), all.x=TRUE)
98 merged_annotation = merge(coordinates_st, annotation_input, by=c("x", "y"), all.x=TRUE)
99 merged_annotation[is.na(merged_annotation)] = "NA" 101 merged_annotation[is.na(merged_annotation)] = "NA"
100 merged_annotation = merged_annotation[order(merged_annotation\$pixel_index),] 102 merged_annotation = merged_annotation[order(merged_annotation\$pixel_index),]
101 samples = as.factor(merged_annotation\$annotation) 103 samples = as.factor(merged_annotation\$annotation)
102 104
103 ## print annotation overview into PDF output 105 ## print annotation overview into PDF output
131 133
132 #end if 134 #end if
133 135
134 #################### Preprocessing methods ##################################### 136 #################### Preprocessing methods #####################################
135 137
136 ## QC plot 138 ## QC plot on input file
137 avgSpectra = averageMassSpectra(maldi_data,method="mean") 139 avgSpectra = averageMassSpectra(maldi_data,method="mean")
138 plot(avgSpectra, main="Average spectrum for input file") 140 plot(avgSpectra, main="Average spectrum for input file")
141
142 pixel_number = length(maldi_data)
143 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
144 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
145 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
146 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
147 inputdata = c(minmz, maxmz,maxfeatures, medint)
148 QC_numbers= data.frame(inputdata = c(minmz, maxmz,maxfeatures, medint))
149 vectorofactions = "inputdata"
150
139 151
140 #for $method in $methods: 152 #for $method in $methods:
141 153
142 #if str( $method.methods_conditional.method ) == 'Transformation': 154 #if str( $method.methods_conditional.method ) == 'Transformation':
143 155
144 print('transforming') 156 print('transforming')
145 ##transformation 157 ##transformation
146 maldi_data = transformIntensity(maldi_data, method="$method.methods_conditional.transform_method") 158 maldi_data = transformIntensity(maldi_data, method="$method.methods_conditional.transform_method")
147 ## QC plot 159 ## QC plot and numbers
148 avgSpectra = averageMassSpectra(maldi_data,method="mean") 160 avgSpectra = averageMassSpectra(maldi_data,method="mean")
149 plot(avgSpectra, main="Average spectrum after transformation") 161 plot(avgSpectra, main="Average spectrum after transformation")
162 pixel_number = length(maldi_data)
163 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
164 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
165 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
166 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
167 transformed = c(minmz, maxmz,maxfeatures, medint)
168 QC_numbers= cbind(QC_numbers, transformed)
169 vectorofactions = append(vectorofactions, "transformed")
150 170
151 171
152 #elif str( $method.methods_conditional.method ) == 'Smoothing': 172 #elif str( $method.methods_conditional.method ) == 'Smoothing':
153 173
154 print('smoothing') 174 print('smoothing')
168 method="MovingAverage", weighted=$method.methods_conditional.methods_for_smoothing.weighted, 188 method="MovingAverage", weighted=$method.methods_conditional.methods_for_smoothing.weighted,
169 halfWindowSize=$method.methods_conditional.halfWindowSize) 189 halfWindowSize=$method.methods_conditional.halfWindowSize)
170 190
171 #end if 191 #end if
172 192
173 ## QC plot 193 ## QC plot and numbers
174 avgSpectra = averageMassSpectra(maldi_data,method="mean") 194 avgSpectra = averageMassSpectra(maldi_data,method="mean")
175 plot(avgSpectra, main="Average spectrum after smoothing") 195 plot(avgSpectra, main="Average spectrum after smoothing", sub="")
196 pixel_number = length(maldi_data)
197 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
198 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
199 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
200 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
201 smoothed = c(minmz, maxmz,maxfeatures, medint)
202 QC_numbers= cbind(QC_numbers, smoothed)
203 vectorofactions = append(vectorofactions, "smoothed")
176 204
177 205
178 #elif str( $method.methods_conditional.method ) == 'Baseline': 206 #elif str( $method.methods_conditional.method ) == 'Baseline':
179 207
180 print('baseline removing') 208 print('baseline removing')
181 ## Remove baseline 209 ## Remove baseline
182 210
183 maldi_data = removeBaseline(maldi_data, 211 #if str($method.methods_conditional.methods_for_baseline.baseline_method ) == 'SNIP':
184 method="$method.methods_conditional.baseline_method", 212 print('SNIP')
185 iterations=$method.methods_conditional.iterations) 213 random_spectra = sample(1:length(maldi_data), 4, replace=FALSE)
186 ## QC plot 214 par(mfrow = c(2,2))
215 for (random_sample in random_spectra){
216 maldi_data_baseline = estimateBaseline(maldi_data[[random_sample]],
217 method="SNIP", iterations=$method.methods_conditional.methods_for_baseline.iterations)
218 plot(maldi_data[[random_sample]], sub="", main=paste0("Estimated baseline for spectrum ", random_sample))
219 lines(maldi_data_baseline, col="blue", lwd=2)}
220
221 maldi_data = removeBaseline(maldi_data,
222 method="SNIP",
223 iterations=$method.methods_conditional.methods_for_baseline.iterations)
224
225 #elif str($method.methods_conditional.methods_for_baseline.baseline_method ) == 'TopHat':
226 print('TopHat')
227
228 maldi_data = removeBaseline(maldi_data,
229 method="TopHat",
230 halfWindowSize=$method.methods_conditional.methods_for_baseline.tophat_halfWindowSize)
231
232 #elif str($method.methods_conditional.methods_for_baseline.baseline_method ) == 'ConvexHull':
233 print('ConvexHull')
234
235 maldi_data = removeBaseline(maldi_data,
236 method="ConvecHull")
237
238 #elif str($method.methods_conditional.methods_for_baseline.baseline_method ) == 'median':
239 print('median')
240
241 maldi_data = removeBaseline(maldi_data,
242 method="TopHat",
243 halfWindowSize=$method.methods_conditional.methods_for_baseline.median_halfWindowSize)
244
245 #end if
246
247 ## QC plot and numbers
248 par(mfrow = c(1,1))
187 avgSpectra = averageMassSpectra(maldi_data,method="mean") 249 avgSpectra = averageMassSpectra(maldi_data,method="mean")
188 plot(avgSpectra, main="Average spectrum after baseline removal") 250 plot(avgSpectra, main="Average spectrum after baseline removal")
251 pixel_number = length(maldi_data)
252 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
253 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
254 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
255 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
256 baseline_removed = c(minmz, maxmz,maxfeatures, medint)
257 QC_numbers= cbind(QC_numbers, baseline_removed)
258 vectorofactions = append(vectorofactions, "baseline_removed")
189 259
190 260
191 #elif str( $method.methods_conditional.method ) == 'Calibrate': 261 #elif str( $method.methods_conditional.method ) == 'Calibrate':
192 262
193 print('calibrate') 263 print('calibrate')
200 range=c($method.methods_conditional.mass_start, $method.methods_conditional.mass_end)) 270 range=c($method.methods_conditional.mass_start, $method.methods_conditional.mass_end))
201 #else: 271 #else:
202 maldi_data = calibrateIntensity(maldi_data, 272 maldi_data = calibrateIntensity(maldi_data,
203 method="$method.methods_conditional.calibrate_method") 273 method="$method.methods_conditional.calibrate_method")
204 #end if 274 #end if
205 ## QC plot 275 ## QC plot and numbers
206 avgSpectra = averageMassSpectra(maldi_data,method="mean") 276 avgSpectra = averageMassSpectra(maldi_data,method="mean")
207 plot(avgSpectra, main="Average spectrum after normalization") 277 plot(avgSpectra, main="Average spectrum after normalization")
278 pixel_number = length(maldi_data)
279 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
280 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
281 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
282 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
283 intensity_calibrated = c(minmz, maxmz,maxfeatures, medint)
284 QC_numbers= cbind(QC_numbers, intensity_calibrated )
285 vectorofactions = append(vectorofactions, "intensity_calibrated ")
208 286
209 287
210 #elif str( $method.methods_conditional.method ) == 'Align': 288 #elif str( $method.methods_conditional.method ) == 'Align':
211 289
212 print('align') 290 print('align')
213 ##align spectra 291 ##align spectra
214 292
215 #if str($method.methods_conditional.reference_for_alignment.align_ref) == 'no_reference': 293 #if str($method.methods_conditional.reference_for_alignment.align_ref) == 'no_reference':
216
217 maldi_data = alignSpectra(maldi_data, halfWindowSize=$method.methods_conditional.halfWindowSize, 294 maldi_data = alignSpectra(maldi_data, halfWindowSize=$method.methods_conditional.halfWindowSize,
218 SNR=$method.methods_conditional.snr, 295 SNR=$method.methods_conditional.snr, tolerance=$method.methods_conditional.tolerance,
219 tolerance=$method.methods_conditional.tolerance, 296 allowNoMatches =$method.methods_conditional.allow_nomatch, emptyNoMatches = $method.methods_conditional.empty_nomatch,
220 warpingMethod="$method.methods_conditional.warping_method") 297 warpingMethod="$method.methods_conditional.warping_method")
221 298
222 #elif str($method.methods_conditional.reference_for_alignment.align_ref) == 'yes_reference': 299 #elif str($method.methods_conditional.reference_for_alignment.align_ref) == 'yes_reference':
223
224 ## create reference mass_vector from tabular file 300 ## create reference mass_vector from tabular file
225 mass_vector = read.delim("$method.methods_conditional.reference_for_alignment.reference_file", header = FALSE, stringsAsFactors = FALSE)[,1] 301 mass_vector = read.delim("$method.methods_conditional.reference_for_alignment.reference_file", header = $method.methods_conditional.reference_for_alignment.reference_header, stringsAsFactors = FALSE)[,1]
226 int_vector = rep(1,length(mass_vector)) 302 int_vector = rep(1,length(mass_vector))
227 mass_list = createMassPeaks(mass_vector, int_vector) 303 mass_list = createMassPeaks(mass_vector, int_vector)
228 304
229 maldi_data = alignSpectra(maldi_data, halfWindowSize=$method.methods_conditional.halfWindowSize, 305 maldi_data = alignSpectra(maldi_data, halfWindowSize=$method.methods_conditional.halfWindowSize,
230 SNR=$method.methods_conditional.snr, 306 SNR=$method.methods_conditional.snr,
231 tolerance=$method.methods_conditional.tolerance, 307 tolerance=$method.methods_conditional.tolerance,
232 warpingMethod="$method.methods_conditional.warping_method", 308 warpingMethod="$method.methods_conditional.warping_method",
233 reference = mass_list, allowNoMatches =$method.methods_conditional.reference_for_alignment.allow_nomatch, emptyNoMatches = $method.methods_conditional.reference_for_alignment.empty_nomatch) 309 reference = mass_list, allowNoMatches =$method.methods_conditional.allow_nomatch, emptyNoMatches = $method.methods_conditional.empty_nomatch)
234 310
235 #if $method.methods_conditional.reference_for_alignment.remove_empty: 311 #end if
236 312
237 #if $infile.ext == 'rdata' 313 #if $method.methods_conditional.remove_empty:
238 cardinal_coordinates = cardinal_coordinates[-findEmptyMassObjects(maldi_data),] ## remove coordinates of empty spectra for Cardinal RData input 314 print("remove empty spectra")
239 #end if 315
240 #if str($tabular_annotation.load_annotation) == 'yes_annotation': 316 #if $infile.ext == 'rdata'
241 merged_annotation = merged_annotation[-findEmptyMassObjects(maldi_data),] ## remove coordinate annotations for empty spectra 317 cardinal_coordinates = cardinal_coordinates[-findEmptyMassObjects(maldi_data),] ## remove coordinates of empty spectra for Cardinal RData input
242 #end if
243 maldi_data = removeEmptyMassObjects(maldi_data)
244 #end if 318 #end if
319 #if str($tabular_annotation.load_annotation) == 'yes_annotation':
320 merged_annotation = merged_annotation[-findEmptyMassObjects(maldi_data),] ## remove coordinate annotations for empty spectra
321 #end if
322 maldi_data = removeEmptyMassObjects(maldi_data)
245 #end if 323 #end if
324
246 325
247 ## QC plot 326 ## QC plot
248 327
249 if (length(maldi_data)>0){ 328 if (length(maldi_data)>0){
250 avgSpectra = averageMassSpectra(maldi_data,method="mean") 329 avgSpectra = averageMassSpectra(maldi_data,method="mean")
251 plot(avgSpectra, main="Average spectrum after alignment") 330 plot(avgSpectra, main="Average spectrum after alignment")
252 }else{"All spectra are empty"} 331 }else{"All spectra are empty"}
253 332
333 pixel_number = length(maldi_data)
334 minmz = round(min(unlist(lapply(maldi_data,mass))), digits=4)
335 maxmz = round(max(unlist(lapply(maldi_data,mass))), digits=4)
336 maxfeatures = round(length(unlist(lapply(maldi_data,mass)))/length(maldi_data), digits=2)
337 medint = round(median(unlist(lapply(maldi_data,intensity))), digits=2)
338 spectra_aligned = c(minmz, maxmz,maxfeatures, medint)
339 QC_numbers= cbind(QC_numbers, spectra_aligned )
340 vectorofactions = append(vectorofactions, "spectra_aligned")
254 #end if 341 #end if
342
255 #end for 343 #end for
344
345 rownames(QC_numbers) = c("min m/z", "max mz", "# features", "median\nintensity")
346 plot(0,type='n',axes=FALSE,ann=FALSE)
347 grid.table(t(QC_numbers))
256 348
257 dev.off() 349 dev.off()
258 350
259 ## export imzML file 351 ## export imzML file
260 if (length(maldi_data)>0){ 352 if (length(maldi_data)>0){
272 364
273 ]]> 365 ]]>
274 </configfile> 366 </configfile>
275 </configfiles> 367 </configfiles>
276 <inputs> 368 <inputs>
277 <param name="infile" type="data" format="imzml,rdata" label="MS metadata" help="This file is in imzML format or Cardinal MSImageSet saved as RData"/> 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"/>
278 <conditional name="restriction_conditional"> 370 <conditional name="restriction_conditional">
279 <param name="restriction" type="select" label="Read in only spectra of interest" help="This option only works for imzML files"> 371 <param name="restriction" type="select" label="Read in only spectra of interest" help="This option only works for imzML files">
280 <option value="no_restriction" selected="True">Calculate on entire file</option> 372 <option value="no_restriction" selected="True">Calculate on entire file</option>
281 <option value="restrict">Restrict to coordinates of interest</option> 373 <option value="restrict">Restrict to coordinates of interest</option>
282 </param> 374 </param>
283 <when value="restrict"> 375 <when value="restrict">
284 <param name="coordinates_file" type="data" format="tabular" label="Tabular file with coordinates which should be read" help="x-values in first column, y-values in second column"/> 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"/>
377 <param name="coordinates_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
285 </when> 378 </when>
286 <when value="no_restriction"/> 379 <when value="no_restriction"/>
287 </conditional> 380 </conditional>
288 <conditional name="tabular_annotation"> 381 <conditional name="tabular_annotation">
289 <param name="load_annotation" type="select" label="Use pixel annotation from tabular file to have updated annotation information in case empty spectra will be removed"> 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">
290 <option value="no_annotation" selected="True">use no annotation</option> 383 <option value="no_annotation" selected="True">use no annotation</option>
291 <option value="yes_annotation">use pixel annotation from a tabular file</option> 384 <option value="yes_annotation">use pixel annotation from a tabular file</option>
292 </param> 385 </param>
293 <when value="yes_annotation"> 386 <when value="yes_annotation">
294 <param name="annotation_file" type="data" format="tabular" label="Use annotations from tabular file" 387 <param name="annotation_file" type="data" format="tabular" label="Use annotations from tabular file"
300 </when> 393 </when>
301 <when value="no_annotation"/> 394 <when value="no_annotation"/>
302 </conditional> 395 </conditional>
303 <repeat name="methods" title="Method" min="1"> 396 <repeat name="methods" title="Method" min="1">
304 <conditional name="methods_conditional"> 397 <conditional name="methods_conditional">
305 <param name="method" type="select" label="Select the method you want to apply"> 398 <param name="method" type="select" label="Select a method">
306 <option value="Transformation" selected="True">Transformation</option> 399 <option value="Transformation" selected="True">Transformation</option>
307 <option value="Smoothing">Smoothing</option> 400 <option value="Smoothing">Smoothing</option>
308 <option value="Baseline">Baseline removal</option> 401 <option value="Baseline">Baseline removal</option>
309 <option value="Calibrate">Calibrate</option> 402 <option value="Calibrate">Calibrate</option>
310 <option value="Align">Align Spectra (warping/phase correction)</option> 403 <option value="Align">Align Spectra (warping/phase correction)</option>
311 <validator type="empty_field" /> 404 <validator type="empty_field" />
312 </param> 405 </param>
313 <when value="Transformation"> 406 <when value="Transformation">
314 <param name="transform_method" type="select" label="Select your transfprormation method"> 407 <param name="transform_method" type="select" label="Select the transfprormation method">
315 <option value="sqrt" selected="True">sqrt</option> 408 <option value="sqrt" selected="True">sqrt</option>
316 <option value="log">log</option> 409 <option value="log">log</option>
317 <option value="log2">log2</option> 410 <option value="log2">log2</option>
318 <option value="log10">log10</option> 411 <option value="log10">log10</option>
319 <validator type="empty_field" /> 412 <validator type="empty_field" />
338 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize] 431 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]
339 (window size is 2*halfWindowSize+1). 432 (window size is 2*halfWindowSize+1).
340 The best size differs depending on the selected smoothing method."/> 433 The best size differs depending on the selected smoothing method."/>
341 </when> 434 </when>
342 <when value="Baseline"> 435 <when value="Baseline">
343 <param name="baseline_method" type="select" label="Baseline removal method"> 436 <conditional name="methods_for_baseline">
344 <option value="SNIP" selected="True">SNIP</option> 437 <param name="baseline_method" type="select" label="Baseline removal method">
345 <option value="TopHat">TopHat</option> 438 <option value="SNIP" selected="True">SNIP</option>
346 <option value="ConvexHull">ConvexHull</option> 439 <option value="TopHat">TopHat</option>
347 <option value="median">median</option> 440 <option value="ConvexHull">ConvexHull</option>
348 <validator type="empty_field" /> 441 <option value="median">median</option>
349 </param> 442 <validator type="empty_field" />
350 <param name="iterations" type="integer" value="100" 443 </param>
351 label="Number of iterations" 444 <when value="SNIP">
352 help=""/> 445 <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]"/>
447 </when>
448 <when value="TopHat">
449 <param name="tophat_halfWindowSize" type="integer" value="10"
450 label="Half window size" help="The resulting window reaches from
451 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]"/>
452 </when>
453 <when value="ConvexHull"/>
454 <when value="median">
455 <param name="median_halfWindowSize" type="integer" value="10"
456 label="Half window size" help="The resulting window reaches from
457 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]"/>
458 </when>
459 </conditional>
353 </when> 460 </when>
354 <when value="Calibrate"> 461 <when value="Calibrate">
355 <param name="calibrate_method" type="select" label="Calibration method"> 462 <param name="calibrate_method" type="select" label="Calibration method">
356 <option value="TIC" selected="True">TIC</option> 463 <option value="TIC" selected="True">TIC</option>
357 <option value="PQN">PQN</option> 464 <option value="PQN">PQN</option>
358 <option value="median">median</option> 465 <option value="median">median</option>
359 <validator type="empty_field" /> 466 <validator type="empty_field" />
360 </param> 467 </param>
361 <param name="mass_start" type="integer" value="0" 468 <param name="mass_start" type="integer" value="0"
362 label="Start of m/z range, has to be inside m/z range" 469 label="Start of m/z range, has to be inside m/z range"
363 help="Scaling factor is calculated on the mass range and applied to the whole spectrum"/> 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"/>
364 <param name="mass_end" type="integer" value="0" 471 <param name="mass_end" type="integer" value="0"
365 label="End of m/z range, has to be inside m/z range" 472 label="End of m/z range, has to be inside m/z range"/>
366 help="The Start and End value needs to be different from 0 to be taken into account and."/>
367 </when> 473 </when>
368 <when value="Align"> 474 <when value="Align">
369 <param name="warping_method" type="select" label="Warping methods"> 475 <param name="warping_method" type="select" label="Warping methods">
370 <option value="lowess" selected="True">Lowess</option> 476 <option value="lowess" selected="True">Lowess</option>
371 <option value="linear">Linear</option> 477 <option value="linear">Linear</option>
382 help="The resulting window reaches from 488 help="The resulting window reaches from
383 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize] 489 mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]
384 (window size is 2*halfWindowSize+1). 490 (window size is 2*halfWindowSize+1).
385 The best size differs depending on the selected smoothing method."/> 491 The best size differs depending on the selected smoothing method."/>
386 492
387 <param name="snr" type="integer" value="2" 493 <param name="snr" type="integer" value="2" label="Signal-to-noise-ratio"/>
388 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"/>
389 help=""/> 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"/>
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"/>
390 497
391 <conditional name="reference_for_alignment"> 498 <conditional name="reference_for_alignment">
392 <param name="align_ref" type="select" label="Reference to which the samples should be aligned" help="Use internal calibrants to perform m/z calibration"> 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">
393 <option value="no_reference" selected="True">no reference</option> 500 <option value="no_reference" selected="True">no reference</option>
394 <option value="yes_reference">reference from tabular file</option> 501 <option value="yes_reference">reference from tabular file</option>
396 <when value="no_reference"/> 503 <when value="no_reference"/>
397 <when value="yes_reference"> 504 <when value="yes_reference">
398 <param name="reference_file" type="data" format="tabular" 505 <param name="reference_file" type="data" format="tabular"
399 label="Tabular file with m/z of internal calibrants (MassPeaks) which should be used for spectra alignment" 506 label="Tabular file with m/z of internal calibrants (MassPeaks) which should be used for spectra alignment"
400 help="calibration of m/z values to internal calibrants, at least 2 m/z per spectrum are needed"/> 507 help="calibration of m/z values to internal calibrants, at least 2 m/z per spectrum are needed"/>
401 <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"/> 508 <param name="reference_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
402 <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"/>
403 <param name="remove_empty" type="boolean" label="Should empty spectra be removed" truevalue="TRUE" falsevalue="FALSE"/>
404 </when> 509 </when>
405 </conditional> 510 </conditional>
406 </when> 511 </when>
407 </conditional> 512 </conditional>
408 </repeat> 513 </repeat>
409 <param name="export_processed" type="boolean" label="Export file as processed imzML" help="otherwise continuous imzML will be exported" truevalue="TRUE" falsevalue="FALSE"/> 514 <param name="export_processed" type="boolean" label="Export file as processed imzML" help="otherwise continuous imzML will be exported" truevalue="TRUE" falsevalue="FALSE"/>
410 </inputs> 515 </inputs>
411 <outputs> 516 <outputs>
412 <data format="imzml" name="outfile_imzml" label="$infile.display_name processed" /> 517 <data format="imzml" name="outfile_imzml" label="$infile.display_name preprocessed" />
413 <data format="pdf" name="plots" from_work_dir="prepro_qc_plot.pdf" label="$infile.display_name preprocessed QC"/> 518 <data format="pdf" name="plots" from_work_dir="prepro_qc_plot.pdf" label="$infile.display_name preprocessed QC"/>
414 <data format="tabular" name="annotation_output" label="$infile.display_name annotations"> 519 <data format="tabular" name="annotation_output" label="$infile.display_name annotations">
415 <filter>tabular_annotation["load_annotation"] == 'yes_annotation'</filter> 520 <filter>tabular_annotation["load_annotation"] == 'yes_annotation'</filter>
416 </data> 521 </data>
417 </outputs> 522 </outputs>
462 </conditional> 567 </conditional>
463 <conditional name="methods_conditional"> 568 <conditional name="methods_conditional">
464 <param name="method" value="Align"/> 569 <param name="method" value="Align"/>
465 <param name="warping_method" value="linear"/> 570 <param name="warping_method" value="linear"/>
466 <param name="halfWindowSize" value="1"/> 571 <param name="halfWindowSize" value="1"/>
572 <param name="allow_nomatch" value="TRUE"/>
573 <param name="remove_empty" value="TRUE"/>
574 <param name="empty_nomatch" value="TRUE"/>
467 <conditional name="reference_for_alignment"> 575 <conditional name="reference_for_alignment">
468 <param name="align_ref" value="yes_reference"/> 576 <param name="align_ref" value="yes_reference"/>
469 <param name="reference_file" value="align_reference_test2.tabular" ftype="tabular"/> 577 <param name="reference_file" value="align_reference_test2.tabular" ftype="tabular"/>
470 <param name="allow_nomatch" value="TRUE"/>
471 <param name="remove_empty" value="TRUE"/>
472 <param name="empty_nomatch" value="TRUE"/>
473 </conditional> 578 </conditional>
474 </conditional> 579 </conditional>
475 <output name="outfile_imzml" file="outfile3.imzML" compare="sim_size"/> 580 <output name="outfile_imzml" file="outfile3.imzML" compare="sim_size"/>
476 <output name="outfile_imzml" file="outfile3.ibd" compare="sim_size"/> 581 <output name="outfile_imzml" file="outfile3.ibd" compare="sim_size"/>
477 <output name="plots" file="Preprocessing3_QC.pdf" compare="sim_size"/> 582 <output name="plots" file="Preprocessing3_QC.pdf" compare="sim_size"/>
478 <output name="annotation_output" file="annotations_output3.tabular"/> 583 <output name="annotation_output" file="annotations_output3.tabular"/>
479 </test> 584 </test>
480 </tests> 585 </tests>
481 <help><![CDATA[ 586 <help><![CDATA[
482 587
483 MALDIquant_ provides a complete analysis pipeline for MALDI-TOF and other mass spectrometry data. So far we have only implemented the functionalities for mass spectrometry imaging data. 588 @MADLI_QUANT_DESCRIPTION@
484 589
485 Input data: 590 -----
486 591
487 - MSI data as imzML file (upload via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_ 592 **Input data**
488 - optinal tabular file with pixel coordinates to restrict reading of imzML file to coordinates of interest 593
489 594 - MSI data: 2 types of input data can be used:
490 Options: 595
596 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_
597 - Cardinal "MSImageSet" data saved as .RData
598 - Only for Cardinal RData files and when remove empty spectra is chosen: Tabular file with coordinates annotations. Separate columns for x and y coordinates and a third column with pixel annotations. Tabular files with any header name or no header at all are supported
599 - Optional: Tabular file with pixel coordinates to restrict reading of imzML files to coordinates of interest. The file has to contain x values in the first column and y values in the second columns. Further columns are allowed. Tabular files with any header name or no header at all are supported.
600
601 ::
602
603 x_coord y_coord
604 1 1
605 2 1
606 3 1
607 ...
608 ...
609
610 - Optional: Tabular file with reference m/z for the spectra align function. At least 2 m/z values of the input list must be present in every spectrum to peform the alignment. First column must contain m/z values, without empty fields or letters. Tabular files with any header name or no header at all are supported.
611
612 ::
613
614
615 m/z
616 100.0
617 100.01
618 100.02
619 ...
620 ...
621
622
623
624 **Options**
491 625
492 - Transformation: transformation of intensities with log, log2, log10 and squareroot 626 - Transformation: transformation of intensities with log, log2, log10 and squareroot
493 - Smoothing: Smoothing of the peaks reduces noise and improves peak detection. Available smoothing methods are SavitzkyGolay and Moving Average 627 - Smoothing: Smoothing of the peaks reduces noise and improves peak detection. Available smoothing methods are SavitzkyGolay and Moving Average
494 - Baseline reduction: Baseline reduction removes background intensity generated by chemical noise (common in MALDI datasets). Available methods are SNIP, TopHat,ConvexHull and median. 628 - Baseline reduction: Baseline reduction removes background intensity generated by chemical noise (common in MALDI datasets).
629
630 - Available methods are SNIP, TopHat,ConvexHull and median:
631 - SNIP is the default baseline reduction method in MALDIquant.
632 - ConvexHull cannot be used for MALDI-TOF baseline removal.
633 - 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.
635
495 - Intensity calibration (normalization): Normalization of intensities to Total Ion Current (TIC), median spectrum, Probabilistic Quotient Normalization (PQN) 636 - Intensity calibration (normalization): Normalization of intensities to Total Ion Current (TIC), median spectrum, Probabilistic Quotient Normalization (PQN)
496 - Spectra alignment (warping):alignment for (re)calibration of m/z values 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.
497 638
498 639
499 Output: 640 **Output**
500 641
501 - imzML file (imzML format can be continuous or processed) 642 - imzML file (imzML format can be continuous or processed)
502 - pdf with average mass spectra after each preprocessing step 643 - PDF with average mass spectra after each preprocessing step
503 644
504 .. _MALDIquant: http://strimmerlab.org/software/maldiquant/ 645 .. _MALDIquant: http://strimmerlab.org/software/maldiquant/
505 646
506 ]]> 647 ]]>
507 </help> 648 </help>