diff macros.xml @ 5:a177ac3c752c draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit f79a5b51599254817727bc9028b9797ea994cb4e
author recetox
date Tue, 27 Jun 2023 14:25:01 +0000
parents 357df6c47d92
children 13de8005adba
line wrap: on
line diff
--- a/macros.xml	Thu Apr 27 12:01:48 2023 +0000
+++ b/macros.xml	Tue Jun 27 14:25:01 2023 +0000
@@ -1,5 +1,5 @@
 <macros>
-    <token name="@TOOL_VERSION@">0.17.0</token>
+    <token name="@TOOL_VERSION@">0.20.0</token>
 
     <xml name="creator">
         <creator>
@@ -31,69 +31,75 @@
         </creator>
     </xml>
     
-    <token name="@HELP_matchms@">
-        <![CDATA[
-            Documentation
-                For documentation on the tool see https://github.com/matchms/matchms/blob/master/README.rst
-                and https://matchms.readthedocs.io/en/latest/.
+    <xml name="bio.tools">
+        <xrefs>
+            <xref type="bio.tools">matchms</xref>
+        </xrefs>
+    </xml>
 
-            Upstream Tools
-                +-----------+---------------+--------+-----------+
-                | Name      | Output File   | Format | Parameter |
-                +===========+===============+========+===========+
-                | RAMClustR | Mass spectra  | msp    | references|
-                +-----------+---------------+--------+-----------+
-                | RAMClustR | Mass spectra  | msp    | queries   |
-                +-----------+---------------+--------+-----------+
+    <xml name="similarity_metrics">
+        <option value="CosineGreedy" selected="true">CosineGreedy</option>
+        <option value="CosineHungarian">CosineHungarian</option>
+        <option value="ModifiedCosine">ModifiedCosine</option>
+        <option value="NeutralLossesCosine">NeutralLossesCosine</option>
+    </xml>
 
-            Downstream Tools
-                The output is a JSON file containing serialized matchMS Scores object. The file can be processed by **matchMS output formatter**. 
-        ]]>
-    </token>
-    
-    <token name="@HELP_matchms_networking@">
-        <![CDATA[
-        Documentation
-        For documentation on the tool see https://github.com/matchms/matchms/blob/master/README.rst
-        and https://matchms.readthedocs.io/en/latest/.
-        
-        **Upstream Tools**
+    <xml name="similarity_algorithm_params">
+        <section name="algorithm" title="Algorithm Parameters" expanded="true">
+            <param label="tolerance [Da]" name="tolerance" type="float" value="0.1"
+                   help="Peaks will be considered a match when less than tolerance apart. Absolute m/z value, not in ppm."/>
+            <param label="mz_power" name="mz_power" type="float" value="0.0"
+                   help="The power to raise mz to in the cosine function."/>
+            <param label="intensity_power" name="intensity_power" type="float" value="1.0"
+                   help="The power to raise intensity to in the cosine function."/>
+        </section>
+    </xml>
 
-        matchMS similarity
-        
-        **Downstream Tools**
-        
-        The output is a network-graph file that can be visualized using graph visualization software (e.g., Cytoscape).
-        ]]>
-    </token>
-    
-    <token name="@HELP_formatter@">
-        <![CDATA[
-            Usage
-                This tool creates user friendly tables from the similarity scores produced by **matchMS similarity**.
-                The tool can be operated on two modes based on (i) thresholds or (ii) top k matches.
-
-            Input Table Format
-                The tool expects a JSON file containing serialized matchMS Scores object.
+    <xml name="input_param">
+        <conditional name="scores">
+            <param name="use_scores" label="Use Scores Object" type="boolean" truevalue="TRUE" falsevalue="FALSE"
+                   checked="false"/>
+            <when value="TRUE">
+                <param label="Scores object" name="scores_in" type="data" format="json"
+                    help="Scores objects calculated previously using one of the matchms similarity tools." />
+                <param label="join type" name="join_type" type="select" display="radio"
+                    help="The join type to use for appending scores - see [1] for details.">
+                    <option value="left" selected="true">left</option>
+                    <option value="inner">inner</option>
+                    <option value="right">right</option>
+                    <option value="outer">outer</option>
+                </param>
+            </when>
+            <when value="FALSE">
+                <param label="Queries spectra" name="queries" type="data" format="msp"
+                    help="Query mass spectra to match against references."/>
+                <param label="Reference spectra" name="references" type="data" format="msp"
+                    help="Reference mass spectra to match against as library."/>
+            </when>
+        </conditional>
+    </xml>
 
-            Output Table Format
-                +----------+-----------+---------+--------+
-                | query    | reference | matches | scores |
-                +==========+===========+=========+========+
-                | C001     | Glycine   |      6  | 0.5    |
-                +----------+-----------+---------+--------+
-                | C002     | Glycine   |     3   | 0.34   |
-                +----------+-----------+---------+--------+
-                |   ...    | ...       | ...     | ...    |
-                +----------+-----------+---------+--------+
-        ]]>
-    </token>
-    
-        <xml name="citations">
-            <citations>
-                <citation type="doi">10.5281/zenodo.7178586</citation>
-                <citation type="doi">10.21105/joss.02411</citation>
-            </citations>
-        </xml>
+    <xml name="citations">
+        <citations>
+            <citation type="doi">10.5281/zenodo.7178586</citation>
+            <citation type="doi">10.21105/joss.02411</citation>
+        </citations>
+    </xml>
 
+<token name="@init_scores@">
+from matchms.importing import load_from_msp, scores_from_json
+from matchms import Scores
+#if $scores.use_scores
+scores = scores_from_json("$scores_in")
+join_type = "$scores.join_type"
+#else
+scores = Scores(references=list(load_from_msp("$references")), queries=list(load_from_msp("$queries")), is_symmetric=False)
+join_type = "left"
+#end if
+</token>
+
+<token name="@init_logger@">
+from matchms import set_matchms_logger_level
+set_matchms_logger_level("WARNING")
+</token>   
 </macros>