comparison nmr_preprocessing/NmrPreprocessing_xml.xml @ 2:7304ec2c9ab7 draft

Uploaded
author marie-tremblay-metatoul
date Mon, 30 Jul 2018 10:33:03 -0400
parents
children
comparison
equal deleted inserted replaced
1:b55559a2854f 2:7304ec2c9ab7
1 <tool id="NMR_Preprocessing" name="NMR_Preprocessing" version="1.2.0">
2 <description> Preprocessing of 1D NMR spectra </description>
3
4 <stdio>
5 <exit_code range="1:" level="fatal" />
6 </stdio>
7
8 <command>
9 ## Wrapper
10 Rscript $__tool_directory__/NmrPreprocessing_wrapper.R
11
12 ## Data matrix of FID spectra
13 dataMatrixFid $dataMatrixFid
14 ## Sample metadata matrix
15 sampleMetadataFid $sampleMetadataFid
16
17
18 ## First order phase correction
19 ## Graphical display
20 FirstOPCGraph $GDC.FirstOPCGraph
21
22 ## Water and / or solvents suppression
23 ## Smoothing parameter
24 lambda $SS.lambda
25
26 ## Graphical display
27 SSGraph $SS.SSGraph
28
29
30 ## Apodization
31 ## Graphical display
32 ApodGraph $Apod.ApodGraph
33
34 apodizationMethod $Apod.apodizationMethod.method
35 #if $Apod.apodizationMethod.method == "exp":
36 ## Line broadening for the exponential window
37 expLB $Apod.apodizationMethod.expLB
38 #end if
39 #if $Apod.apodizationMethod.method == "cos2":
40 ## Phase
41 phase $Apod.apodizationMethod.phase
42 #end if
43 #if $Apod.apodizationMethod.method == "hanning":
44 ## Phase
45 phase $Apod.apodizationMethod.phase
46 #end if
47 #if $Apod.apodizationMethod.method == "hamming":
48 ## Phase
49 phase $Apod.apodizationMethod.phase
50 #end if
51 #if $Apod.apodizationMethod.method == "blockexp":
52 ## Proportion of signal in the window
53 rectRatio $Apod.apodizationMethod.rectRatio
54 expLB $Apod.apodizationMethod.expLB
55 #end if
56 #if $Apod.apodizationMethod.method == "blockcos2":
57 ## Proportion of signal in the window
58 rectRatio $Apod.apodizationMethod.rectRatio
59 #end if
60 #if $Apod.apodizationMethod.method == "gauss":
61 ## Line broadening for the gaussian window
62 gaussLB $Apod.apodizationMethod.gaussLB
63 #end if
64
65 ## Fourier transform
66 ## Graphical display
67 FTGraph $FT.FTGraph
68
69
70
71
72 ## Zero order phase correction
73 ## Graphical display
74 ZeroOPCGraph $ZOPC.ZeroOPCGraph
75
76 zeroOrderPhaseMethod $ZOPC.zeroOrderPhaseMethod
77
78 excludeZoneZeroPhase.choice ${ZOPC.excludeZoneZeroPhase.choice}
79 #if str($ZOPC.excludeZoneZeroPhase.choice) == "YES":
80 #for $i in $ZOPC.excludeZoneZeroPhase.conditions:
81 excludeZoneZeroPhase_left ${i.excludeZoneZeroPhase_left}
82 excludeZoneZeroPhase_right ${i.excludeZoneZeroPhase_right}
83 #end for
84 #end if
85
86 ## Shift referencing
87 ## Graphical display
88 SRGraph $SR.SRGraph
89
90 ## Definition of the search zone
91 shiftReferencingRange $SR.shiftReferencingRange.method
92 #if $SR.shiftReferencingRange.method == "nearvalue":
93 pctNearValue $SR.shiftReferencingRange.pctNearValue
94 #end if
95 #if $SR.shiftReferencingRange.method == "window":
96 #for $i in $SR.shiftReferencingRange.conditions:
97 shiftReferencingRangeLeft ${i.shiftReferencingRangeLeft}
98 shiftReferencingRangeRight ${i.shiftReferencingRangeRight}
99 #end for
100 #end if
101 shiftHandling $SR.shiftHandling
102 ppmvalue $SR.ppmvalue
103
104 ## Baseline correction
105 ## Graphical display
106 BCGraph $BC.BCGraph
107
108 lambdaBc $BC.lambdaBc
109 pBc $BC.pBc
110 epsilon $BC.epsilon
111
112 excludeZoneBC.choice ${BC.excludeZoneBC.choice}
113 #if str($BC.excludeZoneBC.choice) == "YES":
114 #for $i in $BC.excludeZoneBC.conditions:
115 excludeZoneBC_left ${i.excludeZoneBC_left}
116 excludeZoneBC_right ${i.excludeZoneBC_right}
117 #end for
118 #end if
119
120
121 ## sets negative intensities to zero
122 NegativetoZero $NZ.NegativetoZero
123
124 ## final spectra
125 ## Graphical display
126 FinalGraph $FinalGraph
127
128
129 ## Outputs
130 dataMatrix $dataMatrix
131 variableMetadata $variableMetadata
132 graphOut $graphOut
133 logOut $logOut
134
135 </command>
136
137 <inputs>
138 <param name="dataMatrixFid" type="data" label="Data matrix of FIDs" help="" format="tabular" />
139 <param name="sampleMetadataFid" type="data" label="Sample metadata matrix" help="" format="tabular" />
140
141
142 <section name="GDC" title="Group Delay Correction" expanded="true">
143 <param name="FirstOPCGraph" label="Display the FIDs after 1st order phase correction?" type="select" help="Select 'YES' to display the spectra or 'NO' to not display them ">
144 <option value="NO"> NO </option>
145 <option value="YES"> YES </option>
146 </param>
147 </section>
148
149
150 <section name="SS" title="Solvent Suppression" expanded="true">
151 <param name="lambda" label="Solvent Suppression: Smoothing parameter" type="float" value="1000000" help="Default value is 1e6"/>
152
153 <param name="SSGraph" label="Display the FIDs after solvent suppression?" type="select" help="Select 'YES' to display the spectra or 'NO' to not display them ">
154 <option value="NO"> NO </option>
155 <option value="YES"> YES </option>
156 </param>
157 </section>
158
159
160 <section name="Apod" title="Apodization" expanded="true">
161 <conditional name="apodizationMethod" >
162 <param name="method" label="Apodization: method" type="select" help="Default method is Decreasing Exponential signal. See details below" >
163 <option value="exp" />
164 <option value="cos2" />
165 <option value="hanning" />
166 <option value="hamming" />
167 <option value="blockexp" />
168 <option value="blockcos2" />
169 <option value="gauss" />
170 </param>
171 <when value="exp">
172 <param name="expLB" type="float" label="Line broadening" value="1" help="Default value is 1" />
173 </when>
174 <when value="cos2">
175 <param name="phase" type="float" label="Phase" value="0" help="Default value is 0" />
176 </when>
177 <when value="hanning">
178 <param name="phase" type="float" label="Phase" value="0" help="Default value is 0" />
179 </when>
180 <when value="hamming">
181 <param name="phase" type="float" label="Phase" value="0" help="Default value is 0" />
182 </when>
183 <when value="blockexp">
184 <param name="rectRatio" type="float" label="Proportion of signal in the window" value="0.5" help="Default value is 0.5" />
185 <param name="expLB" type="float" label="Line broadening" value="1" help="Default value is 1" />
186 </when>
187 <when value="blockcos2">
188 <param name="rectRatio" type="float" label="Proportion of signal in the window" value="0.5" help="Default value is 0.5" />
189 </when>
190 <when value="gauss">
191 <param name="gaussLB" type="float" label="Line broadening" value="0.3" help="Default value is 0.3" />
192 </when>
193 </conditional>
194
195 <param name="ApodGraph" label="Display the FIDs after Apodization?" type="select" help="Select 'YES' to display the spectra or 'NO' to not display them ">
196 <option value="NO"> NO </option>
197 <option value="YES"> YES </option>
198 </param>
199 </section>
200
201 <section name="FT" title="Fourier Transform" expanded="true">
202 <param name="FTGraph" label="Display the Fourier transformed spectra?" type="select" help="Select 'YES' to display the spectra or 'NO' to not display them ">
203 <option value="NO"> NO </option>
204 <option value="YES"> YES </option>
205 </param>
206 </section>
207
208 <section name="ZOPC" title="Zero Order Phase Correction" expanded="true">
209 <param name="zeroOrderPhaseMethod" type="select" label="Zero Order Phase Correction: method" help="Method used to select the angles to rotate the spectra" >
210 <option value="rms" selected="yes"> rms </option>
211 <option value="max" > max </option>
212 </param>
213
214 <conditional name="excludeZoneZeroPhase">
215 <param name="choice" type="select" label="Zero Order Phase Correction: exclusion area(s)" help="Choose if you want to exclude particular zone(s)" >
216 <option value="YES" selected="true" > YES </option>
217 <option value="NO" > NO </option>
218 </param>
219 <when value="YES">
220 <repeat name="conditions" title="Exclusion_zone" min="1">
221 <param name="excludeZoneZeroPhase_left" label="Excusion zone: left border" type="float" value="5.1" />
222 <param name="excludeZoneZeroPhase_right" label="Excusion zone: right border" type="float" value="4.5" />
223 </repeat>
224 </when>
225 <when value="NO">
226 </when>
227 </conditional>
228
229 <param name="ZeroOPCGraph" label="Display the spectra after the Zero Order Phase Correction?" type="select" help="Select 'YES' to display the spectra or 'NO' to not display them ">
230 <option value="NO"> NO </option>
231 <option value="YES"> YES </option>
232 </param>
233 </section>
234
235 <section name="SR" title="Shift Referencing" expanded="true">
236 <conditional name="shiftReferencingRange" >
237 <param name="method" label="Shift Referencing: definition of the search zone" type="select" help="Definition of the search zone" >
238 <option value="nearvalue" />
239 <option value="all" />
240 <option value="window" />
241 </param>
242
243 <when value="all" />
244 <when value="nearvalue">
245 <param name="pctNearValue" type="float" label="percentage of the ppm axis around the ppm value to look for the reference compound peak" value="0.02" help="Default value is 0.02" />
246 </when>
247 <when value="window">
248 <repeat name="conditions" title="Search_zone">
249 <param name="shiftReferencingRangeLeft" label="Search zone: left border" type="float" value="1" />
250 <param name="shiftReferencingRangeRight" label="Search zone: right border" type="float" value="-1" />
251 </repeat>
252 </when>
253 </conditional>
254
255 <param name="shiftHandling" type="select" label="Shift Referencing: shiftHandling" help="How to deal with shifts between spectra on their left and right sides" >
256 <option value="zerofilling" selected="yes"> zerofilling </option>
257 <option value="cut" > cut </option>
258 <option value="circular" > circular </option>
259 </param>
260
261 <param name="ppmvalue" type="float" label="Shift Referencing: the value of the reference peak in ppm" value="0" help="Default value is 0" />
262
263
264 <param name="SRGraph" label="Display the spectra after Shift Referencing?" type="select" help="Select 'YES' to display the spectra or 'NO' to not display them ">
265 <option value="NO"> NO </option>
266 <option value="YES"> YES </option>
267 </param>
268 </section>
269
270
271 <section name="BC" title="Baseline Correction" expanded="true">
272 <param name="lambdaBc" type="float" label="Baseline Correction: smoothing parameter" value="100000.0" help="Smoothing parameter, generally 1e5 – 1e8. Default value is 100000" />
273 <param name="pBc" type="float" label="Baseline Correction: asymmetry parameter" value="0.05" help="Asymmetry parameter. Default value is 0.05" />
274 <param name="epsilon" type="float" label="Baseline Correction: numerical precision for convergence when estimating the baseline" value="0.00000001" help="Numerical precision for convergence when estimating the baseline. Default value is 1e-8" />
275
276 <conditional name="excludeZoneBC">
277 <param name="choice" type="select" label="Baseline Correction: exclusion area(s)" help="Choose if you want to exclude particular zone(s)" >
278 <option value="YES" > YES </option>
279 <option value="NO" selected="true" > NO </option>
280 </param>
281 <when value="YES">
282 <repeat name="conditions" title="Exclusion_zone" min="1">
283 <param name="excludeZoneBC_left" label="Excusion zone: left border" type="float" value="5.1" />
284 <param name="excludeZoneBC_right" label="Excusion zone: right border" type="float" value="4.5" />
285 </repeat>
286 </when>
287 <when value="NO">
288 </when>
289 </conditional>
290
291 <param name="BCGraph" label="Display the spectra after Baseline Correction?" type="select" help="Select 'YES' to display the spectra or 'NO' to not display them ">
292 <option value="NO"> NO </option>
293 <option value="YES"> YES </option>
294 </param>
295 </section>
296
297 <section name="NZ" title="Negative intensities to Zero" expanded="true">
298 <param name="NegativetoZero" label="Set negative intensities to zero?" type="select" help="If YES, sets negative intensities to zero">
299 <option value="NO"> NO </option>
300 <option value="YES" selected="yes"> YES </option>
301 </param>
302 </section>
303
304 <param name="FinalGraph" label="Display the final spectra?" type="select" help="Select 'YES' to display the spectra or 'NO' to not display them ">
305 <option value="YES"> YES </option>
306 <option value="NO"> NO </option>
307 </param>
308
309 </inputs>
310
311 <outputs>
312 <data format="tabular" name="dataMatrix" label="${tool.name}_dataMatrix" />
313 <data format="tabular" name="variableMetadata" label="${tool.name}_variableMetadata" />
314 <data format="txt" name="logOut" label="${tool.name}_log" />
315 <data format="pdf" name="graphOut" label="${tool.name}_graph" />
316 </outputs>
317
318
319 <tests>
320 <test>
321 <param name="dataMatrixFid" value="NMR_ReadFids_dataMatrix.tabular"/>
322 <param name="sampleMetadataFid" value="sampleMetadata.tabular"/>
323
324 <param name="FirstOPCGraph" value="NO"/>
325
326 <param name="lambda" value="1000000" />
327 <param name="SSGraph" value="NO"/>
328
329 <conditional name="apodizationMethod">
330 <param name="method" value="exp" />
331 <param name="expLB" value="1" />
332 </conditional>
333 <param name="ApodGraph" value="NO"/>
334
335 <param name="FTGraph" value="NO"/>
336
337 <param name="zeroOrderPhaseMethod" value="rms" />
338
339 <conditional name="excludeZoneZeroPhase" >
340 <param name="choice" value="YES" />
341 <param name="conditions_0|excludeZoneZeroPhase_left" value="5.1" />
342 <param name="conditions_0|excludeZoneZeroPhase_right" value="4.5" />
343 </conditional>
344 <param name="ZeroOPCGraph" value="NO"/>
345
346 <conditional name="shiftReferencingRange">
347 <param name="method" value="nearvalue"/>
348 <param name="pctNearValue" value="0.02"/>
349 </conditional>
350 <param name="shiftHandling" value= "zerofilling"/>
351 <param name="ppmvalue" value="0" />
352 <param name="SRGraph" value="NO"/>
353
354 <param name="lambdaBc" value="100000.0" />
355 <param name="pBc" value="0.05" />
356 <param name="epsilon" value="0.00000001"/>
357 <param name="BCGraph" value="NO"/>
358
359 <param name="NegativetoZero" value="YES" />
360
361 <param name="FinalGraph" value="YES" />
362
363 <output name="dataMatrix" value="NMR_Preprocessing_dataMatrix.tabular" />
364
365 </test>
366 </tests>
367
368
369
370
371
372 <help>
373
374 .. class:: infomark
375
376 **Authors**
377
378 Manon Martin (manon.martin@uclouvain.be) and Marie Tremblay-Franco (marie.tremblay-franco@inra.fr; Galaxy integration)
379
380
381 .. class:: infomark
382
383
384
385
386 =====================
387 Spectra preprocessing
388 =====================
389
390 -----------
391 Description
392 -----------
393
394 These steps correspond to the following steps in the PEPS-NMR R library (https://github.com/ManonMartin/PEPSNMR):
395
396 * Group Delay suppression (First order phase correction)
397 * Removal of solvent residuals signal from the FID
398 * Apodization to increase the Signal-to-Noise ratio of the FID
399 * Fourier transformation
400 * Zero order phase correction
401 * Shift referencing to calibrate the spectra with internal compound referencing
402 * Baseline correction
403 * Setting of negatives values to 0
404
405
406 -----------------
407 Workflow position
408 -----------------
409
410 **Upstream tools**
411
412 +---------------------------+-------------------------+--------+
413 | Name | Output file | Format |
414 +===========================+=========================+========+
415 |NMR_Read | NMR_Read_dataMatrix | Tabular|
416 +---------------------------+-------------------------+--------+
417 |NMR_Read | NMR_Read_sampleMetadata | Tabular|
418 +---------------------------+-------------------------+--------+
419
420
421
422 **Downstream tools**
423
424 +---------------------------+----------------------+--------+
425 | Name | Output file | Format |
426 +===========================+======================+========+
427 |NMR_Alignement | dataMatrix | Tabular|
428 +---------------------------+----------------------+--------+
429 |NMR_Bucketing | dataMatrix | Tabular|
430 +---------------------------+----------------------+--------+
431 |Normalization | dataMatrix | Tabular|
432 +---------------------------+----------------------+--------+
433 |Univariate | variableMetadata | Tabular|
434 +---------------------------+----------------------+--------+
435 |Multivariate | sampleMetadata | Tabular|
436 +---------------------------+----------------------+--------+
437 | | variableMetadata | Tabular|
438 +---------------------------+----------------------+--------+
439
440
441 -----------
442 Input files
443 -----------
444
445
446 +--------------------------------+-----------------+
447 | File | Format |
448 +================================+=================+
449 |1 : dataMatrix | tabular |
450 +--------------------------------+-----------------+
451 |2 : sampleMetadata | tabular |
452 +--------------------------------+-----------------+
453
454 |
455
456 **dataMatrix file**
457 sample x variable matrix with tabular separations and "." as decimal; the table must not contain metadata apart from row and column names; the row names must be identical to the rownames of the sample metadata.
458
459
460 **sampleMetadata file**
461 sample x metadata matrix with tabular separations and "." as decimal for numeric metadata and NA for missing values.
462
463
464 ----------------------
465 Steps parameters
466 ----------------------
467
468 **Solvent Suppression**
469 -----------------------------------
470
471 **Smoothing parameter** lambda: The higher lambda is, the smoother the estimated solvent signal will be
472
473
474 **Apodization**
475 ----------------------
476
477 The **types of apodization** are:
478
479 * exp: The signal is multiplied by a decreasing exponential exp(-t/LineBroadening).
480
481 * cos2: The signal is multiplied by the value of a cosinus squared from 0 (where its value is 1) until pi/2 (where its value is 0).
482
483 * blockexp: The first part of the signal (described by the proportion of signal in the window) is left unchanged and the second is multiplied by exp(-t/LineBroadening) starting at value 1.
484
485 * blockcos2: The first part is left unchanged as with blockexp and the second part is multiplied by a cosinus squared where its value starts at 1 at the end of the block and ends at 0 at the end of the signal.
486
487 * gauss: The signal is multiplied by a gaussian window centered at the beginning of the FID and with sigma=1/LineBroadening.
488
489 * hanning: The signal is multiplied by a hanning window : 0.5 + 0.5 cos.
490
491 * hamming: The signal is multiplied by a hamming window : 0.54 + 0.46 cos.
492
493
494
495
496 **Zero Order Phase Correction**
497 -----------------------------------
498
499 **Zero Order Phase correction method**:
500
501 * rms: A positiveness criterion is applied on the spectrum with a quantile probability parameter to trim the values.
502
503 * max: Optimization of the maximal spectral intensity.
504
505
506 **Exclusion area(s) for the Zero Order Phase Correction**: enables to optimize the criterion with excluded spectral window(s), by default the water region is excluded.
507
508
509 **Shift Referencing**
510 ----------------------
511
512 The **searching window** can be adapted:
513
514 * nearvalue: the search concentrates around the value of the reference peak in ppm.
515
516 * all: search accross the whole ppm axis.
517
518 * window: the search is operated in the windows defined by the Search_zone bounds.
519
520
521 **shiftHandling**: spectra can be shifted differently, we can handle misalignment of the left and right of the spectrum by different ways:
522
523 * zerofilling: The extremities at which a spectrum is not defined are replaced by 0. It makes sense since in practice the spectrum is close to zero at the extremities.
524
525 * NAfilling: The extremities at which a spectrum is not defined are replaced by NA.
526
527 * circular: The spectra are shifted circularly which means that the end of a spectrum is reproduced at the beginning.
528
529 * cut: The ppm values for which some spectra are not defined are removed.
530
531
532 **value of the reference peak**: the value in ppm of the reference peak. By default the value is 0 ppm.
533
534
535
536 **Baseline Correction**
537 ----------------------------
538
539 **Smoothing parameter**: the larger it is, the smoother the estimated baseline will be.
540
541 **Asymmetry parameter**: the smaller it is, the less the estimated baseline will try to follow peaks when it is under the spectrum and the more it will try to be under the spectrum.
542
543 **numerical precision**: numerical precision for convergence when estimating the baseline.
544
545 **Exclusion area(s) for the Baseline Correction**: enables to optimize the criterion with excluded spectral window(s), by default the water region is excluded.
546
547
548
549 **Negative intensities to Zero**
550 ------------------------------------
551 **Set negative intensities to zero**: the set of negative intensities to zero is optional.
552
553
554 ------------
555 Output files
556 ------------
557
558 NMR_Preprocessing_dataMatrix
559 | tabular output
560 | Data matrix with n rows (descriptors) and p columns (samples) containing the preprocessed spectra.
561 |
562
563 NMR_Preprocessing_variableMetadata
564 | tabular output
565 | Data matrix with 1 row (ppm value) and p columns (descriptors).
566 |
567
568 NMR_Preprocessing_log
569 | text output
570 | Contains warnings and the input parameters
571 |
572
573 NMR_Preprocessing_graph.pdf
574 | pdf output
575 | line plots of preprocessed spectra
576 |
577
578 </help>
579
580 <citations>
581
582 <citation type="bibtex">@PhDThesis{Rousseau2011,
583 title = {Statistical contribution to the analysis of metabonomics data in $^1$H NMR spectroscopy},
584 author = {Rousseau, R.},
585 school = {Institut de Statistique, Biostatistique et Sciences Actuarielles, Universit{\'e} catholique de Louvain},
586 year = {2011}}
587 </citation>
588
589 </citations>
590
591 </tool>