comparison matchms_similarity.xml @ 0:e5010b19d64d draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit f79a5b51599254817727bc9028b9797ea994cb4e
author recetox
date Tue, 27 Jun 2023 14:26:29 +0000
parents
children 872d8040f713
comparison
equal deleted inserted replaced
-1:000000000000 0:e5010b19d64d
1 <tool id="matchms_similarity" name="matchms similarity" version="@TOOL_VERSION@+galaxy0" profile="21.09">
2 <description>calculate the similarity score and matched peaks</description>
3
4 <macros>
5 <import>macros.xml</import>
6 <import>help.xml</import>
7 </macros>
8 <expand macro="creator"/>
9 <expand macro="bio.tools"/>
10
11 <requirements>
12 <requirement type="package" version="0.8.0">spec2vec</requirement>
13 <requirement type="package" version="@TOOL_VERSION@">matchms</requirement>
14 </requirements>
15
16 <environment_variables>
17 <environment_variable name="MPLCONFIGDIR">\$_GALAXY_JOB_TMP_DIR</environment_variable>
18 </environment_variables>
19
20 <command detect_errors="exit_code"><![CDATA[
21 sh ${matchms_python_cli}
22 ]]> </command>
23
24 <configfiles>
25 <configfile name="matchms_python_cli">
26 python3 ${__tool_directory__}/matchms_similarity_wrapper.py \
27 #if $ri_filtering.is_true
28 -r $ri_filtering.tolerance \
29 #end if
30 #if $symmetric.is_symmetric
31 -s \
32 #else
33 --ref "$references" \
34 --ref_format "$references.ext" \
35 #end if
36 --array_type "$array_type" \
37 #if $metric.similarity_metric == "Spec2Vec"
38 --spec2vec_model "$metric.model_metadata" \
39 --spec2vec_weights "$metric.model_weights" \
40 --allow_missing_percentage $metric.algorithm.allow_missing_percentage \
41 #end if
42 "$queries" \
43 "$queries.ext" \
44 "$metric.similarity_metric" \
45 #if $metric.similarity_metric == "Spec2Vec"
46 0 \
47 0 \
48 #else
49 $metric.algorithm.tolerance \
50 $metric.algorithm.mz_power \
51 #end if
52 $metric.algorithm.intensity_power \
53 "$similarity_scores"
54 </configfile>
55 </configfiles>
56
57 <inputs>
58 <param label="Queries spectra" name="queries" type="data" format="msp,mgf"
59 help="Query mass spectra to match against references."/>
60 <conditional name="symmetric">
61 <param name="is_symmetric" label="Symmetric" type="boolean" truevalue="TRUE" falsevalue="FALSE"
62 checked="false"/>
63 <when value="FALSE">
64 <param label="Reference spectra" name="references" type="data" format="msp,mgf"
65 help="Reference mass spectra to match against as library."/>
66 </when>
67 </conditional>
68 <param label="Scores array type" name="array_type" type="select" display="radio"
69 help="Matrix type for storing scores objects. Sparse type more memory-efficient and better for large arrays.
70 Note that whatever is selected the output might still be sprase array if scores have too much 0-entries.">
71 <option value="numpy" selected="true">dense</option>
72 <option value="sparse">sparse</option>
73 </param>
74 <conditional name="metric">
75 <param label="Similarity metric" name="similarity_metric" type="select" display="radio"
76 help="Similarity metric to use for score computation.">
77 <expand macro="similarity_metrics"/>
78 <option value="Spec2Vec">Spec2Vec</option>
79 </param>
80 <when value="CosineGreedy">
81 <expand macro="similarity_algorithm_params"/>
82 </when>
83 <when value="CosineHungarian">
84 <expand macro="similarity_algorithm_params"/>
85 </when>
86 <when value="ModifiedCosine">
87 <expand macro="similarity_algorithm_params"/>
88 </when>
89 <when value="NeutralLossesCosine">
90 <expand macro="similarity_algorithm_params"/>
91 </when>
92 <when value="Spec2Vec">
93 <param label="Model JSON file" name="model_metadata" type="data" format="json"
94 help="Model JSON file to use for Spec2Vec similarity computing."/>
95 <param label="Model NPY file" name="model_weights" type="data" format="binary"
96 help="Model NPY file to use for Spec2Vec similarity computing."/>
97
98 <section name="algorithm" title="Algorithm Parameters" expanded="true">
99 <param label="intensity_power" name="intensity_power" type="float" value="0.0"
100 help="Spectrum vectors are a weighted sum of the word vectors. The given word intensities will be raised to the given power.
101 The default is 0, which means that no weighing will be done."/>
102 <param label="Maximum share of new peaks" name="allow_missing_percentage" type="float" value="0.1" max="1.0" min="0.0"
103 help="Maximum allowed share of the peaks that are new to the model in relation to the whole peak corpus."/>
104 </section>
105 </when>
106 </conditional>
107
108
109 <conditional name="ri_filtering">
110 <param name="is_true" label="Apply RI filtering" type="boolean" truevalue="TRUE" falsevalue="FALSE"
111 checked="false"/>
112 <when value="TRUE">
113 <param label="tolerance" name="tolerance" type="float" value="60"
114 help="Peaks will be considered a match when less than tolerance apart."/>
115 </when>
116 </conditional>
117 </inputs>
118
119 <outputs>
120 <data label="$metric.similarity_metric scores of ${on_string}" name="similarity_scores" format="json"/>
121 </outputs>
122
123 <tests>
124 <test> <!-- TEST #1: Test scoring of different file formats. -->
125 <param name="references" value="similarity/fill.mgf" ftype="mgf"/>
126 <param name="queries" value="similarity/fill2.msp" ftype="msp"/>
127 <conditional name="metric">
128 <param name="similarity_metric" value="CosineGreedy"/>
129 </conditional>
130 <output name="similarity_scores" file="similarity/scores_test1_out.json" ftype="json"/>
131 </test>
132 <test> <!-- TEST #2: Test scoring of the same file formats. -->
133 <param name="references" value="similarity/RECETOX_Exposome_pesticides_HR_MS_20220323.msp" ftype="msp"/>
134 <param name="queries" value="similarity/fill2.msp" ftype="msp"/>
135 <conditional name="metric">
136 <param name="similarity_metric" value="CosineGreedy"/>
137 </conditional>
138 <output name="similarity_scores" file="similarity/scores_test2_out.json" ftype="json"/>
139 </test>
140 <test> <!-- TEST #3: Test scoring with applying RI filtering -->
141 <param name="references" value="similarity/fill.mgf" ftype="mgf"/>
142 <param name="queries" value="similarity/fill2.msp" ftype="msp"/>
143 <conditional name="ri_filtering">
144 <param name="is_true" value="True"></param>
145 <param name="tolerance" value="60.0" />
146 </conditional>
147 <conditional name="metric">
148 <param name="similarity_metric" value="CosineHungarian"/>
149 </conditional>
150 <output name="similarity_scores" file="similarity/scores_test3_out.json" ftype="json"/>
151 </test>
152 <test> <!-- TEST #4: Test symmetric scoring. -->
153 <param name="queries" value="similarity/recetox_gc-ei_ms_20201028.msp" ftype="msp"/>
154 <param name="is_symmetric" value="TRUE"/>
155 <conditional name="metric">
156 <param name="similarity_metric" value="NeutralLossesCosine"/>
157 </conditional>
158 <output name="similarity_scores" file="similarity/scores_test4_out.json" ftype="json"/>
159 </test>
160 <test> <!-- TEST #5: Test symmetric scoring with applying RI filtering. -->
161 <param name="queries" value="similarity/recetox_gc-ei_ms_20201028.msp" ftype="msp"/>
162 <conditional name="metric">
163 <param name="similarity_metric" value="ModifiedCosine"/>
164 </conditional>
165 <param name="is_symmetric" value="TRUE" />
166 <conditional name="ri_filtering">
167 <param name="is_true" value="True"></param>
168 <param name="tolerance" value="60.0" />
169 </conditional>
170 <output name="similarity_scores" file="similarity/scores_test5_out.json" ftype="json"/>
171 </test>
172 <test> <!-- TEST #6: Test Spec2Vec. -->
173 <param name="references" value="similarity/spec2vec/inp_filtered_library.msp" ftype="msp"/>
174 <param name="queries" value="similarity/spec2vec/inp_filtered_spectra.msp" ftype="msp"/>
175 <conditional name="metric">
176 <param name="similarity_metric" value="Spec2Vec"/>
177 <param name="model_metadata" value="similarity/spec2vec/model.json" ftype="json"/>
178 <param name="model_weights" value="similarity/spec2vec/weights_100.binary" ftype="auto"/>
179 <param name="allow_missing_percentage" value="1.0"/>
180 </conditional>
181 <output name="similarity_scores" file="similarity/scores_test6_out.json" ftype="json" compare="sim_size" delta="100000"/>
182 </test>
183 </tests>
184
185 <help>
186 @HELP_matchms@
187 </help>
188
189 <expand macro="citations"/>
190 </tool>