comparison preprocessing.xml @ 6:5bf056c0354e draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 15e24b1f0143679647906bc427654f66b417a45c"
author galaxyp
date Wed, 25 Mar 2020 08:13:17 -0400
parents ed9ed1e6cca2
children 44a4b31fcbf3
comparison
equal deleted inserted replaced
5:ed9ed1e6cca2 6:5bf056c0354e
1 <tool id="cardinal_preprocessing" name="MSI preprocessing" version="@VERSION@.3"> 1 <tool id="cardinal_preprocessing" name="MSI preprocessing" version="2.4.0.0">
2 <description> 2 <description>
3 mass spectrometry imaging preprocessing 3 mass spectrometry imaging preprocessing
4 </description> 4 </description>
5 <macros> 5 <macros>
6 <import>macros.xml</import> 6 <import>macros.xml</import>
7 </macros> 7 </macros>
8 <expand macro="requirements"> 8 <requirements>
9 <requirement type="package" version="2.4.0">bioconductor-cardinal</requirement>
10 <requirement type="package" version="3.6.1">r-base</requirement>
9 <requirement type="package" version="2.3">r-gridextra</requirement> 11 <requirement type="package" version="2.3">r-gridextra</requirement>
10 <requirement type="package" version="3.0">r-ggplot2</requirement> 12 <requirement type="package" version="3.2.1">r-ggplot2</requirement>
11 <requirement type="package" version="0.20_35">r-lattice</requirement> 13 <requirement type="package" version="0.20_38">r-lattice</requirement>
12 </expand> 14 </requirements>
13 <command detect_errors="exit_code"> 15 <command detect_errors="exit_code">
14 <![CDATA[ 16 <![CDATA[
15 17
16 @INPUT_LINKING@ 18 @INPUT_LINKING@
17 cat '${cardinal_preprocessing}' && 19 cat '${cardinal_preprocessing}' &&
18 Rscript '${cardinal_preprocessing}' && 20 Rscript '${cardinal_preprocessing}' &&
19 21
20 #if str($imzml_output) == "imzml_format":
21 mkdir $outfile_imzml.files_path && 22 mkdir $outfile_imzml.files_path &&
22 mv ./out.imzML "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true && 23 mv ./out.imzML "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true &&
23 mv ./out.ibd "${os.path.join($outfile_imzml.files_path, 'ibd')}" | true && 24 mv ./out.ibd "${os.path.join($outfile_imzml.files_path, 'ibd')}" | true &&
24 #end if
25 echo "imzML file:" > $outfile_imzml && 25 echo "imzML file:" > $outfile_imzml &&
26 ls -l "$outfile_imzml.files_path" >> $outfile_imzml 26 ls -l "$outfile_imzml.files_path" >> $outfile_imzml
27 27
28 ]]> 28 ]]>
29 </command> 29 </command>
35 library(Cardinal) 35 library(Cardinal)
36 library(gridExtra) 36 library(gridExtra)
37 library(lattice) 37 library(lattice)
38 library(ggplot2) 38 library(ggplot2)
39 39
40 @READING_MSIDATA@ 40
41 41 ## function to read RData files independent of filename
42 @READING_MSIDATA_INRAM@ ###change out 42 loadRData <- function(fileName){
43 load(fileName)
44 get(ls()[ls() != "fileName"])
45 }
46
47 #if $infile.ext == 'imzml'
48 #if str($processed_cond.processed_file) == "processed":
49 msidata <- readImzML('infile', resolution=$processed_cond.accuracy, units = "$processed_cond.units")
50 centroided(msidata) = $centroids
51 #else
52 msidata <- readImzML('infile')
53 centroided(msidata) = $centroids
54 #end if
55 #elif $infile.ext == 'analyze75'
56 msidata = readAnalyze('infile')
57 centroided(msidata) = $centroids
58 #else
59 msidata = loadRData('infile.RData')
60 msidata = as(msidata, "MSImagingExperiment")
61 #end if
62
43 63
44 ## remove duplicated coordinates, otherwise peak picking and log2 transformation will fail 64 ## remove duplicated coordinates, otherwise peak picking and log2 transformation will fail
45 msidata <- msidata[,!duplicated(coord(msidata)[,1:2])] 65 msidata <- msidata[,!duplicated(coord(msidata)[,1:2])]
66
67 ## set variable to False
68 #set $used_peak_picking = False
69 #set $used_peak_alignment = False
70 #set $continuous_format = False
46 71
47 72
48 if (ncol(msidata)>0 & nrow(msidata) >0){ 73 if (ncol(msidata)>0 & nrow(msidata) >0){
49 74
50 ## start QC report 75 ## start QC report
61 maxmz = round(max(mz(msidata)), digits=2) 86 maxmz = round(max(mz(msidata)), digits=2)
62 QC_numbers= data.frame(inputdata = c(minmz, maxmz,maxfeatures, pixelcount)) 87 QC_numbers= data.frame(inputdata = c(minmz, maxmz,maxfeatures, pixelcount))
63 vectorofactions = "inputdata" 88 vectorofactions = "inputdata"
64 ## Choose random spectra for QC plots 89 ## Choose random spectra for QC plots
65 random_spectra = sample(pixels(msidata), 4, replace=FALSE) 90 random_spectra = sample(pixels(msidata), 4, replace=FALSE)
66 par(mfrow = c(2, 2), oma=c(0,0,2,0)) 91 par(oma=c(0,0,2,0))
67 for (random_sample in 1:length(random_spectra)){ 92 print(plot(msidata, pixel=random_spectra))
68 plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
69 title("Input spectra", outer=TRUE, line=0) 93 title("Input spectra", outer=TRUE, line=0)
70
71 94
72 ############################### Preprocessing steps ########################### 95 ############################### Preprocessing steps ###########################
73 ############################################################################### 96 ###############################################################################
74 97
75 #for $method in $methods: 98 #for $method in $methods:
78 101
79 #if str( $method.methods_conditional.preprocessing_method ) == 'Normalization': 102 #if str( $method.methods_conditional.preprocessing_method ) == 'Normalization':
80 print('Normalization') 103 print('Normalization')
81 ##normalization 104 ##normalization
82 105
106 if (class(msidata) == "MSProcessedImagingExperiment"){
107 msidata = as(msidata, "MSContinuousImagingExperiment")
108 }
109
83 msidata = normalize(msidata, method="tic") 110 msidata = normalize(msidata, method="tic")
111 msidata <- process(msidata, BPPARAM=MulticoreParam())
112
84 113
85 ############################### QC ########################### 114 ############################### QC ###########################
86 115
87 maxfeatures =nrow(msidata) 116 maxfeatures =nrow(msidata)
88 pixelcount = ncol(msidata) 117 pixelcount = ncol(msidata)
89 minmz = round(min(mz(msidata)), digits=2) 118 minmz = round(min(mz(msidata)), digits=2)
90 maxmz = round(max(mz(msidata)), digits=2) 119 maxmz = round(max(mz(msidata)), digits=2)
91 normalized = c(minmz, maxmz,maxfeatures, pixelcount) 120 normalized = c(minmz, maxmz,maxfeatures, pixelcount)
92 QC_numbers= cbind(QC_numbers, normalized) 121 QC_numbers= cbind(QC_numbers, normalized)
93 vectorofactions = append(vectorofactions, "normalized") 122 vectorofactions = append(vectorofactions, "normalized")
94 par(mfrow = c(2, 2), oma=c(0,0,2,0)) 123 print(plot(msidata, pixel=random_spectra))
95 for (random_sample in 1:length(random_spectra)){
96 plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
97 title("Spectra after normalization", outer=TRUE, line=0) 124 title("Spectra after normalization", outer=TRUE, line=0)
98 125
99 ############################### Baseline reduction ########################### 126 ############################### Baseline reduction ###########################
100 127
101 #elif str( $method.methods_conditional.preprocessing_method ) == 'Baseline_reduction': 128 #elif str( $method.methods_conditional.preprocessing_method ) == 'Baseline_reduction':
102 print('Baseline_reduction') 129 print('Baseline_reduction')
103 ##baseline reduction 130 ##baseline reduction
104 131
132 if (class(msidata) == "MSProcessedImagingExperiment"){
133 msidata = as(msidata, "MSContinuousImagingExperiment")
134 }
135
105 msidata = reduceBaseline(msidata, method="median", blocks=$method.methods_conditional.blocks_baseline, spar=$method.methods_conditional.spar_baseline) 136 msidata = reduceBaseline(msidata, method="median", blocks=$method.methods_conditional.blocks_baseline, spar=$method.methods_conditional.spar_baseline)
137 msidata <- process(msidata, BPPARAM=MulticoreParam())
106 138
107 ############################### QC ########################### 139 ############################### QC ###########################
108 140
109 maxfeatures =nrow(msidata) 141 maxfeatures =nrow(msidata)
110 pixelcount = ncol(msidata) 142 pixelcount = ncol(msidata)
111 minmz = round(min(mz(msidata)), digits=2) 143 minmz = round(min(mz(msidata)), digits=2)
112 maxmz = round(max(mz(msidata)), digits=2) 144 maxmz = round(max(mz(msidata)), digits=2)
113 baseline = c(minmz, maxmz,maxfeatures, pixelcount) 145 baseline = c(minmz, maxmz,maxfeatures, pixelcount)
114 QC_numbers= cbind(QC_numbers, baseline) 146 QC_numbers= cbind(QC_numbers, baseline)
115 vectorofactions = append(vectorofactions, "baseline red.") 147 vectorofactions = append(vectorofactions, "baseline red.")
116 for (random_sample in 1:length(random_spectra)){ 148 print(plot(msidata, pixel=random_spectra))
117 plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
118 title("Spectra after baseline reduction", outer=TRUE, line=0) 149 title("Spectra after baseline reduction", outer=TRUE, line=0)
119 150
120 ############################### Smoothing ########################### 151 ############################### Smoothing ###########################
121 152
122 #elif str( $method.methods_conditional.preprocessing_method ) == 'Smoothing': 153 #elif str( $method.methods_conditional.preprocessing_method ) == 'Smoothing':
123 print('Smoothing') 154 print('Smoothing')
124 ## Smoothing 155 ## Smoothing
156
157 if (class(msidata) == "MSProcessedImagingExperiment"){
158 msidata = as(msidata, "MSContinuousImagingExperiment")
159 }
160
125 161
126 #if str( $method.methods_conditional.methods_for_smoothing.smoothing_method) == 'gaussian': 162 #if str( $method.methods_conditional.methods_for_smoothing.smoothing_method) == 'gaussian':
127 print('gaussian smoothing') 163 print('gaussian smoothing')
128 164
129 msidata = smoothSignal(msidata, method="$method.methods_conditional.methods_for_smoothing.smoothing_method", window=$method.methods_conditional.window_smoothing, sd = $method.methods_conditional.methods_for_smoothing.sd_gaussian) 165 msidata = smoothSignal(msidata, method="$method.methods_conditional.methods_for_smoothing.smoothing_method", window=$method.methods_conditional.window_smoothing, sd = $method.methods_conditional.methods_for_smoothing.sd_gaussian)
142 print('moving average smoothing') 178 print('moving average smoothing')
143 179
144 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) 180 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)
145 181
146 #end if 182 #end if
183 msidata <- process(msidata, BPPARAM=MulticoreParam())
147 184
148 ############################### QC ########################### 185 ############################### QC ###########################
149 186
150 maxfeatures =nrow(msidata) 187 maxfeatures =nrow(msidata)
151 pixelcount = ncol(msidata) 188 pixelcount = ncol(msidata)
152 minmz = round(min(mz(msidata)), digits=2) 189 minmz = round(min(mz(msidata)), digits=2)
153 maxmz = round(max(mz(msidata)), digits=2) 190 maxmz = round(max(mz(msidata)), digits=2)
154 smoothed = c(minmz, maxmz,maxfeatures, pixelcount) 191 smoothed = c(minmz, maxmz,maxfeatures, pixelcount)
155 QC_numbers= cbind(QC_numbers, smoothed) 192 QC_numbers= cbind(QC_numbers, smoothed)
156 vectorofactions = append(vectorofactions, "smoothed") 193 vectorofactions = append(vectorofactions, "smoothed")
157 for (random_sample in 1:length(random_spectra)){ 194 print(plot(msidata, pixel=random_spectra))
158 plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
159 title("Spectra after smoothing", outer=TRUE, line=0) 195 title("Spectra after smoothing", outer=TRUE, line=0)
160 196
161 ############################### Peak picking ########################### 197 ############################### Peak picking ###########################
162 198
163 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_picking': 199 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_picking':
200 #set $used_peak_picking = True
164 print('Peak_picking') 201 print('Peak_picking')
165 ## Peakpicking 202 ## Peakpicking
166 203
167 #if str( $method.methods_conditional.methods_for_picking.picking_method) == 'adaptive': 204 #if str( $method.methods_conditional.methods_for_picking.picking_method) == 'adaptive':
168 print('adaptive peakpicking') 205 print('adaptive peakpicking')
169 206
170 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) 207 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)
171 208
172 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'limpic': 209 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'mad':
173 print('limpic peakpicking') 210 print('mad peakpicking')
174 211
175 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) 212 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)
176 213
177 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'simple': 214 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'simple':
178 print('simple peakpicking') 215 print('simple peakpicking')
179 216
180 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) 217 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)
181 218
182 #end if 219 #end if
220 msidata <- process(msidata, BPPARAM=MulticoreParam())
221
222 #if str($method.methods_conditional.imzml_output) == "cont_format":
223 #set $continuous_format = True
224 #end if
225
183 226
184 ############################### QC ########################### 227 ############################### QC ###########################
185 228
186 maxfeatures =nrow(msidata) 229 maxfeatures =nrow(msidata)
187 pixelcount = ncol(msidata) 230 pixelcount = ncol(msidata)
188 minmz = round(min(mz(msidata)), digits=2) 231 minmz = round(min(mz(msidata)), digits=2)
189 maxmz = round(max(mz(msidata)), digits=2) 232 maxmz = round(max(mz(msidata)), digits=2)
190 picked = c(minmz, maxmz,maxfeatures, pixelcount) 233 picked = c(minmz, maxmz,maxfeatures, pixelcount)
191 QC_numbers= cbind(QC_numbers, picked) 234 QC_numbers= cbind(QC_numbers, picked)
192 vectorofactions = append(vectorofactions, "picked") 235 vectorofactions = append(vectorofactions, "picked")
193 for (random_sample in 1:length(random_spectra)){ 236 print(plot(msidata, pixel=random_spectra))
194 plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
195 title("Spectra after peak picking", outer=TRUE, line=0) 237 title("Spectra after peak picking", outer=TRUE, line=0)
196 238
197 ############################### Peak alignment ########################### 239 ############################### Peak alignment ###########################
198 240
199 #elif str( $method.methods_conditional.preprocessing_method ) == 'Peak_alignment': 241 #elif str( $method.methods_conditional.preprocessing_method ) == 'Peak_alignment':
242 #set $used_peak_alignment = True
200 print('Peak_alignment') 243 print('Peak_alignment')
201 ## Peakalignment 244 ## Peakalignment
202 245
203 #if str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_noref': 246 #if str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_table':
204
205 align_peak_reference = msidata
206
207 #elif str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_table':
208 247
209 align_reference_table = read.delim("$method.methods_conditional.align_ref_type.mz_tabular", header = $method.methods_conditional.align_ref_type.feature_header, stringsAsFactors = FALSE) 248 align_reference_table = read.delim("$method.methods_conditional.align_ref_type.mz_tabular", header = $method.methods_conditional.align_ref_type.feature_header, stringsAsFactors = FALSE)
249
210 align_reference_column = align_reference_table[,$method.methods_conditional.align_ref_type.feature_column] 250 align_reference_column = align_reference_table[,$method.methods_conditional.align_ref_type.feature_column]
211 align_peak_reference = align_reference_column[align_reference_column>=min(mz(msidata)) & align_reference_column<=max(mz(msidata))] 251
252 align_peak_reference = as.numeric(align_reference_column[align_reference_column>=min(mz(msidata)) & align_reference_column<=max(mz(msidata))])
212 if (length(align_peak_reference) == 0) 253 if (length(align_peak_reference) == 0)
213 {align_peak_reference = 0} 254 {align_peak_reference = 0}
214 255
215 #elif str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_msidata_ref': 256 msidata = peakAlign(msidata,tolerance =$method.methods_conditional.value_diffalignment, units = "$method.methods_conditional.units_diffalignment", ref=align_peak_reference)
216 257
217 align_peak_reference = loadRData('$method.methods_conditional.align_ref_type.align_peaks_msidata') 258
218 259 #elif str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_noref':
219 #end if 260
220 261 msidata = peakAlign(msidata,tolerance =$method.methods_conditional.value_diffalignment, units = "$method.methods_conditional.units_diffalignment")
221 #if str( $method.methods_conditional.methods_for_alignment.alignment_method) == 'diff': 262
222 print('diff peakalignment') 263 #end if
223 264
224 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) 265 msidata <- process(msidata, BPPARAM=MulticoreParam())
225 266
226 #elif str( $method.methods_conditional.methods_for_alignment.alignment_method) == 'DP': 267 #if str($method.methods_conditional.imzml_output) == "cont_format":
227 print('DPpeakalignment') 268 #set $continuous_format = True
228 269 #end if
229 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)
230
231 #end if
232 270
233 ############################### QC ########################### 271 ############################### QC ###########################
234 272
235 maxfeatures =nrow(msidata) 273 maxfeatures =nrow(msidata)
236 pixelcount = ncol(msidata) 274 pixelcount = ncol(msidata)
237 minmz = round(min(mz(msidata)), digits=2) 275 minmz = round(min(mz(msidata)), digits=2)
238 maxmz = round(max(mz(msidata)), digits=2) 276 maxmz = round(max(mz(msidata)), digits=2)
239 aligned = c(minmz, maxmz,maxfeatures, pixelcount) 277 aligned = c(minmz, maxmz,maxfeatures, pixelcount)
240 QC_numbers= cbind(QC_numbers, aligned) 278 QC_numbers= cbind(QC_numbers, aligned)
241 vectorofactions = append(vectorofactions, "aligned") 279 vectorofactions = append(vectorofactions, "aligned")
242 for (random_sample in 1:length(random_spectra)){ 280 print(plot(msidata, pixel=random_spectra))
243 plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
244 title("Spectra after alignment", outer=TRUE, line=0) 281 title("Spectra after alignment", outer=TRUE, line=0)
245 282
246 ############################### Peak filtering ########################### 283 ############################### Peak filtering ###########################
247 284
248 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_filtering': 285 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_filtering':
249 print('Peak_filtering') 286 print('Peak_filtering')
250 287
251 msidata = peakFilter(msidata, method='freq', freq.min = $method.methods_conditional.frequ_filtering) 288 msidata = peakFilter(msidata, freq.min = $method.methods_conditional.frequ_filtering)
289 msidata <- process(msidata, BPPARAM=MulticoreParam())
252 290
253 ############################### QC ########################### 291 ############################### QC ###########################
254 292
255 maxfeatures =nrow(msidata) 293 maxfeatures =nrow(msidata)
256 pixelcount = ncol(msidata) 294 pixelcount = ncol(msidata)
257 minmz = round(min(mz(msidata)), digits=2) 295 minmz = round(min(mz(msidata)), digits=2)
258 maxmz = round(max(mz(msidata)), digits=2) 296 maxmz = round(max(mz(msidata)), digits=2)
259 filtered = c(minmz, maxmz,maxfeatures, pixelcount) 297 filtered = c(minmz, maxmz,maxfeatures, pixelcount)
260 QC_numbers= cbind(QC_numbers, filtered) 298 QC_numbers= cbind(QC_numbers, filtered)
261 vectorofactions = append(vectorofactions, "filtered") 299 vectorofactions = append(vectorofactions, "filtered")
262 for (random_sample in 1:length(random_spectra)){ 300 print(plot(msidata, pixel=random_spectra))
263 plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
264 title("Spectra after filtering", outer=TRUE, line=0) 301 title("Spectra after filtering", outer=TRUE, line=0)
265 302
266 ############################### Data reduction ########################### 303 ############################### Data reduction ###########################
267 304
268 #elif str( $method.methods_conditional.preprocessing_method) == 'Data_reduction': 305 #elif str( $method.methods_conditional.preprocessing_method) == 'Data_reduction':
269 print('Data_reduction') 306 print('Data_reduction')
307
308 ## these functions only work on MSImageSet
309 msidata = as(msidata, "MSImageSet")
270 310
271 #if str( $method.methods_conditional.methods_for_reduction.reduction_method) == 'bin': 311 #if str( $method.methods_conditional.methods_for_reduction.reduction_method) == 'bin':
272 print('bin reduction') 312 print('bin reduction')
273 313
274 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) 314 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)
300 340
301 #end if 341 #end if
302 342
303 msidata = reduceDimension(msidata, method="peaks", ref=peak_reference, type="$method.methods_conditional.methods_for_reduction.peaks_type") 343 msidata = reduceDimension(msidata, method="peaks", ref=peak_reference, type="$method.methods_conditional.methods_for_reduction.peaks_type")
304 #end if 344 #end if
345
346 ## coercition into new format
347 msidata = as(msidata, "MSImagingExperiment")
348
305 ############################### QC ########################### 349 ############################### QC ###########################
306 350
307 maxfeatures =nrow(msidata) 351 maxfeatures =nrow(msidata)
308 pixelcount = ncol(msidata) 352 pixelcount = ncol(msidata)
309 minmz = round(min(mz(msidata)), digits=2) 353 minmz = round(min(mz(msidata)), digits=2)
310 maxmz = round(max(mz(msidata)), digits=2) 354 maxmz = round(max(mz(msidata)), digits=2)
311 reduced = c(minmz, maxmz,maxfeatures, pixelcount) 355 reduced = c(minmz, maxmz,maxfeatures, pixelcount)
312 QC_numbers= cbind(QC_numbers, reduced) 356 QC_numbers= cbind(QC_numbers, reduced)
313 vectorofactions = append(vectorofactions, "reduced") 357 vectorofactions = append(vectorofactions, "reduced")
314 for (random_sample in 1:length(random_spectra)){ 358 print(plot(msidata, pixel=random_spectra))
315 plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
316 title("Spectra after data reduction", outer=TRUE, line=0) 359 title("Spectra after data reduction", outer=TRUE, line=0)
317 360
318 ############################### Transformation ########################### 361 ############################### Transformation ###########################
319 362
320 #elif str( $method.methods_conditional.preprocessing_method) == 'Transformation': 363 #elif str( $method.methods_conditional.preprocessing_method) == 'Transformation':
321 print('Transformation') 364 print('Transformation')
322 365
323 ## convert data into R matrix what brings it automatically into memory and can take some take but next steps need R matrix 366 if (class(msidata) == "MSProcessedImagingExperiment"){
324 ##iData(msidata) <- iData(msidata)[] 367 msidata = as(msidata, "MSContinuousImagingExperiment")
368 }
325 369
326 #if str( $method.methods_conditional.transf_conditional.trans_type) == 'log2': 370 #if str( $method.methods_conditional.transf_conditional.trans_type) == 'log2':
327 print('log2 transformation') 371 print('log2 transformation')
328 372
329 ## replace 0 with NA to prevent Inf 373 ## replace 0 with NA to prevent Inf
330 spectra_df = spectra(msidata)[] ## convert into R matrix 374 spectra_df = spectra(msidata) ## convert into R matrix
331 spectra_df[spectra_df ==0] = NA 375 spectra_df[spectra_df ==0] = NA
332 print(paste0("Number of 0 which were converted into NA:",sum(is.na(spectra_df)))) 376 print(paste0("Number of 0 which were converted into NA:",sum(is.na(spectra_df))))
333 spectra(msidata) = spectra_df 377 spectra(msidata) = spectra_df
334 ## log transformation 378 ## log transformation
335 spectra(msidata) = log2(spectra(msidata)) 379 spectra(msidata) = log2(spectra(msidata))
339 #end if 383 #end if
340 384
341 #elif str( $method.methods_conditional.transf_conditional.trans_type) == 'sqrt': 385 #elif str( $method.methods_conditional.transf_conditional.trans_type) == 'sqrt':
342 print('squareroot transformation') 386 print('squareroot transformation')
343 387
344 spectra(msidata) = sqrt(spectra(msidata)[]) 388 spectra(msidata) = sqrt(spectra(msidata))
345 389
346 #end if 390 #end if
347 391
348 ############################### QC ########################### 392 ############################### QC ###########################
349 393
352 minmz = round(min(mz(msidata)), digits=2) 396 minmz = round(min(mz(msidata)), digits=2)
353 maxmz = round(max(mz(msidata)), digits=2) 397 maxmz = round(max(mz(msidata)), digits=2)
354 transformed = c(minmz, maxmz,maxfeatures, pixelcount) 398 transformed = c(minmz, maxmz,maxfeatures, pixelcount)
355 QC_numbers= cbind(QC_numbers, transformed) 399 QC_numbers= cbind(QC_numbers, transformed)
356 vectorofactions = append(vectorofactions, "transformed") 400 vectorofactions = append(vectorofactions, "transformed")
357 for (random_sample in 1:length(random_spectra)){ 401 print(plot(msidata, pixel=random_spectra))
358 plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
359 title("Spectra after transformation", outer=TRUE, line=0) 402 title("Spectra after transformation", outer=TRUE, line=0)
360 403
361 #end if 404 #end if
362 #end for 405 #end for
363 406
364 ############# Outputs: RData, imzml and QC report ############# 407 ############# Outputs: RData, imzml and QC report #############
365 ################################################################################ 408 ################################################################################
366 409
367 ## save msidata as imzML file, will only work if there is at least 1 m/z left 410 ## save msidata as imzML file, will only work if there is at least 1 m/z left
368 411
369 #if str($imzml_output) == "imzml_format":
370 if (nrow(msidata) > 0){ 412 if (nrow(msidata) > 0){
371 ## make sure that coordinates are integers 413 ## make sure that coordinates are integers
372 coord(msidata)\$y = as.integer(coord(msidata)\$y) 414 coord(msidata)\$y = as.integer(coord(msidata)\$y)
373 coord(msidata)\$x = as.integer(coord(msidata)\$x) 415 coord(msidata)\$x = as.integer(coord(msidata)\$x)
374 writeImzML(msidata, "out")} 416 #if $used_peak_picking:
375 #elif str($imzml_output) == "rdata_format": 417 #if $continuous_format:
376 ## save as (.RData) 418 msidata = as(msidata, "MSContinuousImagingExperiment")
377 iData(msidata) = iData(msidata)[] 419 #end if
378 save(msidata, file="$outfile_rdata") 420 #elif $used_peak_alignment
379 #end if 421 #if $continuous_format:
422 msidata = as(msidata, "MSContinuousImagingExperiment")
423 #end if
424 #end if
425 writeImzML(msidata, "out")
426 }
380 427
381 plot(0,type='n',axes=FALSE,ann=FALSE) 428 plot(0,type='n',axes=FALSE,ann=FALSE)
382 rownames(QC_numbers) = c("min m/z", "max mz", "# features", "# spectra") 429 rownames(QC_numbers) = c("min m/z", "max mz", "# features", "# spectra")
383 grid.table(t(QC_numbers)) 430 grid.table(t(QC_numbers))
384
385 dev.off() 431 dev.off()
386 432
387 }else{ 433 }else{
388 print("inputfile has no intensities > 0") 434 print("inputfile has no intensities > 0")
389 } 435 }
393 <inputs> 439 <inputs>
394 <expand macro="reading_msidata"/> 440 <expand macro="reading_msidata"/>
395 <repeat name="methods" title="Preprocessing" min="1" max="50"> 441 <repeat name="methods" title="Preprocessing" min="1" max="50">
396 <conditional name="methods_conditional"> 442 <conditional name="methods_conditional">
397 <param name="preprocessing_method" type="select" label="Preprocessing methods"> 443 <param name="preprocessing_method" type="select" label="Preprocessing methods">
398 <option value="Normalization" selected="True">Intensity Normalization (TIC)</option> 444 <option value="Normalization" selected="True">Intensity Normalization</option>
399 <option value="Baseline_reduction">Baseline Reduction</option> 445 <option value="Baseline_reduction">Baseline Reduction</option>
400 <option value="Smoothing">Peak smoothing</option> 446 <option value="Smoothing">Peak smoothing</option>
401 <option value="Peak_picking">Peak picking</option> 447 <option value="Peak_picking">Peak picking</option>
402 <option value="Peak_alignment">Peak alignment</option> 448 <option value="Peak_alignment">Peak alignment</option>
403 <option value="Peak_filtering">Peak filtering</option> 449 <option value="Peak_filtering">Peak filtering</option>
404 <option value="Data_reduction">Data reduction</option> 450 <option value="Data_reduction">Data reduction</option>
405 <option value="Transformation">Transformation</option> 451 <option value="Transformation">Transformation</option>
406 </param> 452 </param>
407 <when value="Normalization"/> 453 <when value="Normalization">
454 <conditional name="methods_for_normalization">
455 <param name="normalization_method" type="select" label="Normalization method">
456 <option value="tic" selected="True">TIC</option>
457 <option value="rms">RMS</option>
458 </param>
459 <when value="tic"/>
460 <when value="rms"/>
461 </conditional>
462 </when>
408 <when value="Baseline_reduction"> 463 <when value="Baseline_reduction">
409 <param name="blocks_baseline" type="integer" value="500" 464 <param name="blocks_baseline" type="integer" value="500"
410 label="Blocks"/> 465 label="Blocks"/>
411 <param name="spar_baseline" type="float" value="1.0" label="Spar value" 466 <param name="spar_baseline" type="float" value="1.0" label="Spar value"
412 help = "Smoothing parameter for the spline smoothing 467 help = "Smoothing parameter for the spline smoothing
436 </conditional> 491 </conditional>
437 <param name="window_smoothing" type="float" value="8" 492 <param name="window_smoothing" type="float" value="8"
438 label="Window size"/> 493 label="Window size"/>
439 </when> 494 </when>
440 <when value="Peak_picking"> 495 <when value="Peak_picking">
441 <param name="SNR_picking_method" type="integer" value="6" 496 <param name="SNR_picking_method" type="float" value="6"
442 label="Signal to noise ratio" 497 label="Signal to noise ratio"
443 help="The minimal signal to noise ratio for peaks to be considered as a valid peak."/> 498 help="The minimal signal to noise ratio for peaks to be considered as a valid peak."/>
444 <param name="blocks_picking" type="integer" value="100" label = "Number of blocks" 499 <param name="blocks_picking" type="integer" value="100" label = "Number of blocks"
445 help="Number of blocks in which to divide mass spectrum to calculate noise"/> 500 help="Number of blocks in which to divide mass spectrum to calculate noise"/>
446 <param name="window_picking" type="float" value="5" label= "Window size" help="Window width for seeking local maxima"/> 501 <param name="window_picking" type="float" value="5" label= "Window size" help="Window width for seeking local maxima"/>
447 <conditional name="methods_for_picking"> 502 <conditional name="methods_for_picking">
448 <param name="picking_method" type="select" label="Peak picking method" help="only simple works for processed imzML files"> 503 <param name="picking_method" type="select" label="Peak picking method">
449 <option value="adaptive" selected="True">adaptive</option> 504 <option value="adaptive" selected="True">adaptive</option>
450 <option value="limpic">limpic</option> 505 <option value="mad">mad</option>
451 <option value="simple">simple</option> 506 <option value="simple">simple</option>
452 </param> 507 </param>
453 <when value="adaptive"> 508 <when value="adaptive">
454 <param name="spar_picking" type="float" value="1.0" 509 <param name="spar_picking" type="float" value="1.0"
455 label="Spar value" 510 label="Spar value"
456 help = "Smoothing parameter for the spline smoothing 511 help = "Smoothing parameter for the spline smoothing
457 applied to the spectrum in order to decide the cutoffs 512 applied to the spectrum in order to decide the cutoffs
458 for throwing away false noise spikes that might occur inside peaks"/> 513 for throwing away false noise spikes that might occur inside peaks"/>
459 </when> 514 </when>
460 <when value="limpic"> 515 <when value="mad"/>
461 <param name="tresh_picking" type="float" value="0.75"
462 label="thresh value" help="The thresholding quantile to use when comparing slopes in order to throw away peaks that are too flat"/>
463 </when>
464 <when value="simple"/> 516 <when value="simple"/>
465 </conditional> 517 </conditional>
518 <param name="imzml_output" type="boolean" label="imzML output in processed format" truevalue="proc_format" falsevalue="cont_format" help= "Processed imzML works only in MALDIquant tools, not yet in MSI tools (Cardinal)"/>
466 </when> 519 </when>
467 <when value="Peak_alignment"> 520 <when value="Peak_alignment">
468 <conditional name="methods_for_alignment"> 521 <param name="value_diffalignment" type="float" value="200"
469 <param name="alignment_method" type="select" label="Alignment method"> 522 label="tolerance" help="Peaks that differ less than this value will be aligned together"/>
470 <option value="diff" selected="True">diff</option> 523 <param name="units_diffalignment" type="select" display="radio" optional="False" label="units">
471 <option value="DP">DP</option> 524 <option value="ppm" selected="True">ppm</option>
472 </param> 525 <option value="mz">m/z</option>
473 <when value="diff"> 526 </param>
474 <param name="value_diffalignment" type="float" value="200"
475 label="diff.max" help="Peaks that differ less than this value will be aligned together"/>
476 <param name="units_diffalignment" type="select" display="radio" optional="False" label="units">
477 <option value="ppm" selected="True">ppm</option>
478 <option value="mz">m/z</option>
479 </param>
480 </when>
481 <when value="DP">
482 <param name="gap_DPalignment" type="float" value="0"
483 label="Gap" help="The gap penalty for the dynamic programming sequence alignment"/>
484 </when>
485 </conditional>
486 <conditional name="align_ref_type"> 527 <conditional name="align_ref_type">
487 <param name="align_reference_datatype" type="select" label="Choose reference"> 528 <param name="align_reference_datatype" type="select" label="Choose reference">
488 <option value="align_noref" selected="True">no reference</option> 529 <option value="align_noref" selected="True">no reference</option>
489 <option value="align_table" >tabular file as reference</option> 530 <option value="align_table" >tabular file as reference</option>
490 <option value="align_msidata_ref">msidata file as reference</option>
491 </param> 531 </param>
492 <when value="align_noref"/> 532 <when value="align_noref"/>
493 <when value="align_table"> 533 <when value="align_table">
494 <expand macro="reading_1_column_mz_tabular" label="Tabular file with m/z features to use for alignment. Only the m/z values from the tabular file will be kept."/> 534 <expand macro="reading_1_column_mz_tabular" label="Tabular file with m/z features to use for alignment. Only the m/z values from the tabular file will be kept."/>
495 </when> 535 </when>
496 <when value="align_msidata_ref"> 536 </conditional>
497 <param name="align_peaks_msidata" type="data" format="rdata" label="Picked and aligned Cardinal MSImageSet saved as RData"/> 537 <param name="imzml_output" type="boolean" label="imzML output in processed format" truevalue="proc_format" falsevalue="cont_format" help= "Processed imzML works only in MALDIquant tools, not yet in MSI tools (Cardinal)"/>
498 </when>
499 </conditional>
500 </when> 538 </when>
501 <when value="Peak_filtering"> 539 <when value="Peak_filtering">
502 <param name="frequ_filtering" type="integer" value="1000" 540 <param name="frequ_filtering" type="float" value="0.01" max="1" min="0" label="Minimum frequency" help="Peaks that occur in the dataset in lesser proportion than this will be dropped (0.01 --> filtering for 1% of spectra)"/>
503 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)"/>
504 </when> 541 </when>
505 <when value="Data_reduction"> 542 <when value="Data_reduction">
506 <conditional name="methods_for_reduction"> 543 <conditional name="methods_for_reduction">
507 <param name="reduction_method" type="select" label="Reduction method"> 544 <param name="reduction_method" type="select" label="Reduction method">
508 <option value="bin" selected="True">bin</option> 545 <option value="bin" selected="True">bin</option>
561 <when value="sqrt"/> 598 <when value="sqrt"/>
562 </conditional> 599 </conditional>
563 </when> 600 </when>
564 </conditional> 601 </conditional>
565 </repeat> 602 </repeat>
566 <param name="imzml_output" type="select" display = "radio" optional = "False"
567 label="Output format" help= "Choose the output format">
568 <option value="imzml_format" >imzML</option>
569 <option value="rdata_format" selected="True" >RData</option>
570 </param>
571 </inputs> 603 </inputs>
572 <outputs> 604 <outputs>
573 <data format="imzml" name="outfile_imzml" label="${tool.name} on ${on_string}: imzML"> 605 <data format="imzml" name="outfile_imzml" label="${tool.name} on ${on_string}: imzML"/>
574 <filter>imzml_output=='imzml_format'</filter>
575 </data>
576 <data format="rdata" name="outfile_rdata" label="${tool.name} on ${on_string}: RData">
577 <filter>imzml_output == 'rdata_format'</filter>
578 </data>
579 <data format="pdf" name="QC_overview" from_work_dir="Preprocessing.pdf" label = "${tool.name} on ${on_string}: QC"/> 606 <data format="pdf" name="QC_overview" from_work_dir="Preprocessing.pdf" label = "${tool.name} on ${on_string}: QC"/>
580 </outputs> 607 </outputs>
581 <tests> 608 <tests>
582 <test> 609 <test>
583 <expand macro="infile_imzml"/> 610 <expand macro="infile_imzml"/>
584 <repeat name="methods"> 611 <repeat name="methods">
585 <conditional name="methods_conditional"> 612 <conditional name="methods_conditional">
586 <param name="preprocessing_method" value="Normalization"/> 613 <param name="preprocessing_method" value="Normalization"/>
587 <conditional name="methods_for_normalization"> 614 <conditional name="methods_for_normalization">
588 <param name="normalization_method" value="median"/> 615 <param name="normalization_method" value="tic"/>
589 </conditional> 616 </conditional>
590 </conditional> 617 </conditional>
591 </repeat> 618 </repeat>
592 <repeat name="methods"> 619 <repeat name="methods">
593 <conditional name="methods_conditional"> 620 <conditional name="methods_conditional">
611 </conditional> 638 </conditional>
612 </repeat> 639 </repeat>
613 <repeat name="methods"> 640 <repeat name="methods">
614 <conditional name="methods_conditional"> 641 <conditional name="methods_conditional">
615 <param name="preprocessing_method" value="Peak_alignment"/> 642 <param name="preprocessing_method" value="Peak_alignment"/>
616 <conditional name="methods_for_alignment">
617 <param name="alignment_method" value="diff"/>
618 </conditional>
619 </conditional> 643 </conditional>
620 </repeat> 644 </repeat>
621 <repeat name="methods"> 645 <repeat name="methods">
622 <conditional name="methods_conditional"> 646 <conditional name="methods_conditional">
623 <param name="preprocessing_method" value="Peak_filtering"/> 647 <param name="preprocessing_method" value="Peak_filtering"/>
624 <param name="frequ_filtering" value="2"/> 648 <param name="frequ_filtering" value="0.3"/>
625 </conditional> 649 </conditional>
626 </repeat> 650 </repeat>
627 <repeat name="methods"> 651 <repeat name="methods">
628 <conditional name="methods_conditional"> 652 <conditional name="methods_conditional">
629 <param name="preprocessing_method" value="Transformation"/> 653 <param name="preprocessing_method" value="Transformation"/>
630 <conditional name="transf_conditional"> 654 <conditional name="transf_conditional">
631 <param name="trans_type" value="sqrt"/> 655 <param name="trans_type" value="sqrt"/>
632 </conditional> 656 </conditional>
633 </conditional> 657 </conditional>
634 </repeat> 658 </repeat>
635 <param name="imzml_output" value="imzml_format"/>
636 <output name="QC_overview" file="preprocessing_results1.pdf" compare="sim_size"/> 659 <output name="QC_overview" file="preprocessing_results1.pdf" compare="sim_size"/>
637 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results1.imzml.txt" compare="sim_size"> 660 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results1.imzml.txt" compare="sim_size">
638 <extra_files type="file" file="preprocessing_results1.imzml" name="imzml" lines_diff="4"/> 661 <extra_files type="file" file="preprocessing_results1.imzml" name="imzml" lines_diff="6"/>
639 <extra_files type="file" file="preprocessing_results1.ibd" name="ibd" compare="sim_size"/> 662 <extra_files type="file" file="preprocessing_results1.ibd" name="ibd" compare="sim_size"/>
640 </output> 663 </output>
641 </test> 664 </test>
642 <test> 665 <test>
643 <param name="infile" value="3_files_combined.RData" ftype="rdata"/> 666 <param name="infile" value="3_files_combined.RData" ftype="rdata"/>
653 </conditional> 676 </conditional>
654 </repeat> 677 </repeat>
655 <repeat name="methods"> 678 <repeat name="methods">
656 <conditional name="methods_conditional"> 679 <conditional name="methods_conditional">
657 <param name="preprocessing_method" value="Peak_alignment"/> 680 <param name="preprocessing_method" value="Peak_alignment"/>
658 <conditional name="methods_for_alignment"> 681 </conditional>
659 <param name="alignment_method" value="DP"/> 682 </repeat>
660 </conditional>
661 </conditional>
662 </repeat>
663 <param name="imzml_output" value="imzml_format"/>
664 <output name="QC_overview" file="preprocessing_results2.pdf" compare="sim_size"/> 683 <output name="QC_overview" file="preprocessing_results2.pdf" compare="sim_size"/>
665 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results2.imzml.txt" compare="sim_size"> 684 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results2.imzml.txt" compare="sim_size">
666 <extra_files type="file" file="preprocessing_results2.imzml" name="imzml" lines_diff="4"/> 685 <extra_files type="file" file="preprocessing_results2.imzml" name="imzml" lines_diff="6"/>
667 <extra_files type="file" file="preprocessing_results2.ibd" name="ibd" compare="sim_size"/> 686 <extra_files type="file" file="preprocessing_results2.ibd" name="ibd" compare="sim_size"/>
668 </output> 687 </output>
669 </test> 688 </test>
670 <test> 689 <test>
671 <expand macro="infile_analyze75"/> 690 <expand macro="infile_analyze75"/>
672 <repeat name="methods"> 691 <repeat name="methods">
673 <conditional name="methods_conditional"> 692 <conditional name="methods_conditional">
674 <param name="preprocessing_method" value="Normalization"/> 693 <param name="preprocessing_method" value="Normalization"/>
675 <conditional name="methods_for_normalization"> 694 <conditional name="methods_for_normalization">
676 <param name="normalization_method" value="median"/> 695 <param name="normalization_method" value="rms"/>
677 </conditional> 696 </conditional>
678 </conditional> 697 </conditional>
679 </repeat> 698 </repeat>
680 <repeat name="methods"> 699 <repeat name="methods">
681 <conditional name="methods_conditional"> 700 <conditional name="methods_conditional">
682 <param name="preprocessing_method" value="Peak_picking"/> 701 <param name="preprocessing_method" value="Peak_picking"/>
683 <param name="blocks_picking" value="100"/> 702 <param name="blocks_picking" value="100"/>
684 <param name="window_picking" value="5"/> 703 <param name="window_picking" value="5"/>
685 <param name="SNR_picking_method" value="3"/> 704 <param name="SNR_picking_method" value="3"/>
686 <param name="picking_method" value="limpic"/> 705 <conditional name="methods_for_picking">
687 </conditional> 706 <param name="picking_method" value="mad"/>
707 </conditional>
708 </conditional>
709 <param name="imzml_output" value="proc_format"/>
688 </repeat> 710 </repeat>
689 <repeat name="methods"> 711 <repeat name="methods">
690 <conditional name="methods_conditional"> 712 <conditional name="methods_conditional">
691 <param name="preprocessing_method" value="Peak_alignment"/> 713 <param name="preprocessing_method" value="Peak_alignment"/>
692 <conditional name="methods_for_alignment"> 714 </conditional>
693 <param name="alignment_method" value="diff"/> 715 <param name="imzml_output" value="proc_format"/>
694 </conditional> 716 </repeat>
695 </conditional> 717 <repeat name="methods">
696 </repeat> 718 <conditional name="methods_conditional">
697 <param name="imzml_output" value="imzml_format"/> 719 <param name="preprocessing_method" value="Transformation"/>
720 <conditional name="transf_conditional">
721 <param name="trans_type" value="log2"/>
722 </conditional>
723 </conditional>
724 </repeat>
698 <output name="QC_overview" file="preprocessing_results3.pdf" compare="sim_size"/> 725 <output name="QC_overview" file="preprocessing_results3.pdf" compare="sim_size"/>
699 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results3.imzml.txt" compare="sim_size"> 726 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results3.imzml.txt" compare="sim_size">
700 <extra_files type="file" file="preprocessing_results3.imzml" name="imzml" lines_diff="4"/> 727 <extra_files type="file" file="preprocessing_results3.imzml" name="imzml" lines_diff="6"/>
701 <extra_files type="file" file="preprocessing_results3.ibd" name="ibd" compare="sim_size"/> 728 <extra_files type="file" file="preprocessing_results3.ibd" name="ibd" compare="sim_size"/>
702 </output> 729 </output>
703 </test> 730 </test>
704 <test> 731 <test>
705 <expand macro="infile_analyze75"/> 732 <expand macro="infile_analyze75"/>
706 <repeat name="methods"> 733 <repeat name="methods">
707 <conditional name="methods_conditional"> 734 <conditional name="methods_conditional">
708 <param name="preprocessing_method" value="Normalization"/> 735 <param name="preprocessing_method" value="Normalization"/>
736 <param name="normalization_method" value="tic"/>
709 </conditional> 737 </conditional>
710 </repeat> 738 </repeat>
711 <repeat name="methods"> 739 <repeat name="methods">
712 <conditional name="methods_conditional"> 740 <conditional name="methods_conditional">
713 <param name="preprocessing_method" value="Data_reduction"/> 741 <param name="preprocessing_method" value="Data_reduction"/>
714 <param name="bin_width" value="0.1"/> 742 <conditional name="methods_for_reduction">
715 </conditional> 743 <param name="reduction_method" value="bin"/>
716 </repeat> 744 <param name="bin_width" value="0.1"/>
717 <param name="imzml_output" value="imzml_format"/> 745 </conditional>
746 </conditional>
747 </repeat>
718 <output name="QC_overview" file="preprocessing_results4.pdf" compare="sim_size"/> 748 <output name="QC_overview" file="preprocessing_results4.pdf" compare="sim_size"/>
719 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results4.imzml.txt" compare="sim_size"> 749 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results4.imzml.txt" compare="sim_size">
720 <extra_files type="file" file="preprocessing_results4.imzml" name="imzml" lines_diff="4"/> 750 <extra_files type="file" file="preprocessing_results4.imzml" name="imzml" lines_diff="6"/>
721 <extra_files type="file" file="preprocessing_results4.ibd" name="ibd" compare="sim_size"/> 751 <extra_files type="file" file="preprocessing_results4.ibd" name="ibd" compare="sim_size"/>
722 </output> 752 </output>
723 </test> 753 </test>
724 <test> 754 <test>
725 <expand macro="infile_imzml"/> 755 <expand macro="processed_infile_imzml"/>
726 <repeat name="methods"> 756 <conditional name="processed_cond">
727 <conditional name="methods_conditional"> 757 <param name="processed_file" value="processed"/>
728 <param name="preprocessing_method" value="Data_reduction"/> 758 <param name="accuracy" value="100"/>
729 <conditional name="methods_for_reduction"> 759 <param name="units" value="ppm"/>
730 <param name="reduction_method" value="resample"/> 760 </conditional>
731 <param name="step_width" value="0.1"/> 761 <repeat name="methods">
762 <conditional name="methods_conditional">
763 <param name="preprocessing_method" value="Transformation"/>
764 <conditional name="transf_conditional">
765 <param name="trans_type" value="sqrt"/>
732 </conditional> 766 </conditional>
733 </conditional> 767 </conditional>
734 </repeat> 768 </repeat>
735 <param name="imzml_output" value="rdata_format"/> 769 <repeat name="methods">
736 <output name="outfile_rdata" file="preprocessing_results5.RData" compare="sim_size"/> 770 <conditional name="methods_conditional">
771 <param name="preprocessing_method" value="Baseline_reduction"/>
772 </conditional>
773 </repeat>
737 <output name="QC_overview" file="preprocessing_results5.pdf" compare="sim_size"/> 774 <output name="QC_overview" file="preprocessing_results5.pdf" compare="sim_size"/>
775 <output name="outfile_imzml" ftype="imzml" file="preprocessing_results5.imzml.txt" compare="sim_size">
776 <extra_files type="file" file="preprocessing_results5.imzml" name="imzml" lines_diff="6"/>
777 <extra_files type="file" file="preprocessing_results5.ibd" name="ibd" compare="sim_size"/>
778 </output>
738 </test> 779 </test>
739 </tests> 780 </tests>
740 <help> 781 <help>
741 <![CDATA[ 782 <![CDATA[
742 783
750 - Coordinates stored as decimals rather than integers will be rounded to obtain a regular pixel grid. This might lead to duplicated coordinates which will be automatically removed after the data is read by the tool. 791 - Coordinates stored as decimals rather than integers will be rounded to obtain a regular pixel grid. This might lead to duplicated coordinates which will be automatically removed after the data is read by the tool.
751 @MZ_TABULAR_INPUT_DESCRIPTION@ 792 @MZ_TABULAR_INPUT_DESCRIPTION@
752 793
753 **Options** 794 **Options**
754 795
755 - Normalization: Normalization of intensities to total ion current (TIC) 796 - Normalization: Normalization of intensities to total ion current (TIC) or to root-mean-square (RMS)
756 - Baseline reduction: Baseline reduction removes background intensity generated by chemical noise (common in MALDI datasets) 797 - Baseline reduction: Baseline reduction removes background intensity generated by chemical noise (common in MALDI datasets)
757 - Smoothing: Smoothing of the peaks reduces noise and improves peak detection 798 - Smoothing: Smoothing of the peaks reduces noise and improves peak detection
758 - Peak picking: relevant peaks are picked while noise-peaks are removed (needs peak alignment afterwards) 799 - Peak picking: relevant peaks are picked while noise-peaks are removed (needs peak alignment afterwards)
759 - Peak alignment: only possible after peak picking, m/z inaccuracies are removed by alignment of same peaks to a common m/z value; if no reference is given the peaks are aligned to the local maxima of the mean spectrum of the current dataset; external reference data can be used from another MSI data file or a tabular file with m/z values, but then only the m/z from the reference will be kept 800 - Peak alignment: only possible after peak picking, m/z inaccuracies are removed by alignment of same peaks to a common m/z value; if no reference is given the peaks are aligned to the local maxima of the mean spectrum of the current dataset; external reference data can be used from another MSI data file or a tabular file with m/z values, but then only the m/z from the reference will be kept
760 - Peak filtering: removes peaks that occur only in a small proportion of pixels. If not sure which cut off to choose run quality control tool first and decide according to the number of peaks per m/z plot 801 - Peak filtering: removes peaks that occur only in a small proportion of pixels. If not sure which cut off to choose run quality control tool first and decide according to the number of peaks per m/z plot
761 - Data reduction: binning, resampling or peak filtering to reduce data 802 - Data reduction: binning, resampling or peak filtering to reduce data
762 - Transformation: log2 or squareroot transformation of all intensities; when using log2 transformation zero intensities will become NA, this can lead to compatibility problems. 803 - Transformation: log2 or squareroot transformation of all intensities; when using log2 transformation zero intensities will become NA, this can lead to compatibility problems.
763 804
764 **Tips**
765
766 - Peak alignment works only after peak picking
767 - Peak filtering works only on centroided data (peak picking and alignment or Data reduction peaks
768
769 **Output** 805 **Output**
770 806
771 - MSI data as imzML file or .RData (can be read with the Cardinal package in R) 807 - MSI data as continuous imzML file (option to output processed imzML file only after peak picking/peak alignment; but is not yet compatible with other MSI tools)
772 - pdf with key values and four random mass spectra after each processing step 808 - pdf with key values and four random mass spectra after each processing step
773 809
774 ]]> 810 ]]>
775 </help> 811 </help>
776 <expand macro="citations"/> 812 <expand macro="citations"/>