view bioconductor_msnbase_centroid.xml @ 0:4018639dc0a5 draft default tip

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/bioconductor-msnbase commit 8a94b9932a94c323a33dfe858ee0a2c57fb04701
author recetox
date Fri, 24 Jan 2025 15:58:07 +0000
parents
children
line wrap: on
line source

<tool id="bioconductor_msnbase_centroid" name="bioconductor-msnbase centroid" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01" license="MIT">
    <description>centroid raw profile-mode MS data</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="xrefs"/>
    <expand macro="creator"/>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[
        Rscript "${run_script}"
    ]]></command>
    <configfiles>
        <configfile name="run_script"><![CDATA[
            data_prof <- MSnbase::readMSData("$input_file", msLevel = $mslevel)

            data_centroided <- MSnbase::pickPeaks(
                data_prof,
                halfWindowSize = ${halfWindowSize},
                method = "${estimate_noise_method}",
                SNR = ${snr},
                refineMz = "${refinement.method}",
                #if "$refinement.method" == "kNeighbors"
                k = ${refinement.k}
                #else if "$refinement.method" == "descendPeak"
                signalPercentage = ${refinement.signal_percentage},
                stopAtTwo = ${refinement.stop_at_two}
                #end if
            )

            MSnbase::writeMSData(
                data_centroided,
                file = "centroided.mzml",
                copy = TRUE,
                outformat = "mzml"
            )
        ]]></configfile>
    </configfiles>
    <inputs>
        <param name="input_file" type="data" format="mzml" label="Input mzML File"
            help="The input mzML file containing the mass spectrometry data to be centroided."/>
        <param argument="mslevel" type="boolean" truevalue="2" falsevalue="1" checked="false" label="MS2"
            help="Specify if the dataset contains MS2 (tandem mass spectrometry) data." />
        <param name="halfWindowSize" type="integer" label="Half window size" min="1" value="2"
            help="The half window size for the centroiding method. This determines the number of data points on either side of the center point to include in the centroiding calculation."/>
        <param name="estimate_noise_method" type="select" label="Noise estimation method"
            help="Method to choose to estimate the noise in the spectrum.">
            <option value="MAD" selected="true">Median Absolute Deviation</option>
            <option value="SuperSmoother">Friedman's Super Smoother</option>
        </param>
        <param argument="--snr" type="float" min="0" value="3" label="Signal-to-noise ratio (SNR)"
            help="The signal-to-noise ratio threshold for removing noisy signals." />
        <conditional name="refinement">
            <param name="method" type="select" label="Peak refinement method" 
                help="The method refines the m/z value of the identified centroids by considering data points that belong (most likely) to the same mass peak.
                The m/z value is calculated as an intensity weighted average of the m/z values within the peak region.
                How the peak region is defined depends on the method chosen.">
                <option value="none" selected="true">None</option>
                <option value="kNeighbors">K-Neighbors</option>
                <option value="descendPeak">Descend Peak</option>
            </param>
            <when value="kNeighbors">
                <param argument="--k" type="integer" min="1" max="10" value="2" label="K"
                    help="The number of 2*K nearest neighbors to consider for m/z interpolation during peak refinement."/>
            </when>
            <when value="descendPeak">
                <param argument="--signal_percentage" type="integer" min="0" max="100" value="20" label="Intensity threshold (%)"
                    help="The signal intensity cutoff threshold (as a percentage) for including values in the m/z calculation during peak refinement." />
                <param argument="stop_at_two" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false" label="Stop at two"
                    help="Specify whether to stop the descent only after encountering two increasing scans, instead of stopping at the first increasing scan." />
            </when>
            <when value="none"/>
        </conditional>
    </inputs>
    <outputs>
        <data name="output_file" format="mzml" label="${on_string} centroided with refinement ${refinement.method}" from_work_dir="centroided.mzml"/>
    </outputs>
    <tests>
        <test>
            <param name="input_file" value="29_qc_no_dil_milliq_subset.mzML"/>
            <output name="output_file">
                <assert_contents>
                    <expand macro="assertions_centroiding"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" value="29_qc_no_dil_milliq_subset.mzML"/>
            <param name="method" value="kNeighbors"/>
            <param name="k" value="3"/>
            <output name="output_file">
                <assert_contents>
                    <expand macro="assertions_centroiding"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" value="29_qc_no_dil_milliq_subset.mzML"/>
            <param name="method" value="descendPeak"/>
            <param name="signal_percentage" value="10"/>
            <output name="output_file">
                <assert_contents>
                    <expand macro="assertions_centroiding"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
        .. class:: infomark

**What it does**

This tool performs centroiding on mass spectrometry data using the MSnbase package in R. Centroiding is a process that converts profile mode data to centroid mode by identifying the peaks in the mass spectrum and representing them as single points.

**Usage**

- **Input**: Provide the input mzML file containing the mass spectrometry data to be centroided.
- **Parameters**:
   - **Input mzML File**: The input mzML file containing the mass spectrometry data to be centroided.
   - **MS2**: Specify if the dataset contains MS2 (tandem mass spectrometry) data.
   - **Half window size**: The number of data points on either side of the center point to include in the centroiding calculation.
   - **Noise estimation method**: Choose the method to estimate the noise in the spectrum. Options include Median Absolute Deviation (MAD) and Friedman's Super Smoother.
   - **Signal-to-noise ratio (SNR)**: The signal-to-noise ratio threshold for removing noisy signals. A higher value will result in more noise being filtered out.
   - **Peak refinement method**: Select the method to refine the m/z value of the identified centroids. Options include None, K-Neighbors, and Descend Peak.
     - **K**: The number of 2*K nearest neighbors to consider for m/z interpolation during peak refinement (only applicable if K-Neighbors method is selected).
     - **Intensity threshold (%)**: The signal intensity cutoff threshold (as a percentage) for including values in the m/z calculation during peak refinement (only applicable if Descend Peak method is selected).
     - **Stop at two**: Specify whether to stop the descent only after encountering two increasing scans, instead of stopping at the first increasing scan (only applicable if Descend Peak method is selected).
- **Output**: The centroided mzML file.

**Input**

- **Input mzML File**: The input mzML file containing the mass spectrometry data to be centroided.

**Output**

- **Output mzML File**: The resulting mzML file after applying the centroiding algorithm.

**References**

For more detailed information, please refer to the original documentation available via Bioconductor: https://bioconductor.org/packages/release/bioc/html/MSnbase.html
        ]]></help>
        <expand macro="citations"/>
</tool>