view matchms_filtering.xml @ 22:00e66c401366 draft default tip

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit 8db07edd3b0d2ff778036dec410027ad58365488
author recetox
date Mon, 15 Jul 2024 08:00:24 +0000
parents 86d265d2a334
children
line wrap: on
line source

<tool id="matchms_filtering" name="matchms filtering" version="@TOOL_VERSION@+galaxy0" profile="21.09">
    <description>filter and normalize mass spectrometry data</description>

    <macros>
        <import>macros.xml</import>
        <import>help.xml</import>
    </macros>

    <expand macro="creator"/>

    <edam_operations>
        <edam_operation>operation_3695</edam_operation>
    </edam_operations>
    <expand macro="bio.tools"/>

    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">matchms</requirement>
    </requirements>

    <command detect_errors="exit_code"><![CDATA[
        sh ${matchms_python_cli}
    ]]> </command>

    <environment_variables>
        <environment_variable name="MPLCONFIGDIR">\$_GALAXY_JOB_TMP_DIR</environment_variable>
    </environment_variables>

    <configfiles>
        <configfile name="matchms_python_cli">
            python3 ${__tool_directory__}/matchms_filtering_wrapper.py \
            --spectra "$spectra" \
            --spectra_format "$spectra.ext" \
            #if $normalise_intensities_is_true == "TRUE"
                -normalise_intensities \
            #end if
            #if $default_filters_is_true == "TRUE"
                -default_filters \
            #end if
            #if $clean_metadata_is_true == "TRUE"
                -clean_metadata \
            #end if
            #if $relative_intensity.is_true == "TRUE"
                -relative_intensity \
                --from_intensity "$relative_intensity.from_intensity" \
                --to_intensity "$relative_intensity.to_intensity" \
            #end if
            #if $mz_range.is_true == "TRUE"
                -mz_range \
                --from_mz "$mz_range.from_mz" \
                --to_mz "$mz_range.to_mz" \
            #end if
            #if $derive_precursor_mz_from_parent_mass.is_true == "TRUE"
                -derive_precursor_mz_from_parent_mass \
                --estimate_from_adduct "${derive_precursor_mz_from_parent_mass.estimate_from_adduct}" \
            #end if
            #if $reduce_to_top_n_peaks.is_true == "TRUE"
                -reduce_to_top_n_peaks \
                --n_max "$reduce_to_top_n_peaks.n_max" \
            #end if
            --output "$output"
        </configfile>
    </configfiles>

    <inputs>
        <param label="Spectra file" name="spectra" type="data" format="msp,mgf" help="Mass spectra file to be filtered." />
        <param name="normalise_intensities_is_true" label="Normalize intensities" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false"
                help="Normalize intensities of peaks to unit height."/>
        <param name="default_filters_is_true" label="Apply default filters" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false"
                help="Collection of filters that are considered default and that do no require any (factory) arguments."/>
        <param name="clean_metadata_is_true" label="Clean metadata" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false"
                help="Apply all adding and cleaning filters if possible, so that the spectra have canonical metadata." />

        <conditional name="relative_intensity">
            <param name="is_true" label="Filter relative intensity" type="select" 
                   help="Keep only peaks within set relative intensity range (keep if maximum >= intensity >= minimum).">
                <option value="FALSE" selected="true">FALSE</option>
                <option value="TRUE">TRUE</option>
            </param>
            <when value="TRUE">
                <param label="Minimum intensity" name="from_intensity" value="0" type="float" help="Lower bound for intensity filter." />
                <param label="Maximum intensity" name="to_intensity" value="1" type="float" help="Upper bound for intensity filter." />
            </when>
            <when value="FALSE"></when>
        </conditional>

        <conditional name="mz_range">
            <param name="is_true" label="Filter m/z range" type="select"
                   help="Keep only peaks between set m/z range (keep if maximum >= m/z >= minimum).">
                <option value="FALSE" selected="true">FALSE</option>
                <option value="TRUE">TRUE</option>
            </param>
            <when value="TRUE">
                <param label="Minimum m/z" name="from_mz" optional="true" type="float" help="Lower bound for m/z filter." />
                <param label="Maximum m/z" name="to_mz" optional="true" type="float" help="Upper bound for m/z filter." />
            </when>
            <when value="FALSE"></when>
        </conditional>

        <conditional name="derive_precursor_mz_from_parent_mass">
            <param name="is_true" label="Derive precursor_mz from parent_mass" type="select"
                   help="Derives the precursor_mz from the parent mass and adduct or charge.">
                <option value="FALSE" selected="true">FALSE</option>
                <option value="TRUE">TRUE</option>
            </param>
            <when value="TRUE">
                <param label="Estimate from adduct" name="estimate_from_adduct" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false" />
            </when>
            <when value="FALSE"></when>
        </conditional>

        <conditional name="reduce_to_top_n_peaks">
            <param name="is_true" label="Reduce to top n peaks" type="select"
                   help="Lowest intensity peaks will be removed when it has more peaks than desired.">
                <option value="FALSE" selected="true">FALSE</option>
                <option value="TRUE">TRUE</option>
            </param>
            <when value="TRUE">
                <param label="Maximum number of peaks" name="n_max" value="5" type="integer" help="Maximum number of peaks. Remove peaks if more peaks are found." />
            </when>
            <when value="FALSE"></when>
        </conditional>

    </inputs>

    <outputs>
        <data label="${tool.name} on ${on_string}" name="output" format_source="spectra" />
    </outputs>

    <tests>
        <test>
            <param name="spectra" value="filtering/input.msp" ftype="msp"/>
            <param name="normalise_intensities_is_true" value="TRUE"/>
            <output name="output" file="filtering/normalise_intensities.msp" ftype="msp"/>
        </test>
        <test>
            <param name="spectra" value="filtering/input.msp" ftype="msp"/>
            <param name="default_filters_is_true" value="TRUE"/>
            <output name="output" file="filtering/default_filters.msp" ftype="msp"/>
        </test>
        <test>
            <param name="spectra" value="filtering/input.msp" ftype="msp"/>
            <param name="clean_metadata_is_true" value="TRUE"/>
            <output name="output" file="filtering/clean_metadata.msp" ftype="msp"/>
        </test>
        <test>
            <param name="spectra" value="filtering/input.msp" ftype="msp"/>
            <section name="relative_intensity">
                <param name="is_true" value="TRUE"/>
                <param name="from_intensity" value="0.3"/>
                <param name="to_intensity" value="0.9"/>
            </section>
            <output name="output" file="filtering/relative_intensity.msp" ftype="msp"/>
        </test>
        <test>
            <param name="spectra" value="filtering/input.msp" ftype="msp"/>
            <section name="mz_range">
                <param name="is_true" value="TRUE"/>
                <param name="from_mz" value="300"/>
                <param name="to_mz" value="800"/>
            </section>
            <output name="output" file="filtering/mz_range.msp" ftype="msp"/>
        </test>
        <test>
            <param name="spectra" value="filtering/input.msp" ftype="msp"/>
            <section name="reduce_to_top_n_peaks">
                <param name="is_true" value="TRUE"/>
                <param name="n_max" value="5"/>
            </section>
            <output name="output" file="filtering/reduce_to_top_n_peaks.msp" ftype="msp"/>
        </test>
        <test>
            <param name="spectra" value="filtering/derive_precursor_mz.msp" ftype="msp"/>
            <section name="derive_precursor_mz_from_parent_mass">
                <param name="is_true" value="TRUE"/>
                <param name="estimate_from_adduct" value="TRUE"/>
            </section>
            <output name="output" file="filtering/derive_precursor_mz_out.msp" ftype="msp"/>
        </test>
    </tests>

    <help>
        @HELP_matchms@
    </help>

    <expand macro="citations"/>
</tool>