view matchms_filtering.xml @ 11:36a53917818d draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit f5f5a8eff32c9b5de792dce99bc3c63dc971e82c
author recetox
date Thu, 23 Nov 2023 09:52:44 +0000
parents 039e7ab31836
children ca5a8db023e1
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 $require_smiles_is_true == "TRUE"
                -require_smiles \
            #end if
            #if $require_inchi_is_true == "TRUE"
                -require_inchi \
            #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 (and losses) 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>

        <param name="require_smiles_is_true" label="Require SMILES" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false"
                help="Remove spectra that does not contain SMILES." />

        <param name="require_inchi_is_true" label="Require INCHI" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false"
                help="Remove spectra that does not contain INCHI." />

        <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/require_filter.msp" ftype="msp"/>
            <param name="require_smiles_is_true" value="TRUE"/>
            <output name="output" file="filtering/require_smiles_out.msp" ftype="msp"/>
        </test>
        <test>
            <param name="spectra" value="filtering/require_filter.msp" ftype="msp"/>
            <param name="require_inchi_is_true" value="TRUE"/>
            <output name="output" file="filtering/require_inchi_out.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>
    </tests>

    <help>
        @HELP_matchms@
    </help>

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