comparison NmrPreprocessing_xml.xml @ 2:5e64657b4fe5 draft

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