Mercurial > repos > recetox > matchms_add_key
view matchms_add_key.xml @ 18:081390a8e739 draft default tip
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit bd80a813fb2f01f22eed0c874f8911ce4d00762a
author | recetox |
---|---|
date | Mon, 30 Jun 2025 12:58:54 +0000 |
parents | b23b6a640f6a |
children |
line wrap: on
line source
<tool id="matchms_add_key" name="matchms add key" version="@TOOL_VERSION@+galaxy0" profile="23.0" license="MIT"> <description>Set metadata key in MSP to static value</description> <macros> <import>macros.xml</import> <import>help.xml</import> </macros> <expand macro="creator"/> <edam_operations> <edam_operation>operation_2409</edam_operation> </edam_operations> <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"> @init_logger@ import matchms from matchms.importing import load_from_msp from matchms.exporting import save_as_msp #set keys_dict = ({str($k.key): str($k.value) for $k in $attribute_repeat}) matchms.Metadata.set_key_replacements({}) spectra = list(load_from_msp("${spectral_library}", metadata_harmonization = "False")) new_spectra = [] for spectrum in spectra: for key, value in ($keys_dict).items(): spectrum.set(key, value) new_spectra.append(spectrum) save_as_msp(new_spectra, "${output}") </configfile> </configfiles> <inputs> <param label="Spectra file" name="spectral_library" type="data" format="msp" help="Mass spectral library file to add key." /> <repeat name="attribute_repeat" title="Keys to add"> <param label="Attribute Name" name="key" type="text" value="" help="Name of the attribute which will be assigned to all spectra records in the MSP." /> <param label="Value" name="value" type="text" value="" help="Value of the attribute which will be assigned to all spectra records in the MSP." > <sanitizer> <valid initial="default"> <add value="{}" /> <add value="[]" /> <add value="\" /> </valid> </sanitizer> </param> </repeat> </inputs> <outputs> <data label="${tool.name} on ${on_string}" name="output" format="msp"> </data> </outputs> <tests> <test> <param name="spectral_library" value="filtering/input.msp" ftype="msp"/> <repeat name="attribute_repeat"> <param name="key" value="tool_used"/> <param name="value" value="matchms"/> </repeat> <output name="output" file="add_key/out_matchms_add_key.msp" ftype="msp"/> </test> <test> <param name="spectral_library" value="add_key/add_key_test2.msp" ftype="msp"/> <repeat name="attribute_repeat"> <param name="key" value="adduct"/> <param name="value" value="[M]+"/> </repeat> <repeat name="attribute_repeat"> <param name="key" value="tool_used"/> <param name="value" value="matchms"/> </repeat> <output name="output" file="add_key/add_key_test2_out.msp" ftype="msp"/> </test> </tests> <help><![CDATA[ Description The tool take MSP file as an input and take as parameters the name of the attribute and its value which will be assigned to all spectra records in the MSP. ]]></help> <citations> <citation type="doi">https://doi.org/10.5281/zenodo.6035335</citation> </citations> </tool>