view matchms_metadata_export.xml @ 14:786df5cf7dec draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit f14275bfdc2caa760d71d307ca1803eab1adde76
author recetox
date Wed, 13 Mar 2024 10:18:57 +0000
parents c01868645f1b
children 48c7b584032a
line wrap: on
line source

<tool id="matchms_metadata_export" name="matchms metadata export" version="@TOOL_VERSION@+galaxy1" 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">
import matchms
from matchms.importing import load_from_msp, load_from_mgf
from matchms.exporting.metadata_export import export_metadata_as_csv


if "$harmonize_metadata" == "False":
    matchms.Metadata.set_key_replacements({})

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"/>
            <param name="harmonize_metadata" value="True"/>
            <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"/>
            <param name="harmonize_metadata" value="True"/>
            <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>