view matchms_similarity.xml @ 7:b768248c37d0 draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit 8989605190816b606fd0bf5be101c6d385a4ce52
author recetox
date Tue, 02 May 2023 10:14:54 +0000
parents 28f7f2e60331
children
line wrap: on
line source

<tool id="matchms" name="matchMS similarity" version="@TOOL_VERSION@+galaxy0" python_template_version="3.8">
    <description>calculate the similarity score and matched peaks</description>

    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="creator"/>

    <requirements>
        <requirement type="package" version="1.1.4">pandas</requirement>
        <requirement type="package" version="0.55.1">numba</requirement>
        <requirement type="package" version="@TOOL_VERSION@">matchms</requirement>
    </requirements>

    <environment_variables>
        <environment_variable name="MPLCONFIGDIR">/tmp</environment_variable>
    </environment_variables>

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

    <configfiles>
        <configfile name="matchms_python_cli">
            python3 ${__tool_directory__}/matchms_similarity_wrapper.py \
            #if $ri_filtering.is_true
            -r $ri_filtering.tolerance \
            #end if
            #if $symmetric.is_symmetric
            -s \
            #else
            --ref "$references" \
            --ref_format "$references.ext" \
            #end if
            "$queries" \
            "$queries.ext" \
            "$similarity_metric" \
            "$algorithm.tolerance" \
            "$algorithm.mz_power" \
            "$algorithm.intensity_power" \
            "$similarity_scores" \
        </configfile>
    </configfiles>

    <inputs>
        <param label="Queries spectra" name="queries" type="data" format="msp,mgf"
               help="Query mass spectra to match against references."/>
        <conditional name="symmetric">
            <param name="is_symmetric" label="Symmetric" type="boolean" truevalue="TRUE" falsevalue="FALSE"
                   checked="false"/>
            <when value="FALSE">
                <param label="Reference spectra" name="references" type="data" format="msp,mgf"
                       help="Reference mass spectra to match against as library."/>
            </when>
        </conditional>
        <param label="Similarity metric" name="similarity_metric" type="select" display="radio"
               help="Similarity metric to use for score computation.">
            <option value="CosineGreedy" selected="true">CosineGreedy</option>
            <option value="CosineHungarian">CosineHungarian</option>
            <option value="ModifiedCosine">ModifiedCosine</option>
            <option value="NeutralLossesCosine">NeutralLossesCosine</option>
        </param>

        <section name="algorithm" title="Algorithm Parameters" expanded="true">
            <param label="tolerance" name="tolerance" type="float" value="0.1"
                   help="Peaks will be considered a match when less than tolerance apart. Absolute m/z value, not in ppm."/>
            <param label="mz_power" name="mz_power" type="float" value="0.0"
                   help="The power to raise mz to in the cosine function."/>
            <param label="intensity_power" name="intensity_power" type="float" value="1.0"
                   help="The power to raise intensity to in the cosine function."/>
        </section>

        <conditional name="ri_filtering">
            <param name="is_true" label="Apply RI filtering" type="boolean" truevalue="TRUE" falsevalue="FALSE"
                   checked="false"/>
            <when value="TRUE">
            <param label="tolerance" name="tolerance" type="float" value="60"
                   help="Peaks will be considered a match when less than tolerance apart."/>
            </when>
        </conditional>
    </inputs>

    <outputs>
        <data label="$similarity_metric scores of ${on_string}" name="similarity_scores" format="json"/>
    </outputs>

    <tests>
        <test> <!-- TEST #1: Test scoring of different file formats. -->
            <param name="references" value="similarity/fill.mgf" ftype="mgf"/>
            <param name="queries" value="similarity/fill2.msp" ftype="msp"/>
            <param name="similarity_metric" value="CosineGreedy"/>
            <output name="similarity_scores" file="similarity/scores_test1_out.json" ftype="json"
                checksum="md5$72f96c48f8c34cf2a7c37d3aede33ca0"/>
        </test>
        <test> <!-- TEST #2: Test scoring of the same file formats. -->
            <param name="references" value="similarity/RECETOX_Exposome_pesticides_HR_MS_20220323.msp" ftype="msp"/>
            <param name="queries" value="similarity/fill2.msp" ftype="msp"/>
            <param name="similarity_metric" value="CosineGreedy"/>
            <output name="similarity_scores" file="similarity/scores_test2_out.json" ftype="json"
                checksum="md5$d325a895f74262087553d08cc40a99aa"/>
        </test>
        <test> <!-- TEST #3: Test scoring with applying RI filtering. -->
            <param name="references" value="similarity/fill.mgf" ftype="mgf"/>
            <param name="queries" value="similarity/fill2.msp" ftype="msp"/>
            <conditional name="ri_filtering">
                <param name="is_true" value="True"></param>
                <param name="tolerance" value="60.0" />
            </conditional>
            <param name="similarity_metric" value="CosineHungarian"/>
            <output name="similarity_scores" file="similarity/scores_test3_out.json" ftype="json"
                checksum="md5$437c03775ebe978f03b7c63aa09ee52e"/>
        </test>
        <test> <!-- TEST #4: Test symmetric scoring. -->
            <param name="queries" value="similarity/recetox_gc-ei_ms_20201028.msp" ftype="msp"/>
            <param name="is_symmetric" value="TRUE"/>
            <param name="similarity_metric" value="NeutralLossesCosine"/>
            <output name="similarity_scores" file="similarity/scores_test4_out.json" ftype="json"
                checksum="md5$951b3bad2207d8301e0c60397533e607"/>
        </test>
        <test> <!-- TEST #5: Test symmetric scoring with applying RI filtering. -->
            <param name="queries" value="similarity/recetox_gc-ei_ms_20201028.msp" ftype="msp"/>
            <param name="similarity_metric" value="ModifiedCosine"/>
            <param name="is_symmetric" value="TRUE" />
            <conditional name="ri_filtering">
                <param name="is_true" value="True"></param>
                <param name="tolerance" value="60.0" />
            </conditional>
            <output name="similarity_scores" file="similarity/scores_test5_out.json" ftype="json"
                checksum="md5$31f83451443a1996fbd7fbc204803481"/>
        </test>
    </tests>

    <help>
        <![CDATA[
            @HELP_matchms@
        ]]>
    </help>

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