view mzmine_batch.xml @ 0:02e802817d48 draft

planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics/blob/master/tools/mzmine/ commit dbad3fc09e109598befcec3a9a000496f4e0c9dd
author iuc
date Sat, 21 Oct 2023 10:29:31 +0000
parents
children 90d60c9da21e
line wrap: on
line source

<tool id="mzmine_batch" name="MZMine batch" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="21.05">
    <macros>
        <token name="@TOOL_VERSION@">3.6.0</token>
        <token name="@VERSION_SUFFIX@">0</token>
    </macros>
    <xrefs>
        <xref type="bio.tools">mzmine</xref>
    </xrefs>
    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">mzmine</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
    #import re
    
    mkdir -p input &&
    #for $i in $input
        #set escaped_i = re.sub('[^\s\w\-\.]', '_', str($i.element_identifier))
        ln -s '$i' 'input/$escaped_i'.$i.ext &&
        echo 'input/$escaped_i'.$i.ext >> input.txt &&
    #end for

    #if $libraries
        mkdir -p libraries &&
        #for $l in $libraries
            #set escaped_l = re.sub('[^\s\w\-\.]', '_', str($l.element_identifier))
            ln -s '$l' 'libraries/$escaped_l'.$l.ext &&
            echo 'libraries/$escaped_l'.$l.ext >> libraries.txt &&
        #end for
    #end if
    ## modify output paths in batch XML to relative path
    ## - any output will be redirected to ./output/BASENAME
    mkdir -p output/ &&
    
    sed -e 's@<current_file>.*[\\\/]\([^\\\/]\+\)</current_file>@<current_file>./output/\1</current_file>@' '$batch' > batch.xml &&

    mzmine
        --batch 'batch.xml'
        --input 'input.txt'
        #if $libraries
            --libraries 'libraries.txt'
        #end if
        --memory "\${MZMINE_MEMORY:-none}"
        --temp "\${TMPDIR:-\$_GALAXY_JOB_TMP_DIR}"
        --threads \${GALAXY_SLOTS:-1}
## ignored parameters
##  -p,--pref <arg>        preferences file
## -r,--running          keep MZmine running in headless mode
## -tdfpseudoprofile     Loads pseudo-profile frame spectra for tdf files
##                       instead of centroided spectra.
## -tsfprofile           Loads profile spectra from .tsf data instead of
##                       centroid spectra.
    ]]></command>
    <inputs>
        <param argument="--batch" type="data" format="xml" label="MZMine batch file" help="XML batch file (ideally created with version @TOOL_VERSION@)"/>
        <param argument="--input" type="data" format="mzml,mzxml,csv" multiple="true" label="Spectra (mzml)"/>
        <param argument="--libraries" type="data" format="json,mgf,msp" multiple="true" optional="true" label="Spectral libraries"/>
    </inputs>
    <outputs>
        <collection name="output" type="list">
            <discover_datasets pattern="__name_and_ext__" directory="output"/>
        </collection>
    </outputs>
    <tests>
        <test>
            <param name="batch" value="test_small.xml" ftype="xml"/>
            <param name="input" value="DOM_a.mzML,DOM_b.mzXML"/>
            <param name="libraries" value="GNPS-FAULKNERLEGACY.json" ftype="json"/>
            <!-- <param name="input" location="https://raw.githubusercontent.com/mzmine/mzmine3/master/src/test/resources/rawdatafiles/DOM_a.mzML"/> -->
            <!-- <param name="input" location="https://raw.githubusercontent.com/mzmine/mzmine3/master/src/test/resources/rawdatafiles/DOM_a.mzML,https://raw.githubusercontent.com/mzmine/mzmine3/master/src/test/resources/rawdatafiles/DOM_b.mzXML"/>
            <param name="libraries" location="https://external.gnps2.org/gnpslibrary/GNPS-FAULKNERLEGACY.json" ftype="json"/> -->
            <output_collection name="output" count="3" type="list">
                <element name="test2_iimn_gnps" ftype="mgf">
                    <assert_contents>
                        <has_n_lines n="2103"/>
                        <has_text text="BEGIN IONS"/>
                    </assert_contents>
                </element>
                <element name="test2_iimn_gnps_quant" ftype="csv">
                    <assert_contents>
                        <has_n_lines n="34"/>
                        <has_n_columns sep="," n="16"/>
                    </assert_contents>
                </element>
                <element name="test2_sirius" ftype="mgf">
                    <assert_contents>
                        <has_n_lines n="54406"/>
                        <has_text text="BEGIN IONS"/>
                    </assert_contents>
                </element>
            </output_collection>
        </test>
    </tests>
    <help><![CDATA[
        MZmine 3 is an open-source software for mass-spectrometry data processing, with the main focus on LC-MS data.

        This Galaxy tool allows to execute MZmine batches. That is you can create MZmine batch (XML) files thatdescribe the parameters of a MZmine analysis using the MZmine GUI
        and use this to execute such an analysis on the Galaxy platform. 

        **Inputs**

        - MZMine batch file in XML format. This file describes the parameters for a MZmine batch analysis. It can be generated with the MZmine GUI (preferentiall with a matching version, i.e. @TOOL_VERSION@).
        - Input spectra in mzml format
        - Spectra libraries in mgf or json format (optional)

        **Outputs**

        Galaxy will store all outputs of MZMine in a single collection. When specifying the batch XML
        file one should pay attention to use file extensions that correspond to Galaxy datatypes
        (which allows Galaxy to easily autodetect the datatype). The following extensions can be used
        (lower/upper case does not matter):

        - mzml
        - netcdf
        - mgf
        - txt
        - msp
        - csv
        - mztab
        - mztab2 (this is mzTab-m)
        - json
        - tabular (Galaxy's tsv implementation)

        Specific datasets from the collection can be accessed using the *Extract dataset* tool, e.g.
        for further processing in Galaxy.
    ]]></help>
    <citations>
        <citation type="doi">10.1038/s41587-023-01690-2</citation>
    </citations>
</tool>