comparison matchms_spectral_similarity.xml @ 0:9ff95a1a2705 draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit f79a5b51599254817727bc9028b9797ea994cb4e
author recetox
date Tue, 27 Jun 2023 14:28:07 +0000
parents
children 3f96c93f8566
comparison
equal deleted inserted replaced
-1:000000000000 0:9ff95a1a2705
1 <tool id="matchms_spectral_similarity" name="matchms spectral similarity" version="@TOOL_VERSION@+galaxy0" profile="21.09">
2 <description>matchms spectral similarity calculation</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="@TOOL_VERSION@">matchms</requirement>
13 </requirements>
14
15 <environment_variables>
16 <environment_variable name="MPLCONFIGDIR">\$_GALAXY_JOB_TMP_DIR</environment_variable>
17 </environment_variables>
18
19 <command detect_errors="exit_code"><![CDATA[
20 python3 ${python_wrapper}
21 ]]> </command>
22
23 <configfiles>
24 <configfile name="python_wrapper">
25 @init_logger@
26
27 from matchms.similarity import (CosineGreedy, CosineHungarian, MetadataMatch,
28 ModifiedCosine, NeutralLossesCosine)
29
30 similarity = ${similarity_metric}(
31 ${algorithm.tolerance},
32 ${algorithm.mz_power},
33 ${algorithm.intensity_power}
34 )
35 name="${similarity_metric}_${algorithm.tolerance}_${algorithm.mz_power}_${algorithm.intensity_power}"
36
37 @init_scores@
38
39 layer = similarity.sparse_array(
40 references=scores.references,
41 queries=scores.queries,
42 idx_row = scores._scores.row,
43 idx_col = scores._scores.col,
44 is_symmetric=False)
45
46 scores._scores.add_sparse_data(scores._scores.row, scores._scores.col, layer, name)
47
48 scores.filter_by_range(inplace=True, name=name+"_matches", low=0)
49 scores.to_json("$similarity_scores")
50 </configfile>
51 </configfiles>
52 <inputs>
53 <expand macro="input_param"/>
54 <param label="Similarity metric" name="similarity_metric" type="select" display="radio"
55 help="Similarity metric to use for score computation.">
56 <expand macro="similarity_metrics"/>
57 </param>
58 <expand macro="similarity_algorithm_params"/>
59 </inputs>
60
61 <outputs>
62 <data label="$similarity_metric scores of ${on_string}" name="similarity_scores" format="json"/>
63 </outputs>
64 <tests>
65 <test> <!-- TEST #1: Test scoring of the same file formats. -->
66 <param name="references" value="similarity/RECETOX_Exposome_pesticides_HR_MS_20220323.msp" ftype="msp"/>
67 <param name="queries" value="similarity/fill2.msp" ftype="msp"/>
68 <param name="similarity_metric" value="CosineGreedy"/>
69 <output name="similarity_scores" file="spectral_similarity/test1.json" ftype="json"/>
70 </test>
71 <test> <!-- TEST #2: Test scoring with scores as json. -->
72 <param name="use_scores" value="True"/>
73 <param name="scores_in" value="metadata_match/ri_match_60.json" ftype="json"/>
74 <param name="similarity_metric" value="CosineHungarian"/>
75 <output name="similarity_scores" file="spectral_similarity/test2.json" ftype="json"/>
76 </test>
77 </tests>
78
79 <help>
80 Description
81 To compute the spectral similarity, only peaks matching another within the specified tolerance are used.
82 Non-overlapping peaks do not contribute to the score computation.
83 This spectrum vectorization can be interpreted as taking the intersection of spectra A and B.
84
85 This is different from the NIST scoring algorithm which computes a weighted score computed for both spaces, A and B.
86 For more details see this `galaxy training`_.
87
88 .. rubric:: **Footnotes**
89 .. [1] SQL join types explained on LearnSQL_.
90
91 .. _LearnSQL: https://learnsql.com/blog/sql-joins-types-explained/
92 .. _galaxy training: https://training.galaxyproject.org/training-material/topics/metabolomics/tutorials/gc_ms_with_xcms/tutorial.html
93
94 @HELP_matchms@
95 </help>
96
97 <expand macro="citations"/>
98 </tool>