comparison matchms_metadata_export.xml @ 15:48c7b584032a draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit 4b8a43b863ff8a0ff1d5a08e516068853adf358d
author recetox
date Tue, 16 Apr 2024 11:26:55 +0000
parents c01868645f1b
children e337075d0aaa
comparison
equal deleted inserted replaced
14:786df5cf7dec 15:48c7b584032a
1 <tool id="matchms_metadata_export" name="matchms metadata export" version="@TOOL_VERSION@+galaxy1" profile="21.09"> 1 <tool id="matchms_metadata_export" name="matchms metadata export" version="@TOOL_VERSION@+galaxy2" profile="21.09">
2 <description>extract all metadata from mass spectra file to tabular format</description> 2 <description>extract all metadata from mass spectra file to tabular format</description>
3 <macros> 3 <macros>
4 <import>macros.xml</import> 4 <import>macros.xml</import>
5 <import>help.xml</import> 5 <import>help.xml</import>
6 </macros> 6 </macros>
16 ]]></command> 16 ]]></command>
17 17
18 <configfiles> 18 <configfiles>
19 <configfile name="matchms_python_cli"> 19 <configfile name="matchms_python_cli">
20 import matchms 20 import matchms
21 import pandas as pd
21 from matchms.importing import load_from_msp, load_from_mgf 22 from matchms.importing import load_from_msp, load_from_mgf
22 from matchms.exporting.metadata_export import export_metadata_as_csv 23 from matchms.exporting.metadata_export import export_metadata_as_csv
23 24
24 25
25 if "$harmonize_metadata" == "False": 26 if "$harmonize_metadata" == "False":
26 matchms.Metadata.set_key_replacements({}) 27 matchms.Metadata.set_key_replacements({})
27 28
28 spectra_list = list(load_from_${input_file.ext}("${input_file}", $harmonize_metadata)) 29 spectra_list = list(load_from_${input_file.ext}("${input_file}", $harmonize_metadata))
29 30
30 export_metadata_as_csv(spectra_list, "${output_file}") 31 export_metadata_as_csv(spectra_list, "${output_file}")
32
33 data = pd.read_csv("${output_file}")
34
35 data.to_csv("${output_file}", sep='\t', index=False)
31 </configfile> 36 </configfile>
32 </configfiles> 37 </configfiles>
33 38
34 <inputs> 39 <inputs>
35 <param label="Spectra file" name="input_file" type="data" format="msp,mgf" help="Mass spectral library file."/> 40 <param label="Spectra file" name="input_file" type="data" format="msp,mgf" help="Mass spectral library file."/>
36 <param label="Harmonize metadata" name="harmonize_metadata" type="boolean" truevalue="True" falsevalue="False" 41 <param label="Harmonize metadata" name="harmonize_metadata" type="boolean" truevalue="True" falsevalue="False"
37 checked="false" help="Apply harmonization process on the metadata keys (e.g. parse numeric values, derive precursor mass)."/> 42 checked="false" help="Apply harmonization process on the metadata keys (e.g. parse numeric values, derive precursor mass)."/>
38 </inputs> 43 </inputs>
39 44
40 <outputs> 45 <outputs>
41 <data label="matchms extract metadata on ${on_string}" name="output_file" format="csv"/> 46 <data label="matchms extract metadata on ${on_string}" name="output_file" format="tsv"/>
42 </outputs> 47 </outputs>
43 48
44 <tests> 49 <tests>
45 <test> 50 <test>
46 <param name="input_file" value="convert/mgf_out.mgf" ftype="mgf"/> 51 <param name="input_file" value="convert/mgf_out.mgf" ftype="mgf"/>
47 <param name="harmonize_metadata" value="True"/> 52 <param name="harmonize_metadata" value="True"/>
48 <output name="output_file" file="convert/metadata.csv" ftype="csv" compare="sim_size" delta="0"/> 53 <output name="output_file" file="convert/metadata.tsv" ftype="tsv" compare="sim_size" delta="0"/>
49 </test> 54 </test>
50 <test> 55 <test>
51 <param name="input_file" value="similarity/RECETOX_Exposome_pesticides_HR_MS_20220323.msp" ftype="msp"/> 56 <param name="input_file" value="similarity/RECETOX_Exposome_pesticides_HR_MS_20220323.msp" ftype="msp"/>
52 <param name="harmonize_metadata" value="True"/> 57 <param name="harmonize_metadata" value="True"/>
53 <output name="output_file" file="convert/metadata.csv" ftype="csv" compare="sim_size" delta="0"/> 58 <output name="output_file" file="convert/metadata.tsv" ftype="tsv" compare="sim_size" delta="0"/>
54 </test> 59 </test>
55 </tests> 60 </tests>
56 61
57 <help> 62 <help>
58 Documentation 63 Documentation