comparison msi_preprocessing.xml @ 1:c4abf42419c2 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_preprocessing commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
author galaxyp
date Fri, 24 Nov 2017 18:08:19 -0500
parents 74fcb3c95a53
children 50ba097d03e0
comparison
equal deleted inserted replaced
0:74fcb3c95a53 1:c4abf42419c2
1 <tool id="mass_spectrometry_imaging_preprocessing" name="MSI preprocessing" version="1.7.0"> 1 <tool id="mass_spectrometry_imaging_preprocessing" name="MSI preprocessing" version="1.7.0.1">
2 <description> 2 <description>
3 mass spectrometry imaging preprocessing 3 mass spectrometry imaging preprocessing
4 </description> 4 </description>
5 <requirements> 5 <requirements>
6 <requirement type="package" version="1.7.0">bioconductor-cardinal</requirement> 6 <requirement type="package" version="1.7.0">bioconductor-cardinal</requirement>
33 msidata <- readMSIData('infile.hdr') 33 msidata <- readMSIData('infile.hdr')
34 #else 34 #else
35 load('infile.RData') 35 load('infile.RData')
36 #end if 36 #end if
37 37
38
38 maxpixel = length(pixels(msidata)) 39 maxpixel = length(pixels(msidata))
39 pixelnumber = c(1:maxpixel) 40 pixelnumber = c(1:maxpixel)
40 41
41 #for $method in $methods: 42 #for $method in $methods:
42 #if str( $method.methods_conditional.preprocessing_method ) == 'Normalization': 43 #if str( $method.methods_conditional.preprocessing_method ) == 'Normalization':
62 #elif str($method.methods_conditional.methods_for_smoothing.smoothing_method) == 'ma': 63 #elif str($method.methods_conditional.methods_for_smoothing.smoothing_method) == 'ma':
63 print('sgolay smoothing') 64 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 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 #end if
66 67
68
67 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_picking': 69 #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_picking':
68 print('Peak_picking') 70 print('Peak_picking')
69 ## Peakpicking 71 ## Peakpicking
70 72
71 #if str( $method.methods_conditional.methods_for_picking.picking_method) == 'adaptive': 73 #if str( $method.methods_conditional.methods_for_picking.picking_method) == 'adaptive':
78 80
79 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'simple': 81 #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'simple':
80 print('simple peakpicking') 82 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) 83 msidata = peakPick(msidata, pixel=pixelnumber, window = $method.methods_conditional.window_picking, blocks = $method.methods_conditional.blocks_picking, method='$method.methods_conditional.methods_for_picking.picking_method', SNR=$method.methods_conditional.SNR_picking_method)
82 #end if 84 #end if
85
86
83 87
84 #elif str( $method.methods_conditional.preprocessing_method ) == 'Peak_alignment': 88 #elif str( $method.methods_conditional.preprocessing_method ) == 'Peak_alignment':
85 print('Peak_alignment') 89 print('Peak_alignment')
86 ## Peakalignment 90 ## Peakalignment
87 91
98 print('Peak_filtering') 102 print('Peak_filtering')
99 msidata = peakFilter(msidata, method='freq', freq.min = $method.methods_conditional.frequ_filtering) 103 msidata = peakFilter(msidata, method='freq', freq.min = $method.methods_conditional.frequ_filtering)
100 #end if 104 #end if
101 #end for 105 #end for
102 106
107
103 ## save as as (.RData) 108 ## save as as (.RData)
104 save(msidata, file="$msidata_preprocessed") 109 save(msidata, file="$msidata_preprocessed")
105 110
106 ## save as intensity matrix (.csv) 111 if (length(features(msidata))> 0)
107 csvmatrix = spectra(msidata) 112 {
108 rownames(csvmatrix) = mz(msidata) 113
109 newmatrix = rbind(pixels(msidata), csvmatrix) 114 ## save as intensity matrix
110 write.csv(newmatrix[2:nrow(newmatrix),], file="$preprocessed_intensity_matrix") 115 spectramatrix = spectra(msidata)
116 rownames(spectramatrix) = mz(msidata)
117 newmatrix = rbind(pixels(msidata), spectramatrix)
118 write.table(newmatrix[2:nrow(newmatrix),], file="$matrixasoutput", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t")
119
120 }else{
121 print("file has no features left")
122 write.table(matrix(rownames(coord(msidata)), ncol=ncol(msidata), nrow=1), file="$matrixasoutput", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t")
123 }
124
111 125
112 ]]></configfile> 126 ]]></configfile>
113 </configfiles> 127 </configfiles>
114 <inputs> 128 <inputs>
115 <param name="infile" type="data" format="imzml,rdata,analyze75" 129 <param name="infile" type="data" format="imzml,rdata,analyze75"
116 label="MSI rawdata as imzml or Cardinal MSImageSet saved as RData" 130 label="MSI rawdata as imzml or Cardinal MSImageSet saved as RData"
117 help="load imzml and ibd file by uploading composite datatype imzml"/> 131 help="load imzml and ibd file by uploading composite datatype imzml"/>
118
119 <repeat name="methods" title="Preprocessing" min="1" max="50"> 132 <repeat name="methods" title="Preprocessing" min="1" max="50">
120 <conditional name="methods_conditional"> 133 <conditional name="methods_conditional">
121 <param name="preprocessing_method" type="select" label="Select the preprocessing methods you want to apply"> 134 <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> 135 <option value="Normalization" selected="True">Normalization to TIC</option>
123 <option value="Baseline_reduction">Baseline Reduction</option> 136 <option value="Baseline_reduction">Baseline Reduction</option>
208 </when> 221 </when>
209 </conditional> 222 </conditional>
210 </repeat> 223 </repeat>
211 </inputs> 224 </inputs>
212 <outputs> 225 <outputs>
213 <data format="rdata" name="msidata_preprocessed" label="Preprocessed_output"/> 226 <data format="rdata" name="msidata_preprocessed" label="${tool.name} on $infile.display_name"/>
214 <data format="csv" name="preprocessed_intensity_matrix" label="preprocessed intensity matrix" /> 227 <data format="tabular" name="matrixasoutput" label="${tool.name} on $infile.display_name" />
215 </outputs> 228 </outputs>
216 <tests> 229 <tests>
217 <test> 230 <test>
218 <param name="infile" value="" ftype="imzml"> 231 <param name="infile" value="" ftype="imzml">
219 <composite_data value="Example_Continuous.imzML" ftype="imzml"/> 232 <composite_data value="Example_Continuous.imzML"/>
220 <composite_data value="Example_Continuous.ibd" ftype="ibd"/> 233 <composite_data value="Example_Continuous.ibd"/>
221 </param> 234 </param>
222 <repeat name="methods"> 235 <repeat name="methods">
223 <conditional name="methods_conditional"> 236 <conditional name="methods_conditional">
224 <param name="preprocessing_method" value="Normalization" /> 237 <param name="preprocessing_method" value="Normalization" />
238 </conditional>
239 </repeat>
240 <repeat name="methods">
241 <conditional name="methods_conditional">
242 <param name="preprocessing_method" value="Baseline_reduction" />
243 <param name="blocks_baseline" value="100" />
225 </conditional> 244 </conditional>
226 </repeat> 245 </repeat>
227 <repeat name="methods"> 246 <repeat name="methods">
228 <conditional name="methods_conditional"> 247 <conditional name="methods_conditional">
229 <param name="preprocessing_method" value="Smoothing" /> 248 <param name="preprocessing_method" value="Smoothing" />
230 <conditional name="methods_for_smoothing"> 249 <conditional name="methods_for_smoothing">
231 <param name="smoothing_method" value="sgolay" /> 250 <param name="smoothing_method" value="gaussian" />
232 </conditional> 251 </conditional>
233 </conditional> 252 </conditional>
234 </repeat> 253 </repeat>
235 <repeat name="methods"> 254 <repeat name="methods">
236 <conditional name="methods_conditional"> 255 <conditional name="methods_conditional">
244 </repeat> 263 </repeat>
245 <repeat name="methods"> 264 <repeat name="methods">
246 <conditional name="methods_conditional"> 265 <conditional name="methods_conditional">
247 <param name="preprocessing_method" value="Peak_alignment" /> 266 <param name="preprocessing_method" value="Peak_alignment" />
248 <conditional name="methods_for_alignment"> 267 <conditional name="methods_for_alignment">
249 <param name="alignment_method" value="DP" /> 268 <param name="alignment_method" value="diff" />
250 </conditional> 269 </conditional>
251 </conditional> 270 </conditional>
252 </repeat> 271 </repeat>
253 <repeat name="methods"> 272 <!--repeat name="methods">
254 <conditional name="methods_conditional"> 273 <conditional name="methods_conditional">
255 <param name="preprocessing_method" value="Peak_filtering" /> 274 <param name="preprocessing_method" value="Peak_filtering" />
256 </conditional> 275 </conditional>
257 </repeat> 276 </repeat-->
258 <output name="msidata_preprocessed" file="preprocessing_results1.RData" compare="sim_size" /> 277 <output name="msidata_preprocessed" file="preprocessing_results1.RData" compare="sim_size" />
259 <output name="preprocessed_intensity_matrix" file="preprocessing_results1.csv" /> 278 <output name="matrixasoutput" file="preprocessing_results1.txt" />
260 </test> 279 </test>
261 <test> 280 <test>
262 <param name="infile" value="LM5_first68pixel.RData" ftype="rdata"/> 281 <param name="infile" value="example_continous.RData" ftype="rdata"/>
263 <repeat name="methods"> 282 <!--repeat name="methods">
264 <conditional name="methods_conditional"> 283 <conditional name="methods_conditional">
265 <param name="preprocessing_method" value="Baseline_reduction" /> 284 <param name="preprocessing_method" value="Baseline_reduction" />
266 <param name="blocks_baseline" value="50" /> 285 <param name="blocks_baseline" value="3" />
267 </conditional> 286 </conditional>
268 </repeat> 287 </repeat-->
269 <repeat name="methods"> 288 <repeat name="methods">
270 <conditional name="methods_conditional"> 289 <conditional name="methods_conditional">
271 <param name="preprocessing_method" value="Peak_picking" /> 290 <param name="preprocessing_method" value="Peak_picking" />
272 <param name="blocks_picking" value="3" /> 291 <param name="blocks_picking" value="3" />
273 <param name="window_picking" value="5" /> 292 <param name="window_picking" value="5" />
279 <param name="preprocessing_method" value="Peak_alignment" /> 298 <param name="preprocessing_method" value="Peak_alignment" />
280 <param name="methods_for_alignment" value="DP" /> 299 <param name="methods_for_alignment" value="DP" />
281 </conditional> 300 </conditional>
282 </repeat> 301 </repeat>
283 <output name="msidata_preprocessed" file="preprocessing_results2.RData" compare="sim_size" /> 302 <output name="msidata_preprocessed" file="preprocessing_results2.RData" compare="sim_size" />
284 <output name="preprocessed_intensity_matrix" file="preprocessing_results2.csv" lines_diff="2"/> 303 <output name="matrixasoutput" file="preprocessing_results2.txt" lines_diff="2" />
285 </test> 304 </test>
286 <test> 305 <test>
287 <param name="infile" value="" ftype="analyze75"> 306 <param name="infile" value="" ftype="analyze75">
288 <composite_data value="Analyze75.hdr" ftype="hdr"/> 307 <composite_data value="Analyze75.hdr"/>
289 <composite_data value="Analyze75.img" ftype="img"/> 308 <composite_data value="Analyze75.img"/>
290 <composite_data value="Analyze75.t2m" ftype="t2m"/> 309 <composite_data value="Analyze75.t2m"/>
291 </param> 310 </param>
292 <repeat name="methods"> 311 <repeat name="methods">
293 <conditional name="methods_conditional"> 312 <conditional name="methods_conditional">
294 <param name="preprocessing_method" value="Normalization" /> 313 <param name="preprocessing_method" value="Normalization" />
295 </conditional> 314 </conditional>
296 </repeat> 315 </repeat>
297 <repeat name="methods"> 316 <!--repeat name="methods">
298 <conditional name="methods_conditional"> 317 <conditional name="methods_conditional">
299 <param name="preprocessing_method" value="Smoothing" /> 318 <param name="preprocessing_method" value="Baseline_reduction" />
300 <conditional name="methods_for_smoothing"> 319 <param name="blocks_baseline" value="50" />
301 <param name="smoothing_method" value="gaussian" /> 320 </conditional>
302 </conditional> 321 </repeat-->
303 </conditional>
304 </repeat>
305 <repeat name="methods"> 322 <repeat name="methods">
306 <conditional name="methods_conditional"> 323 <conditional name="methods_conditional">
307 <param name="preprocessing_method" value="Peak_picking" /> 324 <param name="preprocessing_method" value="Peak_picking" />
308 <param name="blocks_picking" value="3" /> 325 <param name="blocks_picking" value="3" />
309 <param name="window_picking" value="5" /> 326 <param name="window_picking" value="5" />
315 <param name="preprocessing_method" value="Peak_alignment" /> 332 <param name="preprocessing_method" value="Peak_alignment" />
316 <param name="methods_for_alignment" value="diff" /> 333 <param name="methods_for_alignment" value="diff" />
317 </conditional> 334 </conditional>
318 </repeat> 335 </repeat>
319 <output name="msidata_preprocessed" file="preprocessing_results3.RData" compare="sim_size" /> 336 <output name="msidata_preprocessed" file="preprocessing_results3.RData" compare="sim_size" />
320 <output name="preprocessed_intensity_matrix" file="preprocessing_results3.csv" /> 337 <output name="matrixasoutput" file="preprocessing_results3.txt" />
321 </test> 338 </test>
339
322 </tests> 340 </tests>
323 <help> 341 <help>
324 <![CDATA[ 342 <![CDATA[
325 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. 343 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets.
326 344
327 **Preprocessing steps:** 345 **Preprocessing steps:**
328 346
329 - Smoothening: Smoothing of the mass peaks reduces noise and improves peak detection 347 - Smoothening: Smoothing of the mass peaks reduces noise and improves peak detection