Mercurial > repos > lecorguille > xcms_retcor
changeset 27:8242376d9f35 draft
planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics/ commit cc13a2654ccf6f9e55bc0120ea5518df3b045712
author | workflow4metabolomics |
---|---|
date | Thu, 14 Mar 2024 15:35:44 +0000 |
parents | 36480435e92b |
children | d2b82d89f848 |
files | abims_xcms_refine.xml abims_xcms_retcor.xml xcms_refine.r xcms_retcor.r |
diffstat | 4 files changed, 490 insertions(+), 390 deletions(-) [+] |
line wrap: on
line diff
--- a/abims_xcms_refine.xml Mon Sep 11 09:21:15 2023 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -<tool id="abims_xcms_refine" name="xcms refineChromPeaks (refine)" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> - - <description>Remove or merge chromatographic peaks based on specific criteria.</description> - - <macros> - <import>macros.xml</import> - <import>macros_xcms.xml</import> - </macros> - - <expand macro="requirements"/> - - <expand macro="stdio"/> - - <command><![CDATA[ - @COMMAND_RSCRIPT@/xcms_refine.r - image '$image' - - method $methods.method - #if $methods.method == "CleanPeaks": - maxPeakwidth $methods.maxPeakwidth - #elif $methods.method == "FilterIntensity": - threshold $methods.threshold - nValues $methods.nValues - value $methods.value - #else: - expandRt $methods.expandRt - expandMz $methods.expandMz - ppm $methods.ppm - minProp $methods.minProp - #end if - - msLevel $msLevel - - @COMMAND_FILE_LOAD@ - - @COMMAND_LOG_EXIT@ - ]]></command> - - <inputs> - <param name="image" type="data" format="rdata.xcms.findchrompeaks" label="@INPUT_IMAGE_LABEL@" help="@INPUT_IMAGE_HELP@ from: findChromPeaks" /> - <conditional name="methods"> - <param name="method" type="select" label="Method for peak refinement" help="See the help section below"> - <option value="CleanPeaks" selected="true">CleanPeaks - remove peaks that are too wide</option> - <option value="FilterIntensity">FilterIntensity - remove peaks with too low intensity</option> - <option value="MergeNeighboringPeaks">MergeNeighboringPeaks - combine peaks that are too close together</option> - </param> - <when value="CleanPeaks"> - <param argument="maxPeakwidth" type="float" value="10" label="MaxPeakWidth" help="maximum peak width in seconds. See CleanPeaks manual (linked in help below)." /> - </when> - <when value="FilterIntensity"> - <param argument="threshold" type="float" value="0" label="minimal required intensity" help="minimal required intensity for a peak to be retained. Defaults to 0.0." /> - <param argument="nValues" type="integer" value="1" label="minimum number of data points per peak" help="number of data points (per chromatographic peak) that have to be >= threshold. Defaults to 1." /> - <param name="value" type="select" label="Definition of peak intensity" help="See the FilterIntensity manual (linked in help below). 'intb' requires centWave processed data"> - <option value="maxo" selected="true">maxo - use maximum peak intensities</option> - <option value="into">into - use integrated peak intensities</option> - <option value="intb">intb - use baseline-corrected integrated peak intensities</option> - </param> - </when> - <when value="MergeNeighboringPeaks"> - <param argument="expandRt" type="float" value="2" label="rt expansion (seconds)" help="seconds of expansion of retention time window (on both sides) to check for overlapping peaks. Defaults to 2." /> - <param argument="expandMz" type="float" value="0" label="m/z expansion (m/z units)" help="'m/z units' of expansion of m/z window (on both sides) to check for overlapping peaks. Defaults to 0." /> - <param argument="ppm" type="float" value="10" label="ppm expansion (ppm units)" help="'relative 'm/z units' (in parts per million) of expansion of m/z window (on both sides) to check for overlapping peaks. Defaults to 10." /> - <param argument="minProp" type="float" value="0.75" label="minimum proportion at midpoint" help="See MergeNeighboringPeaks manual (linked in help below). Minimum proportion midway between peaks relative to the smaller peak's 'maxo' (maximal intensity at peak apex). Defaults to 0.75." /> - </when> - </conditional> - <param argument="msLevel" type="integer" value="1" label="msLevel for refinement" help="the MS level on which refinement should be performed. Defaults to 1." /> - - <expand macro="input_file_load"/> - </inputs> - - <outputs> - <data name="xsetRData" format="rdata.xcms.findchrompeaks" label="${image.name.rsplit('.',1)[0]}.refine.RData" from_work_dir="xcmsSet.RData" /> - </outputs> - - <tests> - <!-- - test 1 - MergeNeighboringPeaks method - --> - <test> - <param name="image" value="faahKO-single-class.xset.merged.group.RData" ftype="rdata"/> - <conditional name="methods"> - <param name="method" value="MergeNeighboringPeaks"/> - <param name="expandRt" value="2" /> - <param name="expandMz" value="0" /> - <param name="ppm" value="10" /> - <param name="minProp" value="0.75" /> - </conditional> - <expand macro="test_file_load_single"/> - <assert_stderr> - <has_text text="Evaluating 547 peaks in file wt15.CDF for merging ... OK" /> - <has_text text="Evaluating 547 peaks in file wt16.CDF for merging ... OK" /> - <has_text text="Evaluating 558 peaks in file ko15.CDF for merging ... OK"/> - <has_text text="Evaluating 589 peaks in file ko16.CDF for merging ... OK" /> - <has_text text="Merging reduced 9251 chromPeaks to 9093" /> - </assert_stderr> - <assert_stdout> - <has_text text="object with 4 samples" /> - <has_text text="Time range: 2506.1-4477.9 seconds (41.8-74.6 minutes)" /> - <has_text text="Mass range: 200.1-600 m/z" /> - <has_text text="Peaks: 9093 (about 2273 per sample)" /> - </assert_stdout> - </test> - <!-- - test 2 - FilterIntensity method - --> - <test> - <param name="image" value="faahKO-single-class.xset.merged.group.RData" ftype="rdata"/> - <conditional name="methods"> - <param name="method" value="FilterIntensity"/> - <param name="threshold" value="1e5" /> - <param name="nValues" value="3" /> - <param name="value" value="into" /> - </conditional> - <expand macro="test_file_load_single"/> - <assert_stderr> - <has_text text="Removed 9018 chromatographic peaks" /> - </assert_stderr> - <assert_stdout> - <has_text text="object with 4 samples" /> - <has_text text="Time range: 2657.9-4124.2 seconds (44.3-68.7 minutes)" /> - <has_text text="Mass range: 256.1-599.4 m/z" /> - <has_text text="Peaks: 233 (about 58 per sample)" /> - </assert_stdout> - </test> - <!-- - test 3 - CleanPeaks method - --> - <test> - <param name="image" value="faahKO-single-class.xset.merged.group.RData" ftype="rdata"/> - <conditional name="methods"> - <param name="method" value="CleanPeaks"/> - <param name="maxPeakwidth" value="8" /> - </conditional> - <expand macro="test_file_load_single"/> - <assert_stderr> - <has_text text="Removed 6037 of 9251 chromatographic peaks" /> - </assert_stderr> - <assert_stdout> - <has_text text="object with 4 samples" /> - <has_text text="Time range: 2524.9-4473.2 seconds (42.1-74.6 minutes)" /> - <has_text text="Mass range: 200.2-600 m/z" /> - <has_text text="Peaks: 3214 (about 804 per sample)" /> - </assert_stdout> - </test> - </tests> - - <help><![CDATA[ - -.. class:: infomark - -**Authors** Johannes Rainer Johannes.Rainer@eurac.edu and Mar Garcia-Aloy mar.garcia@fmach.it - -@HELP_AUTHORS_WRAPPERS@ - ---------------------------------------------------- - - -===================== -xcms refineChromPeaks -===================== - ------------ -Description ------------ - -After peak identification with xcms findChromPeaks (xcmsSet), this tool refines those peaks. -It either removes peaks that are too wide or removes peaks with too low intensity or combines peaks that are too close together. - -Note well that refineChromPeaks methods will always remove feature definitions, -because a call to this method can change or remove identified chromatographic peaks, which may be part of features. -Therefore it must only be run immediately after findChromPeaks (xcmsSet). - ------------------ -Workflow position ------------------ - -**Upstream tools** - -==================================== ======================== ============================== -Name Output file Format -==================================== ======================== ============================== -xcms.findChromPeaks Merger (single) xset.merged.RData rdata.xcms.findchrompeaks ------------------------------------- ------------------------ ------------------------------ -xcms.findChromPeaks (zip) ``*``.raw.xset.RData rdata.xcms.findchrompeaks -==================================== ======================== ============================== - - -**Downstream tools** - -==================================== ======================== ========================= -Name Output file Format -==================================== ======================== ========================= -xcms.findChromPeaks Merger (single) ``*``.raw.xset.RData rdata.xcms.findchrompeaks ------------------------------------- ------------------------ ------------------------- -xcms.groupChromPeaks (zip) ``*``.raw.xset.RData rdata.xcms.findchrompeaks -==================================== ======================== ========================= - -**General schema of the metabolomic workflow** - -This tool would appear between findChromPeaks and group, but only when the choice of peaks needs to be refined, e.g., to accommodate HILIC data. - ---------------------------------------------------- - ----------- -Parameters ----------- - -Method to use for refinement ----------------------------- - -**CleanPeaks** - - | Remove chromatographic peaks with too large rt width. - | See the CleanPeaks_manual_ - -**FilterIntensity** - - | Remove chromatographic peaks based on intensity. - | See the FilterIntensity_manual_ - -**MergeNeighboringPeaks** - - | Merge neighboring and overlapping chromatographic peaks. - | See the MergeNeighboringPeaks_manual_ - -.. _CleanPeaks_manual: https://rdrr.io/bioc/xcms/man/refineChromPeaks-clean.html -.. _FilterIntensity_manual: https://rdrr.io/bioc/xcms/man/refineChromPeaks-filter-intensity.html -.. _MergeNeighboringPeaks_manual: https://rdrr.io/bioc/xcms/man/refineChromPeaks-merge.html - -@HELP_XCMS_MANUAL@ - ------------- -Output files ------------- - -xset.RData: rdata.xcms.findchrompeaks format - - | (single) RData files that are necessary in the second step of the workflow "xcms.groupChromPeaks" - must be merged first using "xcms.findChromPeaks Merger" - | (zip) RData file that is necessary in the second step of the workflow "xcms.groupChromPeaks". - - ---------------------------------------------------- - -Changelog/News --------------- - -.. _news: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS - - -**Version 3.6.1.0 - 08/02/2021** - -- NEW: first version of tool wrapper - - - ]]></help> - - <citations> - <citation type="doi">10.5281/zenodo.3909299</citation> - <expand macro="citation_w4m"/> - <citation type="doi">10.1021/ac051437y</citation> - </citations> - - -</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/abims_xcms_retcor.xml Thu Mar 14 15:35:44 2024 +0000 @@ -0,0 +1,383 @@ +<tool id="abims_xcms_retcor" name="xcms adjustRtime (retcor)" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> + + <description>Retention Time Correction</description> + + <macros> + <import>macros.xml</import> + <import>macros_xcms.xml</import> + </macros> + + <expand macro="requirements"/> + <expand macro="stdio"/> + + <command><![CDATA[ + @COMMAND_RSCRIPT@/xcms_retcor.r + image '$image' + + method $methods.method + #if $methods.method == "PeakGroups": + minFraction $methods.minFraction + extraPeaks $methods.extraPeaks + smooth $methods.smooth_cond.smooth + ## PeakGroupsSmoothLoess Advanced + span $methods.smooth_cond.PeakGroupsSmoothLoessAdv.span + family $methods.smooth_cond.PeakGroupsSmoothLoessAdv.family + #else + binSize $methods.binSize + ## Advanced + #if $methods.ObiwarpAdv.centerSample != "": + centerSample $methods.ObiwarpAdv.centerSample + #end if + response $methods.ObiwarpAdv.response + distFun $methods.ObiwarpAdv.distFunCond.distFun + gapInit $methods.ObiwarpAdv.distFunCond.gapInit + gapExtend $methods.ObiwarpAdv.distFunCond.gapExtend + factorDiag $methods.ObiwarpAdv.factorDiag + factorGap $methods.ObiwarpAdv.factorGap + localAlignment $methods.ObiwarpAdv.localAlignmentCond.localAlignment + initPenalty $methods.ObiwarpAdv.localAlignmentCond.initPenalty + #end if + + @COMMAND_FILE_LOAD@ + + @COMMAND_LOG_EXIT@ + ]]></command> + + <inputs> + <param name="image" type="data" format="rdata.xcms.findchrompeaks,rdata.xcms.group,rdata" label="@INPUT_IMAGE_LABEL@" help="@INPUT_IMAGE_HELP@ from: findChromPeaks, groupChromPeaks" /> + <conditional name="methods"> + <param name="method" type="select" label="Method to use for retention time correction" help="See the help section below" > + <option value="PeakGroups" selected="true">PeakGroups - retention time correction based on aligment of features (peak groups) present in most/all samples.</option> + <option value="Obiwarp">Obiwarp - alignment based on the complete mz-rt data.</option> + </param> + <when value="PeakGroups"> + <param argument="minFraction" type="float" value="0.9" min="0" max="1" label="Minimum required fraction of samples in which peaks for the peak group were identified" help="(previously missing)"/> + <param argument="extraPeaks" type="integer" value="1" label="Maximal number of additional peaks for all samples to be assigned to a peak group for retention time correction" help="For a data set with 6 samples, ‘extraPeaks = 1’ uses all peak groups with a total peak count lower or equal to ‘6 + 1’. The total peak count is the total number of peaks being assigned to a peak group and considers also multiple peaks within a sample being assigned to the group. (previously extra)" /> + <conditional name="smooth_cond"> + <param argument="smooth" type="select" label="Smooth method" > + <option value="loess" selected="true">loess - non-linear alignment</option> + <option value="linear">linear - linear alignment</option> + </param> + <when value="loess"> + <section name="PeakGroupsSmoothLoessAdv" title="Advanced Options" expanded="False"> + <param argument="span" type="float" value="0.2" label="Degree of smoothing for the loess fitting" /> + <param argument="family" type="select" label="Family" help="if gaussian fitting is by least-squares with no outlier removal, and if symmetric a re descending M estimator is used with Tukey's biweight function, allowing outlier removal"> + <option value="gaussian" selected="true">gaussian</option> + <option value="symmetric">symmetric</option> + </param> + </section> + </when> + <when value="linear" /> + </conditional> + </when> + <when value="Obiwarp"> + <param argument="binSize" type="float" value="1" label="Bin size (in mz dimension) to be used for the profile matrix generation" help="See ‘step’ parameter in ‘profile-matrix’ documentation for more details. (previously profStep)" /> + <section name="ObiwarpAdv" title="Advanced Options" expanded="False"> + <param argument="centerSample" type="integer" value="" optional="true" label="Index of the center sample in the experiment" help="It defaults to ‘floor(median(1:length(fileNames(object))))’" /> + <param argument="response" type="integer" value="1" label="Defining the responsiveness of warping" help="with ‘response = 0’ giving linear warping on start and end points and ‘response = 100’ warping using all bijective anchors." /> + <conditional name="distFunCond"> + <param argument="distFun" type="select" label="Distance function to be used"> + <option value="cor_opt" selected="true">cor_opt - calculate only 10% diagonal band of distance matrix; better runtime</option> + <option value="cor">cor - Pearson's correlation</option> + <option value="cov">cov - covariance</option> + <option value="prd">prd - product</option> + <option value="euc">euc - Euclidian distance</option> + </param> + <when value="cor_opt"> + <param argument="gapInit" type="float" value="0.3" label="Penalty for gap opening" /> + <param argument="gapExtend" type="float" value="2.4" label="Penalty for gap enlargement" /> + </when> + <when value="cor"> + <param argument="gapInit" type="float" value="0.3" label="Penalty for gap opening" /> + <param argument="gapExtend" type="float" value="2.4" label="Penalty for gap enlargement" /> + </when> + <when value="cov"> + <param argument="gapInit" type="float" value="0.0" label="Penalty for gap opening" /> + <param argument="gapExtend" type="float" value="11.7" label="Penalty for gap enlargement" /> + </when> + <when value="prd"> + <param argument="gapInit" type="float" value="0.0" label="Penalty for gap opening" /> + <param argument="gapExtend" type="float" value="7.8" label="Penalty for gap enlargement" /> + </when> + <when value="euc"> + <param argument="gapInit" type="float" value="0.9" label="Penalty for gap opening" /> + <param argument="gapExtend" type="float" value="1.8" label="Penalty for gap enlargement" /> + </when> + </conditional> + <param argument="factorDiag" type="float" value="2" label="Local weight applied to diagonal moves in the alignment" /> + <param argument="factorGap" type="float" value="1" label="local weight for gap moves in the alignment" /> + <conditional name="localAlignmentCond"> + <param argument="localAlignment" type="select" label="Whether a local alignment should be performed instead of the default global alignment"> + <option value="FALSE" selected="true">FALSE</option> + <option value="TRUE">TRUE</option> + </param> + <when value="FALSE"> + <param argument="initPenalty" type="hidden" value="0" label="Penalty for initiating an alignment" /> + </when> + <when value="TRUE"> + <param argument="initPenalty" type="float" value="0" label="Penalty for initiating an alignment" /> + </when> + </conditional> + </section> + </when> + </conditional> + + <expand macro="input_file_load"/> + + </inputs> + + <outputs> + <data name="xsetRData" format="rdata.xcms.retcor" label="${image.name[:-6]}.adjustRtime.RData" from_work_dir="retcor.RData" /> + <data name="rawVSadjustedPdf" format="pdf" label="${image.name[:-6]}_rawVSadjusted.adjustRtime.Rplots.pdf" from_work_dir="raw_vs_adjusted_rt.pdf" /> + </outputs> + + <tests> + <test> + <param name="image" value="faahKO-single-class.xset.merged.group.RData" ftype="rdata"/> + <conditional name="methods"> + <param name="method" value="PeakGroups"/> + <param name="extraPeaks" value="1"/> + <param name="minFraction" value="1"/> + <conditional name="smooth_cond"> + <param name="smooth" value="loess"/> + <section name="PeakGroupsSmoothLoessAdv"> + <param name="span" value="0.2"/> + <param name="family" value="gaussian"/> + </section> + </conditional> + </conditional> + <expand macro="test_file_load_single"/> + <assert_stdout> + <has_text text="extraPeaks: 1" /> + <has_text text="minFraction: 1" /> + <has_text text="span: 0.2" /> + <has_text text="object with 4 samples" /> + <has_text text="Time range: 2509.2-4480.3 seconds (41.8-74.7 minutes)" /> + <has_text text="Mass range: 200.1-600 m/z" /> + <has_text text="Peaks: 9251 (about 2313 per sample)" /> + <has_text text="Peak Groups: 0" /> + <has_text text="Sample classes: KO, WT" /> + </assert_stdout> + </test> + <!-- DISABLE FOR TRAVIS : Zip + <test> + <param name="image" value="faahKO.xset.group.RData" ftype="rdata"/> + <conditional name="methods"> + <param name="method" value="PeakGroups"/> + <param name="extraPeaks" value="1"/> + <param name="minFraction" value="1"/> + <conditional name="smooth_cond"> + <param name="smooth" value="loess"/> + <section name="PeakGroupsSmoothLoessAdv"> + <param name="span" value="0.2"/> + <param name="family" value="gaussian"/> + </section> + </conditional> + </conditional> + <expand macro="test_file_load_zip"/> + <assert_stdout> + <has_text text="object with 4 samples" /> + <has_text text="Time range: 2509.2-4480.3 seconds (41.8-74.7 minutes)" /> + <has_text text="Mass range: 200.1-600 m/z" /> + <has_text text="Peaks: 9251 (about 2313 per sample)" /> + <has_text text="Peak Groups: 0" /> + <has_text text="Sample classes: KO, WT" /> + </assert_stdout> + </test> + --> + <!-- DISABLE FOR TRAVIS + Test to test the different methods parameters + <test> + <param name="image" value="faahKO-single-class.xset.group.RData" ftype="rdata"/> + <conditional name="methods"> + <param name="method" value="Obiwarp"/> + <section name="ObiwarpAdv"> + <param name="centerSample" value="1"/> + <param name="response" value="0"/> + <conditional name="distFunCond"> + <param name="distFun" value="cov"/> + <param name="gapInit" value="0.1" /> + </conditional> + </section> + </conditional> + <expand macro="test_file_load_single"/> + <assert_stdout> + <has_text text="centerSample: 1" /> + <has_text text="response: 0" /> + <has_text text="distFun: cov" /> + <has_text text="gapInit: 0.1" /> + <has_text text="gapExtend: 11.7" /> + </assert_stdout> + </test> + --> + </tests> + + <help><![CDATA[ + +@HELP_AUTHORS@ + +================ +xcms adjustRtime +================ + +----------- +Description +----------- + +After matching peaks into groups, xcms can use those groups to identify and correct +correlated drifts in retention time from run to run. The aligned peaks can then be +used for a second pass of peak grouping which will be more accurate than the first. +The whole process can be repeated in an iterative fashion. Not all peak groups will be helpful +for identifying retention time drifts. Some groups may be missing peaks from a large +fraction of samples and thus provide an incomplete picture of the drift at that time point. +Still others may contain multiple peaks from the same sample, which is a sign of impropper grouping. + +.. class:: warningmark + +**After an adjustRtime step, it is mandatory to do a groupChromPeaks step, otherwise the rest of the workflow will not work with the RData file. (the initial peak grouping becomes invalid and is +discarded)** + + + +----------------- +Workflow position +----------------- + + +**Upstream tools** + +========================= ============================ ============================== +Name Output file Format +========================= ============================ ============================== +xcms.findChromPeaks raw.xset.RData rdata.xcms.findchrompeaks +------------------------- ---------------------------- ------------------------------ +xcms.groupChromPeaks ``*``.groupChromPeaks.RData rdata.xcms.group +========================= ============================ ============================== + + +**Downstream tools** + +=========================== ============================ ================ +Name Output file Format +=========================== ============================ ================ +xcms.groupChromPeaks ``*``.groupChromPeaks.RData rdata.xcms.group +=========================== ============================ ================ + + +**General schema of the metabolomic workflow** + +.. image:: xcms_retcor_workflow.png + +--------------------------------------------------- + +---------- +Parameters +---------- + +Method +------ + +**PeakGroups** + + | This method performs retention time adjustment based on the alignment of chromatographic peak groups present in all/most samples (hence corresponding to house keeping compounds). First the retention time deviation of these peak groups is described by fitting either a polynomial (‘smooth = "loess"’) or a linear ( ‘smooth = "linear"’) model to the data points. These models are subsequently used to adjust the retention time of each spectrum in each sample. + | See the PeakGroups_manual_ + +**Obiwarp** + + | This method performs retention time adjustment using the Obiwarp method [Prince 2006]. It is based on the code at http://obi-warp.sourceforge.net but supports alignment of multiple samples by aligning each against a _center_ sample. The alignment is performed directly on the ‘profile-matrix’ and can hence be performed independently of the peak detection or peak grouping. + | See the Obiwarp_manual_ + +.. _PeakGroups_manual: https://rdrr.io/bioc/xcms/man/adjustRtime-peakGroups.html#heading-2 +.. _Obiwarp_manual: https://rdrr.io/bioc/xcms/man/adjustRtime-obiwarp.html + +WARNING: if a retention time ajustment have already been applied to your data. +The function applyAdjustedRtime will replace raw retention times with adjusted retention times and so alloww to cumulate the ajustments. + +@HELP_XCMS_MANUAL@ + +------------ +Output files +------------ + +xset.groupChromPeaks.adjustRtime.RData: rdata.xcms.retcor format + + | Rdata file that will be necessary in the **xcms.groupChromPeaks** step of the workflow. + + +--------------------------------------------------- + +Changelog/News +-------------- + +@HELP_XCMS_NEWVERSION_31200@ + +**Version 3.6.1+galaxy1 - 13/02/2020** + +- NEW: if a retention time ajustment have already been applied to your data. The function applyAdjustedRtime will replace raw retention times with adjusted retention times and so alloww to cumulate the ajustments. + +@HELP_XCMS_NEWVERSION_3610@ + +**Version 3.4.4.1 - 30/04/2019** + +- BUGFIX: remove the pre-compute of the chromatograms which was memory consuming. Now, only xcms plot chromatogram will generate the Chromatograms. + +@HELP_XCMS_NEWVERSION_3440@ + +**Version 3.0.0.0 - 08/03/2018** + +- UPGRADE: upgrade the xcms version from 1.46.0 to 3.0.0. So refactoring of a lot of underlying codes and methods. Some parameters may have been renamed. + +- NEW: a bunch of new options: Obiwarp.(centerSample, response, distFun, gapInit, gapExtend, factorDiag, factorGap, localAlignment, initPenalty) + +- IMPROVEMENT: the advanced options are now in sections. It will allow you to access to all the parameters and to know their default values. + +- CHANGE: removing of the TIC and BPC plots. You can now use the dedicated tool "xcms plot chromatogram" + + +**Version 2.1.1 - 29/11/2017** + +- BUGFIX: To avoid issues with accented letter in the parentFile tag of the mzXML files, we changed a hidden mechanim to LC_ALL=C + + +**Version 2.1.0 - 03/02/2017** + +- IMPROVEMENT: xcms.retcor can deal with merged individual data + + +**Version 2.0.8 - 22/12/2016** + +- BUGFIX: when having only one group (i.e. one folder of raw data) the BPC and TIC pdf files do not contain any graph + + +@HELP_XCMS_NEWVERSION_2090@ + + +**Version 2.0.6 - 04/04/2016** + +- TEST: refactoring to pass planemo test using conda dependencies + + +**Version 2.0.5 - 10/02/2016** + +- BUGFIX: better management of errors. Datasets remained green although the process failed + +- BUGFIX: some pdf remained empty even when the process succeed + +- UPDATE: refactoring of internal management of inputs/outputs + +- UPDATE: refactoring to feed the new report tool + + +**Version 2.0.2 - 02/06/2015** + +- IMPROVEMENT: new datatype/dataset formats (rdata.xcms.raw, rdata.xcms.group, rdata.xcms.retcor ...) will facilitate the sequence of tools and so avoid incompatibility errors. + +- IMPROVEMENT: parameter labels have changed to facilitate their reading. + + + ]]></help> + + + <expand macro="citation" /> + +</tool>
--- a/xcms_refine.r Mon Sep 11 09:21:15 2023 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -#!/usr/bin/env Rscript - -# ----- LOG FILE ----- -log_file <- file("log.txt", open = "wt") -sink(log_file) -sink(log_file, type = "output") - - -# ----- PACKAGE ----- -cat("\tSESSION INFO\n") - -#Import the different functions -source_local <- function(fname) { - argv <- commandArgs(trailingOnly = FALSE) - base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) - source(paste(base_dir, fname, sep = "/")) -} -source_local("lib.r") - -pkgs <- c("xcms", "batch", "RColorBrewer") -loadAndDisplayPackages(pkgs) -cat("\n\n") - -# ----- ARGUMENTS ----- -cat("\tARGUMENTS INFO\n") -# interpretation of arguments given in command line as an R list of objects -args <- parseCommandArgs(evaluate = FALSE) -write.table(as.matrix(args), col.names = FALSE, quote = FALSE, sep = "\t") - -cat("\n\n") - -# ----- PROCESSING INFILE ----- -cat("\tARGUMENTS PROCESSING INFO\n") - -#saving the specific parameters -args_method <- args$method -args_image <- args$image -args_msLevel <- args$msLevel -param_args <- list() - -if (args_method == "CleanPeaks") { - param_args$maxPeakwidth <- args$maxPeakwidth -} else if (args_method == "FilterIntensity") { - param_args$threshold <- args$threshold - param_args$value <- args$value - param_args$nValues <- args$nValues -} else if (args_method == "MergeNeighboringPeaks") { - param_args$expandRt <- args$expandRt - param_args$expandMz <- args$expandMz - param_args$ppm <- args$ppm - param_args$minProp <- args$minProp -} - -cat("\n\n") - - -# ----- ARGUMENTS PROCESSING ----- -cat("\tINFILE PROCESSING INFO\n") - -#image is an .RData file necessary to use xset variable given by previous tools -load(args_image) -if (!exists("xdata")) stop("\n\nERROR: The RData doesn't contain any object called 'xdata'. Such RData as this might have been created by an old version of XMCS 2.*") - -# Handle infiles -if (!exists("singlefile")) singlefile <- NULL -if (!exists("zipfile")) zipfile <- NULL -rawFilePath <- retrieveRawfileInTheWorkingDir(singlefile, zipfile, args) -zipfile <- rawFilePath$zipfile -singlefile <- rawFilePath$singlefile - -cat("\n\n") - - -# ----- MAIN PROCESSING INFO ----- -cat("\tMAIN PROCESSING INFO\n") - - -cat("\t\tPREPARE PARAMETERS\n\n") - -if (args_method == "CleanPeaks") { - refineChromPeaksParam <- CleanPeaksParam(maxPeakwidth = param_args$maxPeakwidth) -} else if (args_method == "FilterIntensity") { - refineChromPeaksParam <- FilterIntensityParam( - threshold = param_args$threshold, - nValues = param_args$nValues, - value = param_args$value - ) -} else if (args_method == "MergeNeighboringPeaks") { - refineChromPeaksParam <- MergeNeighboringPeaksParam( - expandRt = param_args$expandRt, - expandMz = param_args$expandMz, - ppm = param_args$ppm, - minProp = param_args$minProp - ) -} - -cat(str(refineChromPeaksParam)) - -cat("\n\n\t\tCOMPUTE\n") - -xdata <- updateObject(xdata) - -xdata <- refineChromPeaks(xdata, param = refineChromPeaksParam) - -cat("\n\n") - -# ----- EXPORT ----- - -cat("\tXCMSnExp OBJECT INFO\n") -print(xdata) -cat("\n\n") - -cat("\txcmsSet OBJECT INFO\n") -# Get the legacy xcmsSet object -xset <- getxcmsSetObject(xdata) -print(xset) -cat("\n\n") - -#saving R data in .Rdata file to save the variables used in the present tool -objects2save <- c("xdata", "zipfile", "singlefile", "md5sumList", "sampleNamesList") -save(list = objects2save[objects2save %in% ls()], file = "xcmsSet.RData") - -cat("\n\n") - - -cat("\tDONE\n")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xcms_retcor.r Thu Mar 14 15:35:44 2024 +0000 @@ -0,0 +1,107 @@ +#!/usr/bin/env Rscript + +# ----- LOG FILE ----- +log_file <- file("log.txt", open = "wt") +sink(log_file) +sink(log_file, type = "output") + + +# ----- PACKAGE ----- +cat("\tSESSION INFO\n") + +#Import the different functions +source_local <- function(fname) { + argv <- commandArgs(trailingOnly = FALSE) + base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) + source(paste(base_dir, fname, sep = "/")) +} +source_local("lib.r") + +pkgs <- c("xcms", "batch", "RColorBrewer") +loadAndDisplayPackages(pkgs) +cat("\n\n") + + +# ----- ARGUMENTS ----- +cat("\tARGUMENTS INFO\n") +args <- parseCommandArgs(evaluate = FALSE) #interpretation of arguments given in command line as an R list of objects +write.table(as.matrix(args), col.names = FALSE, quote = FALSE, sep = "\t") + +cat("\n\n") + +# ----- PROCESSING INFILE ----- +cat("\tARGUMENTS PROCESSING INFO\n") + +#saving the specific parameters +method <- args$method + +cat("\n\n") + + +# ----- ARGUMENTS PROCESSING ----- +cat("\tINFILE PROCESSING INFO\n") + +#image is an .RData file necessary to use xset variable given by previous tools +load(args$image) +args$image <- NULL +if (!exists("xdata")) stop("\n\nERROR: The RData doesn't contain any object called 'xdata'. This RData should have been created by an old version of XMCS 2.*") + +# Handle infiles +if (!exists("singlefile")) singlefile <- NULL +if (!exists("zipfile")) zipfile <- NULL +rawFilePath <- retrieveRawfileInTheWorkingDir(singlefile, zipfile, args) +zipfile <- rawFilePath$zipfile +singlefile <- rawFilePath$singlefile + +cat("\n\n") + + +# ----- MAIN PROCESSING INFO ----- +cat("\tMAIN PROCESSING INFO\n") + + +cat("\t\tCOMPUTE\n") + +cat("\t\t\tAlignment/Retention Time correction\n") +# clear the arguement list to remove unexpected key/value as singlefile_galaxyPath or method ... +args <- args[names(args) %in% slotNames(do.call(paste0(method, "Param"), list()))] + +adjustRtimeParam <- do.call(paste0(method, "Param"), args) +print(adjustRtimeParam) + +if (hasAdjustedRtime(xdata)) { + cat("WARNING: a retention time ajustment had already been applied to your data.\nThe function applyAdjustedRtime was processed to cumulate the ajustment") + cat("Replace raw retention times with adjusted retention times.\n") + xdata <- applyAdjustedRtime(xdata) +} +xdata <- adjustRtime(xdata, param = adjustRtimeParam) + +cat("\n\n") + + +# -- TIC -- +cat("\t\tDRAW GRAPHICS\n") +getPlotAdjustedRtime(xdata) + +cat("\n\n") + +# ----- EXPORT ----- + +cat("\tXCMSnExp OBJECT INFO\n") +print(xdata) +cat("\n\n") + +cat("\txcmsSet OBJECT INFO\n") +# Get the legacy xcmsSet object +xset <- getxcmsSetObject(xdata) +print(xset) +cat("\n\n") + +#saving R data in .Rdata file to save the variables used in the present tool +objects2save <- c("xdata", "zipfile", "singlefile", "md5sumList", "sampleNamesList") +save(list = objects2save[objects2save %in% ls()], file = "retcor.RData") + +cat("\n\n") + + +cat("\tDONE\n")