comparison matchms_formatter.xml @ 27:402620029a7a draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit c626c8db7ba4dd30f85f7086e16e1e2413e36bd8
author recetox
date Mon, 22 Apr 2024 08:40:39 +0000
parents f7718efde4d5
children 8bd942dcf1ad
comparison
equal deleted inserted replaced
26:48ade5cc847f 27:402620029a7a
1 <tool id="matchms_formatter" name="matchms scores formatter" version="@TOOL_VERSION@+galaxy3" profile="21.09"> 1 <tool id="matchms_formatter" name="matchms scores formatter" version="@TOOL_VERSION@+galaxy4" profile="21.09">
2 <description>reformat scores object of matchms to long format table</description> 2 <description>reformat scores object of matchms to long format table</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>
11 </edam_operations> 11 </edam_operations>
12 <expand macro="bio.tools"/> 12 <expand macro="bio.tools"/>
13 13
14 <requirements> 14 <requirements>
15 <requirement type="package" version="@TOOL_VERSION@">matchms</requirement> 15 <requirement type="package" version="@TOOL_VERSION@">matchms</requirement>
16 <requirement type="package" version="8.0.1">click</requirement>
17 <requirement type="package" version="1.1.4">pandas</requirement> 16 <requirement type="package" version="1.1.4">pandas</requirement>
18 </requirements> 17 </requirements>
19 18
20 <command detect_errors="aggressive"><![CDATA[ 19 <command detect_errors="aggressive"><![CDATA[
21 sh ${matchms_formatter_cli} 20 python3 '${formatter}'
22 ]]></command> 21 ]]></command>
23 22
24 <environment_variables> 23 <environment_variables>
25 <environment_variable name="MPLCONFIGDIR">\$_GALAXY_JOB_TMP_DIR</environment_variable> 24 <environment_variable name="MPLCONFIGDIR">\$_GALAXY_JOB_TMP_DIR</environment_variable>
26 <environment_variable name="XDG_CACHE_HOME">\$_GALAXY_JOB_TMP_DIR</environment_variable> 25 <environment_variable name="XDG_CACHE_HOME">\$_GALAXY_JOB_TMP_DIR</environment_variable>
27 <environment_variable name="OPENBLAS_NUM_THREADS">4</environment_variable> 26 <environment_variable name="OPENBLAS_NUM_THREADS">4</environment_variable>
28 <environment_variable name="RLIMIT_NPROC">4</environment_variable> 27 <environment_variable name="RLIMIT_NPROC">4</environment_variable>
29 </environment_variables> 28 </environment_variables>
30 29
31 <configfiles> 30 <configfiles>
32 <configfile name="matchms_formatter_cli"> 31 <configfile name="formatter">
33 python3 ${__tool_directory__}/formatter.py \ 32 from matchms.importing import scores_from_json
34 --sf '$scores' \ 33 from pandas import DataFrame
35 --o '$output' 34
35 scores = scores_from_json('$scores')
36 data = []
37
38 for i, (row, col) in enumerate(zip(scores.scores.row, scores.scores.col)):
39 data.append([scores.queries[col].metadata['$key'], scores.references[row].metadata['$key'], *scores.scores.data[i]])
40
41 result = DataFrame(data, columns=['query', 'reference', *scores.scores.score_names])
42
43 result.to_csv('$output', sep="\t", index=False)
44
36 </configfile> 45 </configfile>
37 </configfiles> 46 </configfiles>
38 47
39 <inputs> 48 <inputs>
40 <param label="Scores object" name="scores" type="data" format="json" help="matchms Scores json file." /> 49 <param label="Scores object" name="scores" type="data" format="json" help="matchms Scores json file." />
50 <param label="Key" name="key" type="text" value="compound_name" help="Name of the key to use. Default is 'compound_name'." />
41 </inputs> 51 </inputs>
42 <outputs> 52 <outputs>
43 <data label="${tool.name} on ${on_string}" name="output" format="tsv"/> 53 <data label="${tool.name} on ${on_string}" name="output" format="tsv"/>
44 </outputs> 54 </outputs>
45 55
46 <tests> 56 <tests>
47 <test> 57 <test>
48 <param name="scores" value="formatter/fill2_trunc_scores_with_metadata_match.json" ftype="json"/> 58 <param name="scores" value="formatter/fill2_trunc_scores_with_metadata_match.json" ftype="json"/>
59 <param name="key" value="compound_name"/>
49 <output name="output" value="formatter/fill2_formatted.tsv" ftype="tsv" 60 <output name="output" value="formatter/fill2_formatted.tsv" ftype="tsv"
50 checksum="md5$4f0d83da381b8a403d807d26a9dd0f34"/> 61 checksum="md5$4f0d83da381b8a403d807d26a9dd0f34"/>
51 </test> 62 </test>
52 <test> 63 <test>
53 <param name="scores" value="similarity/scores_test4_out.json" ftype="json"/> 64 <param name="scores" value="similarity/scores_test4_out.json" ftype="json"/>
65 <param name="key" value="compound_name"/>
54 <output name="output" file="formatter/test4_formatted.tsv" ftype="tsv"/> 66 <output name="output" file="formatter/test4_formatted.tsv" ftype="tsv"/>
55 </test> 67 </test>
56 </tests> 68 </tests>
57 69
58 <help> 70 <help>