comparison matchms_remove_key.xml @ 0:ea891750acfc draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit 970c7dc210faacd545c740ddae0e5e78c2cecce4
author recetox
date Mon, 04 Dec 2023 19:17:25 +0000
parents
children 8a8a58be3929
comparison
equal deleted inserted replaced
-1:000000000000 0:ea891750acfc
1 <tool id="matchms_remove_key" name="matchms remove key" version="@TOOL_VERSION@+galaxy0" profile="21.09">
2 <description>Remove metadata entry for all spectra in a library</description>
3
4 <macros>
5 <import>macros.xml</import>
6 <import>help.xml</import>
7 </macros>
8
9 <expand macro="creator"/>
10
11 <edam_operations>
12 <edam_operation>operation_3695</edam_operation>
13 </edam_operations>
14 <expand macro="bio.tools"/>
15
16 <requirements>
17 <requirement type="package" version="@TOOL_VERSION@">matchms</requirement>
18 </requirements>
19
20 <command detect_errors='aggressive'><![CDATA[
21 python3 '${matchms_python_cli}'
22 ]]></command>
23
24 <configfiles>
25 <configfile name="matchms_python_cli">
26 import matchms
27 @init_logger@
28
29 matchms.Metadata.set_key_replacements({})
30 key = "${key}".lower()
31 spectra = list(matchms.importing.load_from_msp("${spectral_library}", metadata_harmonization = "False"))
32 new_spectra = []
33 for spectrum in spectra:
34 if spectrum.get(key) is not None:
35 metadata = spectrum.metadata
36 del metadata[key]
37 spectrum.metadata = metadata
38 new_spectra.append(spectrum)
39 matchms.exporting.save_as_msp(new_spectra, "${output}")
40 </configfile>
41 </configfiles>
42
43 <inputs>
44 <param label="Spectra file" name="spectral_library" type="data" format="msp"
45 help="Mass spectral library file to add key." />
46
47 <param label="Attribute Name" name="key" type="text" value="" help="Name of the attribute which will be removed from all spectra records in the MSP." />
48 </inputs>
49
50 <outputs>
51 <data label="${tool.name} on ${on_string}" name="output" format="msp">
52 </data>
53 </outputs>
54
55 <tests>
56 <test>
57 <param name="spectral_library" value="filtering/input.msp" ftype="msp"/>
58 <param name="key" value="ionmode"/>
59 <output name="output" file="out_matchms_remove_key.msp" ftype="msp" compare="sim_size"/>
60 </test>
61 </tests>
62
63 <help><![CDATA[
64 Description
65 The tool take MSP file as an input and take as parameters the name of the
66 attribute which will be removed from all spectra records in the MSP.
67 ]]></help>
68
69 <citations>
70 <citation type="doi">10.5281/zenodo.6035335</citation>
71 </citations>
72 </tool>