diff matchms_add_key.xml @ 9:3c82adf06cd5 draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit da193865f41a3a840ecc4ba0afab1d358554998a
author recetox
date Mon, 05 Feb 2024 10:37:01 +0000
parents fb80536001bc
children a14e7fe18387
line wrap: on
line diff
--- a/matchms_add_key.xml	Mon Jan 15 12:26:22 2024 +0000
+++ b/matchms_add_key.xml	Mon Feb 05 10:37:01 2024 +0000
@@ -1,4 +1,4 @@
-<tool id="matchms_add_key" name="matchms add key" version="@TOOL_VERSION@+galaxy0" profile="21.09">
+<tool id="matchms_add_key" name="matchms add key" version="@TOOL_VERSION@+galaxy1" profile="21.09">
     <description>Set metadata key in MSP to static value</description>
     
     <macros>
@@ -25,8 +25,13 @@
 <configfile name="matchms_python_cli">
 @init_logger@
 
+import matchms
 from matchms.importing import load_from_msp
 from matchms.exporting import save_as_msp
+
+
+matchms.Metadata.set_key_replacements({})
+
 spectra = list(load_from_msp("${spectral_library}", metadata_harmonization = "False"))
 new_spectra = []
 for spectrum in spectra:
@@ -41,7 +46,15 @@
             help="Mass spectral library file to add key." />
 
         <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." />
+        <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>
     </inputs>
 
     <outputs>
@@ -54,7 +67,13 @@
             <param name="spectral_library" value="filtering/input.msp" ftype="msp"/>
             <param name="key" value="tool_used"/>
             <param name="value" value="matchms"/>
-            <output name="output" file="out_matchms_add_key.msp" ftype="msp"/>
+            <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"/>
+            <param name="key" value="adduct"/>
+            <param name="value" value="[M]+"/>
+            <output name="output" file="add_key/add_key_test2_out.msp" ftype="msp"/>
         </test>
     </tests>