comparison msi_preprocessing.xml @ 0:74fcb3c95a53 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_preprocessing commit c4e490c83537b39418b5f09d624f7d4da3f3ad55
author galaxyp
date Tue, 31 Oct 2017 15:05:05 -0400
parents
children c4abf42419c2
comparison
equal deleted inserted replaced
-1:000000000000 0:74fcb3c95a53
1 <tool id="mass_spectrometry_imaging_preprocessing" name="MSI preprocessing" version="1.7.0">
2 <description>
3 mass spectrometry imaging preprocessing
4 </description>
5 <requirements>
6 <requirement type="package" version="1.7.0">bioconductor-cardinal</requirement>
7 </requirements>
8 <command detect_errors="exit_code">
9 <![CDATA[
10
11 #if $infile.ext == 'imzml'
12 cp '${infile.extra_files_path}/imzml' infile.imzML &&
13 cp '${infile.extra_files_path}/ibd' infile.ibd &&
14 #elif $infile.ext == 'analyze75'
15 cp '${infile.extra_files_path}/hdr' infile.hdr &&
16 cp '${infile.extra_files_path}/img' infile.img &&
17 cp '${infile.extra_files_path}/t2m' infile.t2m &&
18 #else
19 ln -s '$infile' infile.RData &&
20 #end if
21 cat '${cardinal_preprocessing}' &&
22 Rscript '${cardinal_preprocessing}'
23
24 ]]>
25 </command>
26 <configfiles>
27 <configfile name="cardinal_preprocessing"><![CDATA[
28 library(Cardinal)
29
30 #if $infile.ext == 'imzml'
31 msidata <- readMSIData('infile.imzML')
32 #elif $infile.ext == 'analyze75'
33 msidata <- readMSIData('infile.hdr')
34 #else
35 load('infile.RData')
36 #end if
37
38 maxpixel = length(pixels(msidata))
39 pixelnumber = c(1:maxpixel)
40
41 #for $method in $methods:
42 #if str( $method.methods_conditional.preprocessing_method ) == 'Normalization':
43 print('Normalization')
44 ##normalization
45 msidata <- normalize(msidata, pixel=pixelnumber, method="tic")
46
47 #elif str( $method.methods_conditional.preprocessing_method ) == 'Baseline_reduction':
48 print('Baseline_reduction')
49 ##baseline reduction
50 msidata = reduceBaseline(msidata, pixel=pixelnumber, method="median", blocks=$method.methods_conditional.blocks_baseline)
51
52 #elif str( $method.methods_conditional.preprocessing_method ) == 'Smoothing':
53 print('Smoothing')
54 ## Smoothing
55
56 #if str( $method.methods_conditional.methods_for_smoothing.smoothing_method) == 'gaussian':
57 print('gaussian smoothing')
58 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)
59 #elif str( $method.methods_conditional.methods_for_smoothing.smoothing_method) == 'sgolay':
60 print('sgolay smoothing')
61 msidata <- smoothSignal(msidata, method="$method.methods_conditional.methods_for_smoothing.smoothing_method", window=$method.methods_conditional.window_smoothing, order = $method.methods_conditional.methods_for_smoothing.order_of_filters)
62 #elif str($method.methods_conditional.methods_for_smoothing.smoothing_method) == 'ma':
63 print('sgolay smoothing')
64 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)
65 #end if
66
67 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_picking':
68 print('Peak_picking')
69 ## Peakpicking
70
71 #if str( $method.methods_conditional.methods_for_picking.picking_method) == 'adaptive':
72 print('adaptive peakpicking')
73 msidata = peakPick(msidata, pixel=pixelnumber, window = $method.methods_conditional.window_picking, blocks = $method.methods_conditional.blocks_picking, method='$method.methods_conditional.methods_for_picking.picking_method', SNR=$method.methods_conditional.SNR_picking_method, spar=$method.methods_conditional.methods_for_picking.spar_picking)
74
75 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'limpic':
76 print('limpic peakpicking')
77 msidata = peakPick(msidata, pixel=pixelnumber, window = $method.methods_conditional.window_picking, blocks = $method.methods_conditional.blocks_picking, method='$method.methods_conditional.methods_for_picking.picking_method', SNR=$method.methods_conditional.SNR_picking_method, thresh=$method.methods_conditional.methods_for_picking.tresh_picking)
78
79 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'simple':
80 print('simple peakpicking')
81 msidata = peakPick(msidata, pixel=pixelnumber, window = $method.methods_conditional.window_picking, blocks = $method.methods_conditional.blocks_picking, method='$method.methods_conditional.methods_for_picking.picking_method', SNR=$method.methods_conditional.SNR_picking_method)
82 #end if
83
84 #elif str( $method.methods_conditional.preprocessing_method ) == 'Peak_alignment':
85 print('Peak_alignment')
86 ## Peakalignment
87
88 #if str( $method.methods_conditional.methods_for_alignment.alignment_method) == 'diff':
89 print('diff peaklignment')
90 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")
91
92 #elif str( $method.methods_conditional.methods_for_alignment.alignment_method) == 'DP':
93 print('DPpeaklignment')
94 msidata = peakAlign(msidata, method='$method.methods_conditional.methods_for_alignment.alignment_method',gap = $method.methods_conditional.methods_for_alignment.gap_DPalignment )
95 #end if
96
97 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_filtering':
98 print('Peak_filtering')
99 msidata = peakFilter(msidata, method='freq', freq.min = $method.methods_conditional.frequ_filtering)
100 #end if
101 #end for
102
103 ## save as as (.RData)
104 save(msidata, file="$msidata_preprocessed")
105
106 ## save as intensity matrix (.csv)
107 csvmatrix = spectra(msidata)
108 rownames(csvmatrix) = mz(msidata)
109 newmatrix = rbind(pixels(msidata), csvmatrix)
110 write.csv(newmatrix[2:nrow(newmatrix),], file="$preprocessed_intensity_matrix")
111
112 ]]></configfile>
113 </configfiles>
114 <inputs>
115 <param name="infile" type="data" format="imzml,rdata,analyze75"
116 label="MSI rawdata as imzml or Cardinal MSImageSet saved as RData"
117 help="load imzml and ibd file by uploading composite datatype imzml"/>
118
119 <repeat name="methods" title="Preprocessing" min="1" max="50">
120 <conditional name="methods_conditional">
121 <param name="preprocessing_method" type="select" label="Select the preprocessing methods you want to apply">
122 <option value="Normalization" selected="True">Normalization to TIC</option>
123 <option value="Baseline_reduction">Baseline Reduction</option>
124 <option value="Smoothing">Peak smoothing</option>
125 <option value="Peak_picking">Peak picking</option>
126 <option value="Peak_alignment">Peak alignment</option>
127 <option value="Peak_filtering">Peak filtering</option>
128 </param>
129 <when value="Normalization"/>
130 <when value="Baseline_reduction">
131 <param name="blocks_baseline" type="integer" value="50"
132 label="blocks"/>
133 </when>
134 <when value="Smoothing">
135 <conditional name="methods_for_smoothing">
136 <param name="smoothing_method" type="select" label="Smoothing method">
137 <option value="gaussian" selected="True">gaussian</option>
138 <option value="sgolay">Savitsky-Golay</option>
139 <option value="ma">moving average</option>
140 </param>
141 <when value="gaussian">
142 <param name="sd_gaussian" type="float" value="4"
143 label="The standard deviation for the Gaussian kernel (window/sd)"/>
144 </when>
145 <when value="sgolay">
146 <param name="order_of_filters" type="integer" value="3"
147 label="The order of the smoothing filter"/>
148 </when>
149 <when value="ma">
150 <param name="coefficients_ma_filter" type="integer" value="1"
151 label="The coefficients for the moving average filter"/>
152 </when>
153 </conditional>
154 <param name="window_smoothing" type="integer" value="9"
155 label="Window size"/>
156 </when>
157 <when value="Peak_picking">
158 <param name="SNR_picking_method" type="integer" value="3"
159 label="Signal to noise ratio"
160 help="The minimal signal to noise ratio for peaks to be considered as a valid peak."/>
161 <param name="blocks_picking" type="integer" value="100" label = "number of blocks"
162 help="Number of blocks in which to divide mass spectrum to calculate noise"/>
163 <param name="window_picking" type="integer" value="5" label= "window size" help="Window width for seeking local maxima"/>
164 <conditional name="methods_for_picking">
165 <param name="picking_method" type="select" label="Peak picking method" help = "only simple works for processed imzML files">
166 <option value="adaptive" selected="True">adaptive</option>
167 <option value="limpic">limpic</option>
168 <option value="simple">simple</option>
169 </param>
170 <when value="adaptive">
171 <param name="spar_picking" type="float" value="1.0"
172 label="spar value"
173 help = "Smoothing parameter for the spline smoothing
174 applied to the spectrum in order to decide the cutoffs
175 for throwing away false noise spikes that might occur inside peaks"/>
176 </when>
177 <when value="limpic">
178 <param name="tresh_picking" type="float" value="0.75"
179 label="thresh value" help = "The thresholding quantile to use when comparing slopes in order to throw away peaks that are too flat"/>
180 </when>
181 <when value="simple"/>
182 </conditional>
183 </when>
184 <when value="Peak_alignment">
185 <conditional name="methods_for_alignment">
186 <param name="alignment_method" type="select" label="Alignment method">
187 <option value="diff" selected="True">diff</option>
188 <option value="DP">DP</option>
189 </param>
190 <when value="diff">
191 <param name="value_diffalignment" type="integer" value="200"
192 label="diff.max" help="Peaks that differ less than this value will be aligned together"/>
193 <param name="units_diffalignment" type="select" display = "radio" optional = "False"
194 label="units" help= "The coefficients for the moving average filter">
195 <option value="ppm" selected="True">ppm</option>
196 <option value="Da">Da</option>
197 </param>
198 </when>
199 <when value="DP">
200 <param name="gap_DPalignment" type="integer" value="0"
201 label="gap" help = "The gap penalty for the dynamic programming sequence alignment"/>
202 </when>
203 </conditional>
204 </when>
205 <when value="Peak_filtering">
206 <param name="frequ_filtering" type="float" value="1"
207 label="freq.min" help = "Peaks that occur in the dataset fewer times than this will be removed"/>
208 </when>
209 </conditional>
210 </repeat>
211 </inputs>
212 <outputs>
213 <data format="rdata" name="msidata_preprocessed" label="Preprocessed_output"/>
214 <data format="csv" name="preprocessed_intensity_matrix" label="preprocessed intensity matrix" />
215 </outputs>
216 <tests>
217 <test>
218 <param name="infile" value="" ftype="imzml">
219 <composite_data value="Example_Continuous.imzML" ftype="imzml"/>
220 <composite_data value="Example_Continuous.ibd" ftype="ibd"/>
221 </param>
222 <repeat name="methods">
223 <conditional name="methods_conditional">
224 <param name="preprocessing_method" value="Normalization" />
225 </conditional>
226 </repeat>
227 <repeat name="methods">
228 <conditional name="methods_conditional">
229 <param name="preprocessing_method" value="Smoothing" />
230 <conditional name="methods_for_smoothing">
231 <param name="smoothing_method" value="sgolay" />
232 </conditional>
233 </conditional>
234 </repeat>
235 <repeat name="methods">
236 <conditional name="methods_conditional">
237 <param name="preprocessing_method" value="Peak_picking" />
238 <conditional name="methods_for_picking">
239 <param name="picking_method" value="adaptive" />
240 </conditional>
241 <param name="blocks_picking" value="3" />
242 <param name="window_picking" value="3" />
243 </conditional>
244 </repeat>
245 <repeat name="methods">
246 <conditional name="methods_conditional">
247 <param name="preprocessing_method" value="Peak_alignment" />
248 <conditional name="methods_for_alignment">
249 <param name="alignment_method" value="DP" />
250 </conditional>
251 </conditional>
252 </repeat>
253 <repeat name="methods">
254 <conditional name="methods_conditional">
255 <param name="preprocessing_method" value="Peak_filtering" />
256 </conditional>
257 </repeat>
258 <output name="msidata_preprocessed" file="preprocessing_results1.RData" compare="sim_size" />
259 <output name="preprocessed_intensity_matrix" file="preprocessing_results1.csv" />
260 </test>
261 <test>
262 <param name="infile" value="LM5_first68pixel.RData" ftype="rdata"/>
263 <repeat name="methods">
264 <conditional name="methods_conditional">
265 <param name="preprocessing_method" value="Baseline_reduction" />
266 <param name="blocks_baseline" value="50" />
267 </conditional>
268 </repeat>
269 <repeat name="methods">
270 <conditional name="methods_conditional">
271 <param name="preprocessing_method" value="Peak_picking" />
272 <param name="blocks_picking" value="3" />
273 <param name="window_picking" value="5" />
274 <param name="methods_for_picking" value="simple" />
275 </conditional>
276 </repeat>
277 <repeat name="methods">
278 <conditional name="methods_conditional">
279 <param name="preprocessing_method" value="Peak_alignment" />
280 <param name="methods_for_alignment" value="DP" />
281 </conditional>
282 </repeat>
283 <output name="msidata_preprocessed" file="preprocessing_results2.RData" compare="sim_size" />
284 <output name="preprocessed_intensity_matrix" file="preprocessing_results2.csv" lines_diff="2"/>
285 </test>
286 <test>
287 <param name="infile" value="" ftype="analyze75">
288 <composite_data value="Analyze75.hdr" ftype="hdr"/>
289 <composite_data value="Analyze75.img" ftype="img"/>
290 <composite_data value="Analyze75.t2m" ftype="t2m"/>
291 </param>
292 <repeat name="methods">
293 <conditional name="methods_conditional">
294 <param name="preprocessing_method" value="Normalization" />
295 </conditional>
296 </repeat>
297 <repeat name="methods">
298 <conditional name="methods_conditional">
299 <param name="preprocessing_method" value="Smoothing" />
300 <conditional name="methods_for_smoothing">
301 <param name="smoothing_method" value="gaussian" />
302 </conditional>
303 </conditional>
304 </repeat>
305 <repeat name="methods">
306 <conditional name="methods_conditional">
307 <param name="preprocessing_method" value="Peak_picking" />
308 <param name="blocks_picking" value="3" />
309 <param name="window_picking" value="5" />
310 <param name="methods_for_picking" value="limpic" />
311 </conditional>
312 </repeat>
313 <repeat name="methods">
314 <conditional name="methods_conditional">
315 <param name="preprocessing_method" value="Peak_alignment" />
316 <param name="methods_for_alignment" value="diff" />
317 </conditional>
318 </repeat>
319 <output name="msidata_preprocessed" file="preprocessing_results3.RData" compare="sim_size" />
320 <output name="preprocessed_intensity_matrix" file="preprocessing_results3.csv" />
321 </test>
322 </tests>
323 <help>
324 <![CDATA[
325 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets.
326
327 **Preprocessing steps:**
328
329 - Smoothening: Smoothing of the mass peaks reduces noise and improves peak detection
330 - Normalization: Normalization of intensities to total ion current (TIC)
331 - Baseline reduction: Baseline reduction removes backgroundintensity generated by chemical noise (common in MALDI datasets)
332 - Peak picking: relevant peaks are picked while noise-peaks are removed
333 - Peak alignment: mz inaccuracies are removed by alignment of same peaks to a common mz value
334 - Peak filtering: removes peaks that occur infrequently, such as those which only occur in a small proportion of pixels
335 ]]>
336 </help>
337 <citations>
338 <citation type="doi">10.1093/bioinformatics/btv146</citation>
339 </citations>
340 </tool>