Mercurial > repos > recetox > matchms_convert
comparison matchms_convert.xml @ 4:d4609fbf8ca3 draft
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
author | recetox |
---|---|
date | Thu, 12 Oct 2023 13:30:20 +0000 |
parents | b9cc12600553 |
children | c5ed6bfcd806 |
comparison
equal
deleted
inserted
replaced
3:b9cc12600553 | 4:d4609fbf8ca3 |
---|---|
1 <tool id="matchms_convert" name="matchms convert" version="@TOOL_VERSION@+galaxy0" profile="21.05"> | 1 <tool id="matchms_convert" name="matchms convert" version="@TOOL_VERSION@+galaxy2" profile="21.05"> |
2 <description>convert between mass spectral library formats (.mgf/.msp/.json) using matchms</description> | 2 <description>convert between mass spectral library formats (.mgf/.msp/.json) using matchms</description> |
3 | 3 |
4 <macros> | 4 <macros> |
5 <import>macros.xml</import> | 5 <import>macros.xml</import> |
6 <import>help.xml</import> | 6 <import>help.xml</import> |
17 <requirement type="package" version="@TOOL_VERSION@">matchms</requirement> | 17 <requirement type="package" version="@TOOL_VERSION@">matchms</requirement> |
18 </requirements> | 18 </requirements> |
19 | 19 |
20 <command detect_errors='aggressive'><![CDATA[ | 20 <command detect_errors='aggressive'><![CDATA[ |
21 python ${matchms_python_cli} | 21 python ${matchms_python_cli} |
22 #if $output_file.output_format == "msp": | |
23 #if $output_file.export_style == "ms_lima": | |
24 && | |
25 sh ${ms_lima_output} | |
26 #end if | |
27 #end if | |
22 ]]></command> | 28 ]]></command> |
23 | 29 |
24 <configfiles> | 30 <configfiles> |
25 <configfile name="matchms_python_cli"> | 31 <configfile name="matchms_python_cli"> |
26 @init_logger@ | 32 @init_logger@ |
27 | 33 |
28 from matchms.importing import load_from_msp, load_from_mgf, load_from_json | 34 from matchms.importing import load_from_msp, load_from_mgf, load_from_json |
29 from matchms.exporting import save_as_msp, save_as_mgf, save_as_json | 35 from matchms.exporting import save_as_msp, save_as_mgf, save_as_json |
30 spectra = list(load_from_${spectral_library.ext}("${spectral_library}", ${harmonization_metadata})) | 36 spectra = list(load_from_${spectral_library.ext}("${spectral_library}", ${harmonization_metadata})) |
31 #if $output_file.output_format == "msp" | 37 #if $output_file.output_format == "msp" |
38 #if $output_file.export_style == "ms_lima" | |
39 save_as_msp(spectra, "${converted_library}", write_peak_comments = ${output_file.export_peak_comments}, style = "riken") | |
40 #else | |
32 save_as_msp(spectra, "${converted_library}", write_peak_comments = ${output_file.export_peak_comments}, style = "${output_file.export_style}") | 41 save_as_msp(spectra, "${converted_library}", write_peak_comments = ${output_file.export_peak_comments}, style = "${output_file.export_style}") |
42 #end if | |
33 #else | 43 #else |
34 save_as_${output_file.output_format}(spectra, "${converted_library}") | 44 save_as_${output_file.output_format}(spectra, "${converted_library}") |
35 #end if | 45 #end if |
46 </configfile> | |
47 <configfile name="ms_lima_output"> | |
48 sed -E "s,[[:space:]]+, ,g" ${converted_library} > ${converted_library}.tmp | |
49 | |
50 grep -rl 'IONMODE' . | xargs sed '/IONMODE/d' ${converted_library}.tmp > ${converted_library}.tmp1 | |
51 grep -rl 'CHARGE' . | xargs sed '/CHARGE/d' ${converted_library}.tmp1 > ${converted_library}.tmp2 | |
52 grep -rl 'COMPOUND_NAME' . | xargs sed 's/COMPOUND_NAME/NAME/g' ${converted_library}.tmp2 > ${converted_library}.tmp3 | |
53 | |
54 mv ${converted_library}.tmp3 ${converted_library} | |
55 rm -f ${converted_library}.tmp1 ${converted_library}.tmp2 ${converted_library}.tmp3 ${converted_library}.tmp | |
36 </configfile> | 56 </configfile> |
37 </configfiles> | 57 </configfiles> |
38 | 58 |
39 <inputs> | 59 <inputs> |
40 <param label="Spectra file" name="spectral_library" type="data" format="msp,mgf,json" | 60 <param label="Spectra file" name="spectral_library" type="data" format="msp,mgf,json" |
60 <option value="matchms" selected="true">matchms</option> | 80 <option value="matchms" selected="true">matchms</option> |
61 <option value="massbank">massbank</option> | 81 <option value="massbank">massbank</option> |
62 <option value="nist">nist</option> | 82 <option value="nist">nist</option> |
63 <option value="riken">riken</option> | 83 <option value="riken">riken</option> |
64 <option value="gnps">gnps</option> | 84 <option value="gnps">gnps</option> |
85 <option value="ms_lima">ms-lima</option> | |
65 </param> | 86 </param> |
66 </when> | 87 </when> |
67 <when value="mgf" /> | 88 <when value="mgf" /> |
68 <when value="json" /> | 89 <when value="json" /> |
69 </conditional> | 90 </conditional> |
113 <param name="export_peak_comments" value="True"/> | 134 <param name="export_peak_comments" value="True"/> |
114 <param name="output_format" value="msp"/> | 135 <param name="output_format" value="msp"/> |
115 <param name="export_style" value="matchms"/> | 136 <param name="export_style" value="matchms"/> |
116 <output name="converted_library" file="convert/harmonized_msp_peakcomments_out.msp" ftype="msp"/> | 137 <output name="converted_library" file="convert/harmonized_msp_peakcomments_out.msp" ftype="msp"/> |
117 </test> | 138 </test> |
139 <test> | |
140 <param name="spectral_library" value="convert/mgf_out.mgf" ftype="mgf"/> | |
141 <param name="harmonization_metadata" value="True"/> | |
142 <param name="export_peak_comments" value="False"/> | |
143 <param name="output_format" value="msp"/> | |
144 <param name="export_style" value="ms_lima"/> | |
145 <output name="converted_library" file="convert/ms_lima_output.msp" ftype="msp"/> | |
146 </test> | |
118 </tests> | 147 </tests> |
119 | 148 |
120 | 149 |
121 <help><![CDATA[ | 150 <help><![CDATA[ |
122 Description | 151 Description |