view matchms_metadata_export.xml @ 3:7504a8f93699 draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
author recetox
date Thu, 12 Oct 2023 13:27:11 +0000
parents f04610d25411
children 73c902331bbc
line wrap: on
line source

<tool id="matchms_metadata_export" name="matchms metadata export" version="@TOOL_VERSION@+galaxy2" profile="21.09">
    <description>extract all metadata from mass spectra file to tabular format</description>
    <macros>
        <import>macros.xml</import>
        <import>help.xml</import>
    </macros>
    <expand macro="creator"/>
    <expand macro="bio.tools"/>
    
    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">matchms</requirement>
    </requirements>

    <command detect_errors='aggressive'><![CDATA[
        python ${matchms_python_cli}
    ]]></command>

<configfiles>
<configfile name="matchms_python_cli">
from matchms.importing import load_from_msp, load_from_mgf
from matchms.exporting.metadata_export import export_metadata_as_csv

spectra_list = list(load_from_${input_file.ext}("${input_file}", $harmonize_metadata))

export_metadata_as_csv(spectra_list, "${output_file}")
</configfile>
</configfiles>

    <inputs>
        <param label="Spectra file" name="input_file" type="data" format="msp,mgf" help="Mass spectral library file."/>
        <param label="Harmonize metadata" name="harmonize_metadata" type="boolean" truevalue="True" falsevalue="False"
               checked="false" help="Apply harmonization process on the metadata keys (e.g. parse numeric values, derive precursor mass)."/>
    </inputs>

    <outputs>
        <data label="matchms extract metadata on ${on_string}" name="output_file" format="csv"/>
    </outputs>

    <tests>
        <test>
            <param name="input_file" value="convert/mgf_out.mgf" ftype="mgf"/>
            <output name="output_file" file="convert/metadata.csv" ftype="csv" compare="sim_size" delta="0"/>
        </test>
        <test>
            <param name="input_file" value="similarity/RECETOX_Exposome_pesticides_HR_MS_20220323.msp" ftype="msp"/>
            <output name="output_file" file="convert/metadata.csv" ftype="csv" compare="sim_size" delta="0"/>
        </test>
    </tests>

    <help>
        Documentation
            Mass spectral libraries are often stored in various formats, such as `msp`, `mgf` or `json`.
            This tool can be used to export the metadata accompanying the actual spectral to a tabular file,
            creating a column for each attribute and a row for each spectrum.
            All keys which are present in at least one spectrum are contained in the output.
        
        @HELP_matchms@
    </help>

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